From 15a31433e1941fa000931371861e70a73522b5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Fri, 4 Mar 2022 13:22:40 +0100 Subject: [PATCH] Fixed PHPstan warnings. --- phpstan.neon | 3 ++- src/Entity/Attachments/Attachment.php | 11 ----------- src/Entity/Devices/Device.php | 1 + src/Entity/Parts/Category.php | 1 + src/Entity/Parts/Footprint.php | 1 + src/Entity/Parts/Manufacturer.php | 1 + src/Entity/Parts/MeasurementUnit.php | 1 + src/Entity/Parts/Storelocation.php | 1 + src/Entity/UserSystem/Group.php | 1 + 9 files changed, 9 insertions(+), 12 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 4a3b777a..e0e0e662 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -7,4 +7,5 @@ parameters: excludes_analyse: - src/DataTables/Adapter/* - - src/Configuration/* \ No newline at end of file + - src/Configuration/* + - src/Doctrine/Purger/* \ No newline at end of file diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index 62335f2c..5da7e227 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -178,10 +178,6 @@ abstract class Attachment extends AbstractNamedDBElement //After the %PLACEHOLDER% comes a slash, so we can check if we have a placeholder via explode $tmp = explode('/', $this->path); - if (empty($tmp)) { - return true; - } - return !in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), false); } @@ -196,10 +192,6 @@ abstract class Attachment extends AbstractNamedDBElement //After the %PLACEHOLDER% comes a slash, so we can check if we have a placeholder via explode $tmp = explode('/', $this->path); - if (empty($tmp)) { - return false; - } - return '%SECURE%' === $tmp[0]; } @@ -437,9 +429,6 @@ abstract class Attachment extends AbstractNamedDBElement //After the %PLACEHOLDER% comes a slash, so we can check if we have a placeholder via explode $tmp = explode('/', $path); //Builtins must have a %PLACEHOLDER% construction - if (empty($tmp)) { - return false; - } return in_array($tmp[0], static::BUILTIN_PLACEHOLDER, false); } diff --git a/src/Entity/Devices/Device.php b/src/Entity/Devices/Device.php index e6ce5e8a..a6bf20ec 100644 --- a/src/Entity/Devices/Device.php +++ b/src/Entity/Devices/Device.php @@ -68,6 +68,7 @@ class Device extends AbstractPartsContainingDBElement /** * @ORM\OneToMany(targetEntity="Device", mappedBy="parent") * @ORM\OrderBy({"name" = "ASC"}) + * @var Collection */ protected $children; diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php index 0c344d38..4be541bb 100644 --- a/src/Entity/Parts/Category.php +++ b/src/Entity/Parts/Category.php @@ -40,6 +40,7 @@ class Category extends AbstractPartsContainingDBElement /** * @ORM\OneToMany(targetEntity="Category", mappedBy="parent") * @ORM\OrderBy({"name" = "ASC"}) + * @var Collection */ protected $children; diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php index 7dc48bc3..0e4b477a 100644 --- a/src/Entity/Parts/Footprint.php +++ b/src/Entity/Parts/Footprint.php @@ -74,6 +74,7 @@ class Footprint extends AbstractPartsContainingDBElement /** * @ORM\OneToMany(targetEntity="Footprint", mappedBy="parent") * @ORM\OrderBy({"name" = "ASC"}) + * @var Collection */ protected $children; diff --git a/src/Entity/Parts/Manufacturer.php b/src/Entity/Parts/Manufacturer.php index 90a14999..c048f346 100644 --- a/src/Entity/Parts/Manufacturer.php +++ b/src/Entity/Parts/Manufacturer.php @@ -74,6 +74,7 @@ class Manufacturer extends AbstractCompany /** * @ORM\OneToMany(targetEntity="Manufacturer", mappedBy="parent") * @ORM\OrderBy({"name" = "ASC"}) + * @var Collection */ protected $children; diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php index 35df15d1..f848f7a0 100644 --- a/src/Entity/Parts/MeasurementUnit.php +++ b/src/Entity/Parts/MeasurementUnit.php @@ -85,6 +85,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement /** * @ORM\OneToMany(targetEntity="MeasurementUnit", mappedBy="parent", cascade={"persist"}) * @ORM\OrderBy({"name" = "ASC"}) + * @var Collection */ protected $children; diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php index 3cfcbfda..2440b03d 100644 --- a/src/Entity/Parts/Storelocation.php +++ b/src/Entity/Parts/Storelocation.php @@ -68,6 +68,7 @@ class Storelocation extends AbstractPartsContainingDBElement /** * @ORM\OneToMany(targetEntity="Storelocation", mappedBy="parent") * @ORM\OrderBy({"name" = "ASC"}) + * @var Collection */ protected $children; diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php index 1b65ce96..c039c6c8 100644 --- a/src/Entity/UserSystem/Group.php +++ b/src/Entity/UserSystem/Group.php @@ -63,6 +63,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa /** * @ORM\OneToMany(targetEntity="Group", mappedBy="parent") * @ORM\OrderBy({"name" = "ASC"}) + * @var Collection */ protected $children;