Fixed some more inspection issues

This commit is contained in:
Jan Böhmer 2023-04-15 22:05:29 +02:00
parent de96aae9a5
commit 29d1d49aca
83 changed files with 153 additions and 172 deletions

View file

@ -51,7 +51,7 @@ class AttachmentType extends AbstractStructuralDBElement
* @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
protected ?AbstractStructuralDBElement $parent;
/**
* @var string

View file

@ -94,7 +94,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
* @NoneOfItsChildren()
* @Groups({"include_parents", "import"})
*/
protected $parent = null;
protected ?AbstractStructuralDBElement $parent = null;
/** @var string[] all names of all parent elements as a array of strings,
* the last array element is the name of the element itself
@ -155,10 +155,8 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
if ($this->getParent() === $another_element) {
return true;
}
} else { //If the IDs are defined, we can compare the IDs
if ($this->getParent()->getID() === $another_element->getID()) {
return true;
}
} elseif ($this->getParent()->getID() === $another_element->getID()) {
return true;
}
//Otherwise, check recursively

View file

@ -183,7 +183,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
/** @var array The extra data in raw (short form) saved in the DB
* @ORM\Column(name="extra", type="json")
*/
protected $extra = [];
protected array $extra = [];
public function __construct()
{

View file

@ -143,7 +143,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
*
* @var AbstractDBElement|null the element to which this parameter belongs to
*/
protected $element;
protected ?AbstractDBElement $element;
public function __construct()
{

View file

@ -57,5 +57,5 @@ class AttachmentTypeParameter extends AbstractParameter
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?\App\Entity\Base\AbstractDBElement $element;
}

View file

@ -57,5 +57,5 @@ class CategoryParameter extends AbstractParameter
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?\App\Entity\Base\AbstractDBElement $element;
}

View file

@ -60,5 +60,5 @@ class CurrencyParameter extends AbstractParameter
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?\App\Entity\Base\AbstractDBElement $element;
}

View file

@ -58,5 +58,5 @@ class FootprintParameter extends AbstractParameter
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?\App\Entity\Base\AbstractDBElement $element;
}

View file

@ -58,5 +58,5 @@ class GroupParameter extends AbstractParameter
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?\App\Entity\Base\AbstractDBElement $element;
}

View file

@ -58,5 +58,5 @@ class ManufacturerParameter extends AbstractParameter
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?\App\Entity\Base\AbstractDBElement $element;
}

View file

@ -58,5 +58,5 @@ class MeasurementUnitParameter extends AbstractParameter
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?\App\Entity\Base\AbstractDBElement $element;
}

View file

@ -52,7 +52,7 @@ trait ParametersTrait
* @var Collection<int, AbstractParameter>
* @Assert\Valid()
*/
protected $parameters;
protected Collection $parameters;
/**
* Return all associated specifications.

View file

@ -58,5 +58,5 @@ class PartParameter extends AbstractParameter
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?\App\Entity\Base\AbstractDBElement $element;
}

View file

@ -58,5 +58,5 @@ class ProjectParameter extends AbstractParameter
* @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?\App\Entity\Base\AbstractDBElement $element;
}

View file

@ -58,5 +58,5 @@ class StorelocationParameter extends AbstractParameter
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?\App\Entity\Base\AbstractDBElement $element;
}

View file

@ -58,5 +58,5 @@ class SupplierParameter extends AbstractParameter
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected $element;
protected ?\App\Entity\Base\AbstractDBElement $element;
}

View file

@ -52,7 +52,7 @@ class Category extends AbstractPartsContainingDBElement
* @ORM\ManyToOne(targetEntity="Category", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
/**
* @var string

View file

@ -44,7 +44,7 @@ class Footprint extends AbstractPartsContainingDBElement
* @ORM\ManyToOne(targetEntity="Footprint", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
/**
* @ORM\OneToMany(targetEntity="Footprint", mappedBy="parent")

View file

@ -44,7 +44,7 @@ class Manufacturer extends AbstractCompany
* @ORM\ManyToOne(targetEntity="Manufacturer", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
/**
* @ORM\OneToMany(targetEntity="Manufacturer", mappedBy="parent")

View file

@ -81,7 +81,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
* @ORM\ManyToOne(targetEntity="MeasurementUnit", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
/**
* @var Collection<int, MeasurementUnitAttachment>

View file

@ -53,7 +53,7 @@ class Storelocation extends AbstractPartsContainingDBElement
* @ORM\ManyToOne(targetEntity="Storelocation", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
/**
* @var MeasurementUnit|null The measurement unit, which parts can be stored in here

View file

@ -56,7 +56,7 @@ class Supplier extends AbstractCompany
* @ORM\ManyToOne(targetEntity="Supplier", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
/**
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="supplier")

View file

@ -75,7 +75,7 @@ class Currency extends AbstractStructuralDBElement
* @ORM\ManyToOne(targetEntity="Currency", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
protected ?AbstractStructuralDBElement $parent;
/**
* @var Collection<int, CurrencyAttachment>

View file

@ -57,7 +57,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
* @ORM\OrderBy({"min_discount_quantity" = "ASC"})
* @Groups({"extended", "full", "import"})
*/
protected $pricedetails;
protected Collection $pricedetails;
/**
* @var string

View file

@ -53,14 +53,14 @@ class Project extends AbstractStructuralDBElement
* @ORM\ManyToOne(targetEntity="Project", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
protected ?AbstractStructuralDBElement $parent;
/**
* @ORM\OneToMany(targetEntity="ProjectBOMEntry", mappedBy="project", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
* @Groups({"extended", "full"})
*/
protected $bom_entries;
protected Collection $bom_entries;
/**
* @ORM\Column(type="integer")

View file

@ -55,7 +55,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
* @ORM\ManyToOne(targetEntity="Group", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
protected ?AbstractStructuralDBElement $parent;
/**
* @ORM\OneToMany(targetEntity="User", mappedBy="group")
@ -68,7 +68,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
* @ORM\Column(type="boolean", name="enforce_2fa")
* @Groups({"extended", "full", "import"})
*/
protected $enforce2FA = false;
protected bool $enforce2FA = false;
/**
* @var Collection<int, GroupAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\GroupAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)

View file

@ -216,7 +216,7 @@ final class PermissionData implements \JsonSerializable
continue;
}
$ret[$permission] = array_filter($operations, function ($value) {
$ret[$permission] = array_filter($operations, static function ($value) {
return $value !== null;
});

View file

@ -255,10 +255,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* @Selectable()
* @Groups({"extended", "full", "import"})
*/
protected $currency;
protected ?Currency $currency;
/**
* @var PermissionData
* @var PermissionData|null
* @ValidPermission()
* @ORM\Embedded(class="PermissionData", columnPrefix="permissions_")
* @Groups({"simple", "extended", "full", "import"})
@ -266,10 +266,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
protected ?PermissionData $permissions = null;
/**
* @var DateTime the time until the password reset token is valid
* @var DateTime|null the time until the password reset token is valid
* @ORM\Column(type="datetime", nullable=true, options={"default": null})
*/
protected $pw_reset_expires;
protected ?DateTime $pw_reset_expires;
/**
* @var bool True if the user was created by a SAML provider (and therefore cannot change its password)