Use typed properties

This commit is contained in:
Jan Böhmer 2022-09-18 22:59:31 +02:00
parent 548ec2ea50
commit 51e05a8669
216 changed files with 603 additions and 698 deletions

View file

@ -60,11 +60,11 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final class AttachmentDataTable implements DataTableTypeInterface
{
private $translator;
private $entityURLGenerator;
private $attachmentHelper;
private $elementTypeNameGenerator;
private $attachmentURLGenerator;
private TranslatorInterface $translator;
private EntityURLGenerator $entityURLGenerator;
private AttachmentManager $attachmentHelper;
private ElementTypeNameGenerator $elementTypeNameGenerator;
private AttachmentURLGenerator $attachmentURLGenerator;
public function __construct(TranslatorInterface $translator, EntityURLGenerator $entityURLGenerator,
AttachmentManager $attachmentHelper, AttachmentURLGenerator $attachmentURLGenerator,

View file

@ -53,8 +53,8 @@ use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
class EntityColumn extends AbstractColumn
{
protected $urlGenerator;
protected $accessor;
protected EntityURLGenerator $urlGenerator;
protected PropertyAccessorInterface $accessor;
public function __construct(EntityURLGenerator $URLGenerator, PropertyAccessorInterface $accessor)
{

View file

@ -48,8 +48,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class LogEntryExtraColumn extends AbstractColumn
{
protected $translator;
protected $formatter;
protected TranslatorInterface $translator;
protected LogEntryExtraFormatter $formatter;
public function __construct(TranslatorInterface $translator, LogEntryExtraFormatter $formatter)
{

View file

@ -52,6 +52,7 @@ use App\Entity\Parts\PartLot;
use App\Entity\PriceInformations\Orderdetail;
use App\Entity\PriceInformations\Pricedetail;
use App\Exceptions\EntityNotSupportedException;
use App\Repository\LogEntryRepository;
use App\Services\ElementTypeNameGenerator;
use App\Services\EntityURLGenerator;
use Doctrine\ORM\EntityManagerInterface;
@ -61,11 +62,11 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class LogEntryTargetColumn extends AbstractColumn
{
protected $em;
protected $entryRepository;
protected $entityURLGenerator;
protected $elementTypeNameGenerator;
protected $translator;
protected EntityManagerInterface $em;
protected LogEntryRepository $entryRepository;
protected EntityURLGenerator $entityURLGenerator;
protected ElementTypeNameGenerator $elementTypeNameGenerator;
protected TranslatorInterface $translator;
public function __construct(EntityManagerInterface $entityManager, EntityURLGenerator $entityURLGenerator,
ElementTypeNameGenerator $elementTypeNameGenerator, TranslatorInterface $translator)

View file

@ -47,7 +47,7 @@ use Omines\DataTablesBundle\Column\AbstractColumn;
class MarkdownColumn extends AbstractColumn
{
protected $markdown;
protected MarkdownParser $markdown;
public function __construct(MarkdownParser $markdown)
{

View file

@ -53,9 +53,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class PartAttachmentsColumn extends AbstractColumn
{
protected $FAIconGenerator;
protected $urlGenerator;
protected $attachmentManager;
protected FAIconGenerator $FAIconGenerator;
protected EntityURLGenerator $urlGenerator;
protected AttachmentManager $attachmentManager;
public function __construct(FAIconGenerator $FAIconGenerator, EntityURLGenerator $urlGenerator, AttachmentManager $attachmentManager)
{

View file

@ -7,8 +7,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class PrettyBoolColumn extends AbstractColumn
{
protected $translator;
protected TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
{

View file

@ -33,8 +33,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class RevertLogColumn extends AbstractColumn
{
protected $translator;
protected $security;
protected TranslatorInterface $translator;
protected Security $security;
public function __construct(TranslatorInterface $translator, Security $security)
{

View file

@ -8,7 +8,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class SIUnitNumberColumn extends AbstractColumn
{
protected $formatter;
protected SIFormatter $formatter;
public function __construct(SIFormatter $formatter)
{

View file

@ -47,7 +47,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class TagsColumn extends AbstractColumn
{
protected $urlGenerator;
protected UrlGeneratorInterface $urlGenerator;
public function __construct(UrlGeneratorInterface $urlGenerator)
{

View file

@ -17,26 +17,13 @@ class AttachmentFilter implements FilterInterface
{
use CompoundFilterTrait;
/** @var NumberConstraint */
protected $dbId;
/** @var InstanceOfConstraint */
protected $targetType;
/** @var TextConstraint */
protected $name;
/** @var EntityConstraint */
protected $attachmentType;
/** @var BooleanConstraint */
protected $showInTable;
/** @var DateTimeConstraint */
protected $lastModified;
/** @var DateTimeConstraint */
protected $addedDate;
protected NumberConstraint $dbId;
protected InstanceOfConstraint $targetType;
protected TextConstraint $name;
protected EntityConstraint $attachmentType;
protected BooleanConstraint $showInTable;
protected DateTimeConstraint $lastModified;
protected DateTimeConstraint $addedDate;
public function __construct(NodesListBuilder $nodesListBuilder)

View file

@ -12,12 +12,12 @@ abstract class AbstractConstraint implements FilterInterface
/**
* @var string The property where this BooleanConstraint should apply to
*/
protected $property;
protected string $property;
/**
* @var string
*/
protected $identifier;
protected string $identifier;
/**

View file

@ -8,7 +8,7 @@ use Doctrine\ORM\QueryBuilder;
class BooleanConstraint extends AbstractConstraint
{
/** @var bool|null The value of our constraint */
protected $value;
protected ?bool $value;
public function __construct(string $property, string $identifier = null, ?bool $default_value = null)

View file

@ -11,12 +11,12 @@ class ChoiceConstraint extends AbstractConstraint
/**
* @var string[]|int[] The values to compare to
*/
protected $value;
protected array $value;
/**
* @var string The operator to use
*/
protected $operator;
protected string $operator;
/**
* @return string[]|int[]

View file

@ -18,17 +18,17 @@ class EntityConstraint extends AbstractConstraint
/**
* @var NodesListBuilder
*/
protected $nodesListBuilder;
protected ?NodesListBuilder $nodesListBuilder;
/**
* @var class-string<T> The class to use for the comparison
*/
protected $class;
protected string $class;
/**
* @var string|null The operator to use
*/
protected $operator;
protected ?string $operator;
/**
* @var T The value to compare to

View file

@ -8,7 +8,7 @@ use Doctrine\ORM\QueryBuilder;
trait FilterTrait
{
protected $useHaving = false;
protected bool $useHaving = false;
public function useHaving($value = true): self
{

View file

@ -14,12 +14,12 @@ class InstanceOfConstraint extends AbstractConstraint
/**
* @var string[] The values to compare to (fully qualified class names)
*/
protected $value;
protected array $value;
/**
* @var string The operator to use
*/
protected $operator;
protected string $operator;
/**
* @return string[]

View file

@ -26,7 +26,7 @@ class NumberConstraint extends AbstractConstraint
/**
* @var string The operator to use
*/
protected $operator;
protected ?string $operator;
/**
* @return float|int|null|\DateTimeInterface

View file

@ -11,22 +11,22 @@ use Svg\Tag\Text;
class ParameterConstraint extends AbstractConstraint
{
/** @var string */
protected $name;
protected string $name;
/** @var string */
protected $symbol;
protected string $symbol;
/** @var string */
protected $unit;
protected string $unit;
/** @var TextConstraint */
protected $value_text;
protected TextConstraint $value_text;
/** @var ParameterValueConstraint */
protected $value;
protected ParameterValueConstraint $value;
/** @var string The alias to use for the subquery */
protected $alias;
protected string $alias;
public function __construct()
{

View file

@ -7,7 +7,7 @@ use Doctrine\ORM\QueryBuilder;
class ParameterValueConstraint extends NumberConstraint
{
protected $alias;
protected string $alias;
public const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN',
//Additional operators

View file

@ -13,7 +13,7 @@ class TagsConstraint extends AbstractConstraint
/**
* @var string|null The operator to use
*/
protected $operator;
protected ?string $operator;
/**
* @var string The value to compare to

View file

@ -12,7 +12,7 @@ class TextConstraint extends AbstractConstraint
/**
* @var string|null The operator to use
*/
protected $operator;
protected ?string $operator;
/**
* @var string The value to compare to

View file

@ -15,26 +15,13 @@ class LogFilter implements FilterInterface
{
use CompoundFilterTrait;
/** @var DateTimeConstraint */
protected $timestamp;
/** @var IntConstraint */
protected $dbId;
/** @var ChoiceConstraint */
protected $level;
/** @var InstanceOfConstraint */
protected $eventType;
/** @var ChoiceConstraint */
protected $targetType;
/** @var IntConstraint */
protected $targetId;
/** @var EntityConstraint */
protected $user;
protected DateTimeConstraint $timestamp;
protected IntConstraint $dbId;
protected ChoiceConstraint $level;
protected InstanceOfConstraint $eventType;
protected ChoiceConstraint $targetType;
protected IntConstraint $targetId;
protected EntityConstraint $user;
public function __construct()
{

View file

@ -28,104 +28,40 @@ class PartFilter implements FilterInterface
use CompoundFilterTrait;
/** @var NumberConstraint */
protected $dbId;
/** @var TextConstraint */
protected $name;
/** @var TextConstraint */
protected $description;
/** @var TextConstraint */
protected $comment;
/** @var TagsConstraint */
protected $tags;
/** @var NumberConstraint */
protected $minAmount;
/** @var BooleanConstraint */
protected $favorite;
/** @var BooleanConstraint */
protected $needsReview;
/** @var NumberConstraint */
protected $mass;
/** @var DateTimeConstraint */
protected $lastModified;
/** @var DateTimeConstraint */
protected $addedDate;
/** @var EntityConstraint */
protected $category;
/** @var EntityConstraint */
protected $footprint;
/** @var EntityConstraint */
protected $manufacturer;
/** @var ChoiceConstraint */
protected $manufacturing_status;
/** @var EntityConstraint */
protected $supplier;
/** @var IntConstraint */
protected $orderdetailsCount;
/** @var BooleanConstraint */
protected $obsolete;
/** @var EntityConstraint */
protected $storelocation;
/** @var IntConstraint */
protected $lotCount;
/** @var NumberConstraint */
protected $amountSum;
/** @var BooleanConstraint */
protected $lotNeedsRefill;
/** @var TextConstraint */
protected $lotDescription;
/** @var BooleanConstraint */
protected $lotUnknownAmount;
/** @var DateTimeConstraint */
protected $lotExpirationDate;
/** @var EntityConstraint */
protected $measurementUnit;
/** @var TextConstraint */
protected $manufacturer_product_url;
/** @var TextConstraint */
protected $manufacturer_product_number;
/** @var IntConstraint */
protected $attachmentsCount;
/** @var EntityConstraint */
protected $attachmentType;
/** @var TextConstraint */
protected $attachmentName;
protected IntConstraint $dbId;
protected TextConstraint $name;
protected TextConstraint $description;
protected TextConstraint $comment;
protected TagsConstraint $tags;
protected NumberConstraint $minAmount;
protected BooleanConstraint $favorite;
protected BooleanConstraint $needsReview;
protected NumberConstraint $mass;
protected DateTimeConstraint $lastModified;
protected DateTimeConstraint $addedDate;
protected EntityConstraint $category;
protected EntityConstraint $footprint;
protected EntityConstraint $manufacturer;
protected ChoiceConstraint $manufacturing_status;
protected EntityConstraint $supplier;
protected IntConstraint $orderdetailsCount;
protected BooleanConstraint $obsolete;
protected EntityConstraint $storelocation;
protected IntConstraint $lotCount;
protected IntConstraint $amountSum;
protected BooleanConstraint $lotNeedsRefill;
protected TextConstraint $lotDescription;
protected BooleanConstraint $lotUnknownAmount;
protected DateTimeConstraint $lotExpirationDate;
protected EntityConstraint $measurementUnit;
protected TextConstraint $manufacturer_product_url;
protected TextConstraint $manufacturer_product_number;
protected IntConstraint $attachmentsCount;
protected EntityConstraint $attachmentType;
protected TextConstraint $attachmentName;
/** @var ArrayCollection<int, ParameterConstraint> */
protected $parameters;
/** @var IntConstraint */
protected $parametersCount;
protected ArrayCollection $parameters;
protected IntConstraint $parametersCount;
public function __construct(NodesListBuilder $nodesListBuilder)
{

View file

@ -9,43 +9,43 @@ class PartSearchFilter implements FilterInterface
{
/** @var string The string to query for */
protected $keyword;
protected string $keyword;
/** @var boolean Whether to use regex for searching */
protected $regex = false;
protected bool $regex = false;
/** @var bool Use name field for searching */
protected $name = true;
protected bool $name = true;
/** @var bool Use category name for searching */
protected $category = true;
protected bool $category = true;
/** @var bool Use description for searching */
protected $description = true;
protected bool $description = true;
/** @var bool Use tags for searching */
protected $tags = true;
protected bool $tags = true;
/** @var bool Use storelocation name for searching */
protected $storelocation = true;
protected bool $storelocation = true;
/** @var bool Use comment field for searching */
protected $comment = true;
protected bool $comment = true;
/** @var bool Use ordernr for searching */
protected $ordernr = true;
protected bool $ordernr = true;
/** @var bool Use manufacturer product name for searching */
protected $mpn = true;
protected bool $mpn = true;
/** @var bool Use supplier name for searching */
protected $supplier = false;
protected bool $supplier = false;
/** @var bool Use manufacturer name for searching */
protected $manufacturer = false;
protected bool $manufacturer = false;
/** @var bool Use footprint name for searching */
protected $footprint = false;
protected bool $footprint = false;
public function __construct(string $query)
{

View file

@ -59,6 +59,7 @@ use App\Entity\LogSystem\ElementEditedLogEntry;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
use App\Exceptions\EntityNotSupportedException;
use App\Repository\LogEntryRepository;
use App\Services\ElementTypeNameGenerator;
use App\Services\EntityURLGenerator;
use Doctrine\ORM\EntityManagerInterface;
@ -77,12 +78,12 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class LogDataTable implements DataTableTypeInterface
{
protected $elementTypeNameGenerator;
protected $translator;
protected $urlGenerator;
protected $entityURLGenerator;
protected $logRepo;
protected $security;
protected ElementTypeNameGenerator $elementTypeNameGenerator;
protected TranslatorInterface $translator;
protected UrlGeneratorInterface $urlGenerator;
protected EntityURLGenerator $entityURLGenerator;
protected LogEntryRepository $logRepo;
protected Security $security;
public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, TranslatorInterface $translator,
UrlGeneratorInterface $urlGenerator, EntityURLGenerator $entityURLGenerator, EntityManagerInterface $entityManager, Security $security)

View file

@ -79,12 +79,12 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final class PartsDataTable implements DataTableTypeInterface
{
private $translator;
private $treeBuilder;
private $amountFormatter;
private $previewGenerator;
private $attachmentURLGenerator;
private $security;
private TranslatorInterface $translator;
private NodesListBuilder $treeBuilder;
private AmountFormatter $amountFormatter;
private PartPreviewGenerator $previewGenerator;
private AttachmentURLGenerator $attachmentURLGenerator;
private Security $security;
/**
* @var EntityURLGenerator