Fixed some PHPStan level 5 issues

This commit is contained in:
Jan Böhmer 2023-06-13 20:24:54 +02:00
parent 74051c5649
commit 19530a9102
35 changed files with 95 additions and 63 deletions

View file

@ -45,11 +45,11 @@ use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Index(name: 'category_idx_parent_name', columns: ['parent_id', 'name'])]
class Category extends AbstractPartsContainingDBElement
{
#[ORM\OneToMany(targetEntity: 'Category', mappedBy: 'parent')]
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $children;
#[ORM\ManyToOne(targetEntity: 'Category', inversedBy: 'children')]
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id')]
protected ?AbstractStructuralDBElement $parent = null;

View file

@ -43,11 +43,11 @@ use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Index(name: 'footprint_idx_parent_name', columns: ['parent_id', 'name'])]
class Footprint extends AbstractPartsContainingDBElement
{
#[ORM\ManyToOne(targetEntity: 'Footprint', inversedBy: 'children')]
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id')]
protected ?AbstractStructuralDBElement $parent = null;
#[ORM\OneToMany(targetEntity: 'Footprint', mappedBy: 'parent')]
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $children;

View file

@ -43,11 +43,11 @@ use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Index(name: 'manufacturer_idx_parent_name', columns: ['parent_id', 'name'])]
class Manufacturer extends AbstractCompany
{
#[ORM\ManyToOne(targetEntity: 'Manufacturer', inversedBy: 'children')]
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id')]
protected ?AbstractStructuralDBElement $parent = null;
#[ORM\OneToMany(targetEntity: 'Manufacturer', mappedBy: 'parent')]
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $children;

View file

@ -74,11 +74,11 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
#[ORM\Column(type: Types::BOOLEAN, name: 'use_si_prefix')]
protected bool $use_si_prefix = false;
#[ORM\OneToMany(targetEntity: 'MeasurementUnit', mappedBy: 'parent', cascade: ['persist'])]
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent', cascade: ['persist'])]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $children;
#[ORM\ManyToOne(targetEntity: 'MeasurementUnit', inversedBy: 'children')]
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id')]
protected ?AbstractStructuralDBElement $parent = null;

View file

@ -79,7 +79,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* @var Storelocation|null The storelocation of this lot
*/
#[Groups(['simple', 'extended', 'full', 'import'])]
#[ORM\ManyToOne(targetEntity: 'Storelocation')]
#[ORM\ManyToOne(targetEntity: Storelocation::class)]
#[ORM\JoinColumn(name: 'id_store_location')]
#[Selectable()]
protected ?Storelocation $storage_location = null;
@ -110,7 +110,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
* @var Part The part that is stored in this lot
*/
#[Assert\NotNull]
#[ORM\ManyToOne(targetEntity: 'Part', inversedBy: 'partLots')]
#[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'partLots')]
#[ORM\JoinColumn(name: 'id_part', nullable: false, onDelete: 'CASCADE')]
protected Part $part;

View file

@ -66,7 +66,7 @@ trait BasicPropertyTrait
#[Assert\NotNull(message: 'validator.select_valid_category')]
#[Selectable()]
#[Groups(['simple', 'extended', 'full', 'import'])]
#[ORM\ManyToOne(targetEntity: 'Category')]
#[ORM\ManyToOne(targetEntity: Category::class)]
#[ORM\JoinColumn(name: 'id_category', nullable: false)]
protected ?Category $category = null;
@ -74,7 +74,7 @@ trait BasicPropertyTrait
* @var Footprint|null The footprint of this part (e.g. DIP8)
*/
#[Groups(['simple', 'extended', 'full', 'import'])]
#[ORM\ManyToOne(targetEntity: 'Footprint')]
#[ORM\ManyToOne(targetEntity: Footprint::class)]
#[ORM\JoinColumn(name: 'id_footprint')]
#[Selectable()]
protected ?Footprint $footprint = null;

View file

@ -40,7 +40,7 @@ trait InstockTrait
*/
#[Assert\Valid]
#[Groups(['extended', 'full', 'import'])]
#[ORM\OneToMany(targetEntity: 'PartLot', mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OneToMany(targetEntity: PartLot::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['amount' => 'DESC'])]
protected Collection $partLots;
@ -57,7 +57,7 @@ trait InstockTrait
* @var ?MeasurementUnit the unit in which the part's amount is measured
*/
#[Groups(['extended', 'full', 'import'])]
#[ORM\ManyToOne(targetEntity: 'MeasurementUnit')]
#[ORM\ManyToOne(targetEntity: MeasurementUnit::class)]
#[ORM\JoinColumn(name: 'id_part_unit')]
protected ?MeasurementUnit $partUnit = null;

View file

@ -39,7 +39,7 @@ trait ManufacturerTrait
* @var Manufacturer|null The manufacturer of this part
*/
#[Groups(['simple', 'extended', 'full', 'import'])]
#[ORM\ManyToOne(targetEntity: 'Manufacturer')]
#[ORM\ManyToOne(targetEntity: Manufacturer::class)]
#[ORM\JoinColumn(name: 'id_manufacturer')]
#[Selectable()]
protected ?Manufacturer $manufacturer = null;

View file

@ -98,7 +98,7 @@ trait OrderTrait
*
* @param bool $hide_obsolete If true, obsolete orderdetails will NOT be returned
*
* @return Collection|Orderdetail[] * all orderdetails as a one-dimensional array of Orderdetails objects
* @return Collection<int, Orderdetail> * all orderdetails as a one-dimensional array of Orderdetails objects
* (empty array if there are no ones)
* * the array is sorted by the suppliers names / minimum order quantity
*/

View file

@ -45,18 +45,18 @@ use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Index(name: 'location_idx_parent_name', columns: ['parent_id', 'name'])]
class Storelocation extends AbstractPartsContainingDBElement
{
#[ORM\OneToMany(targetEntity: 'Storelocation', mappedBy: 'parent')]
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $children;
#[ORM\ManyToOne(targetEntity: 'Storelocation', inversedBy: 'children')]
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id')]
protected ?AbstractStructuralDBElement $parent = null;
/**
* @var MeasurementUnit|null The measurement unit, which parts can be stored in here
*/
#[ORM\ManyToOne(targetEntity: 'MeasurementUnit')]
#[ORM\ManyToOne(targetEntity: MeasurementUnit::class)]
#[ORM\JoinColumn(name: 'storage_type_id')]
protected ?MeasurementUnit $storage_type = null;

View file

@ -49,11 +49,11 @@ use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Index(name: 'supplier_idx_parent_name', columns: ['parent_id', 'name'])]
class Supplier extends AbstractCompany
{
#[ORM\OneToMany(targetEntity: 'Supplier', mappedBy: 'parent')]
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $children;
#[ORM\ManyToOne(targetEntity: 'Supplier', inversedBy: 'children')]
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id')]
protected ?AbstractStructuralDBElement $parent = null;