diff --git a/src/Command/User/UpgradePermissionsSchemaCommand.php b/src/Command/User/UpgradePermissionsSchemaCommand.php index ae5adfff..77ccb70f 100644 --- a/src/Command/User/UpgradePermissionsSchemaCommand.php +++ b/src/Command/User/UpgradePermissionsSchemaCommand.php @@ -91,12 +91,12 @@ final class UpgradePermissionsSchemaCommand extends Command //List all users and groups that need an update $io->section('Groups that need an update:'); - $io->listing(array_map(function (Group $group) { + $io->listing(array_map(static function (Group $group) { return $group->getName() . ' (ID: '. $group->getID() .', Current version: ' . $group->getPermissions()->getSchemaVersion() . ')'; }, $groups_to_upgrade)); $io->section('Users that need an update:'); - $io->listing(array_map(function (User $user) { + $io->listing(array_map(static function (User $user) { return $user->getUsername() . ' (ID: '. $user->getID() .', Current version: ' . $user->getPermissions()->getSchemaVersion() . ')'; }, $users_to_upgrade)); diff --git a/src/Command/User/UserEnableCommand.php b/src/Command/User/UserEnableCommand.php index 39878a91..2b913e26 100644 --- a/src/Command/User/UserEnableCommand.php +++ b/src/Command/User/UserEnableCommand.php @@ -87,7 +87,7 @@ class UserEnableCommand extends Command $io->note('The following users will be enabled:'); } $io->table(['Username', 'Enabled/Disabled'], - array_map(function(User $user) { + array_map(static function(User $user) { return [$user->getFullName(true), $user->isDisabled() ? 'Disabled' : 'Enabled']; }, $users)); diff --git a/src/Controller/GroupController.php b/src/Controller/GroupController.php index 1eb10d76..5aa8a371 100644 --- a/src/Controller/GroupController.php +++ b/src/Controller/GroupController.php @@ -74,9 +74,9 @@ class GroupController extends BaseAdminController //We need to stop the execution here, or our permissions changes will be overwritten by the form values return $this->redirectToRoute('group_edit', ['id' => $entity->getID()]); - } else { - $this->addFlash('danger', 'csfr_invalid'); } + + $this->addFlash('danger', 'csfr_invalid'); } return $this->_edit($entity, $request, $em, $timestamp); diff --git a/src/Controller/LogController.php b/src/Controller/LogController.php index de5d3c17..3c28fa99 100644 --- a/src/Controller/LogController.php +++ b/src/Controller/LogController.php @@ -52,7 +52,7 @@ class LogController extends AbstractController { protected EntityManagerInterface $entityManager; protected TimeTravel $timeTravel; - protected DBElementRepository $dbRepository; + protected EntityRepository $dbRepository; public function __construct(EntityManagerInterface $entityManager, TimeTravel $timeTravel) { diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index 5f4390ae..7ab192c5 100644 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -114,9 +114,9 @@ class ProjectController extends AbstractController $request->get('_redirect', $this->generateUrl('project_info', ['id' => $project->getID()] ))); - } else { - $this->addFlash('error', 'project.build.flash.invalid_input'); } + + $this->addFlash('error', 'project.build.flash.invalid_input'); } return $this->renderForm('projects/build/build.html.twig', [ diff --git a/src/Controller/SelectAPIController.php b/src/Controller/SelectAPIController.php index 1b7784e4..49689416 100644 --- a/src/Controller/SelectAPIController.php +++ b/src/Controller/SelectAPIController.php @@ -106,7 +106,7 @@ class SelectAPIController extends AbstractController 3 => $this->translator->trans('export.level.full'), ]; - return $this->json(array_map(function ($key, $value) { + return $this->json(array_map(static function ($key, $value) { return [ 'text' => $value, 'value' => $key, @@ -198,7 +198,7 @@ class SelectAPIController extends AbstractController ]); //Remove the data-* prefix for each key $data = array_combine( - array_map(function ($key) { + array_map(static function ($key) { if (strpos($key, 'data-') === 0) { return substr($key, 5); } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 9949b8c7..0850e6a9 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -129,9 +129,9 @@ class UserController extends AdminPages\BaseAdminController //We need to stop the execution here, or our permissions changes will be overwritten by the form values return $this->redirectToRoute('user_edit', ['id' => $entity->getID()]); - } else { - $this->addFlash('danger', 'csfr_invalid'); } + + $this->addFlash('danger', 'csfr_invalid'); } return $this->_edit($entity, $request, $em, $timestamp); diff --git a/src/DataTables/Column/LocaleDateTimeColumn.php b/src/DataTables/Column/LocaleDateTimeColumn.php index 3904a4cd..76515a25 100644 --- a/src/DataTables/Column/LocaleDateTimeColumn.php +++ b/src/DataTables/Column/LocaleDateTimeColumn.php @@ -45,7 +45,9 @@ class LocaleDateTimeColumn extends AbstractColumn { if (null === $value) { return $this->options['nullValue']; - } elseif (!$value instanceof DateTimeInterface) { + } + + if (!$value instanceof DateTimeInterface) { $value = new DateTime((string) $value); } diff --git a/src/DataTables/Filters/Constraints/FilterTrait.php b/src/DataTables/Filters/Constraints/FilterTrait.php index 988890ba..394f761a 100644 --- a/src/DataTables/Filters/Constraints/FilterTrait.php +++ b/src/DataTables/Filters/Constraints/FilterTrait.php @@ -51,7 +51,7 @@ trait FilterTrait protected function generateParameterIdentifier(string $property): string { //Replace all special characters with underscores - $property = preg_replace('/[^a-zA-Z0-9_]/', '_', $property); + $property = preg_replace('/\W/', '_', $property); //Add a random number to the end of the property name for uniqueness return $property . '_' . uniqid("", false); } diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php index 011c4a8e..c96948b3 100644 --- a/src/DataTables/PartsDataTable.php +++ b/src/DataTables/PartsDataTable.php @@ -63,27 +63,19 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PartsDataTable implements DataTableTypeInterface { private TranslatorInterface $translator; - private NodesListBuilder $treeBuilder; private AmountFormatter $amountFormatter; - private AttachmentURLGenerator $attachmentURLGenerator; private Security $security; private PartDataTableHelper $partDataTableHelper; - /** - * @var EntityURLGenerator - */ - private $urlGenerator; + private EntityURLGenerator $urlGenerator; public function __construct(EntityURLGenerator $urlGenerator, TranslatorInterface $translator, - NodesListBuilder $treeBuilder, AmountFormatter $amountFormatter,PartDataTableHelper $partDataTableHelper, - AttachmentURLGenerator $attachmentURLGenerator, Security $security) + AmountFormatter $amountFormatter,PartDataTableHelper $partDataTableHelper, Security $security) { $this->urlGenerator = $urlGenerator; $this->translator = $translator; - $this->treeBuilder = $treeBuilder; $this->amountFormatter = $amountFormatter; - $this->attachmentURLGenerator = $attachmentURLGenerator; $this->security = $security; $this->partDataTableHelper = $partDataTableHelper; } diff --git a/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php b/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php index 811facf6..1f7c04e7 100644 --- a/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php +++ b/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php @@ -53,21 +53,21 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface public const PURGE_MODE_TRUNCATE = 2; /** @var EntityManagerInterface|null */ - private $em; + private ?EntityManagerInterface $em; /** * If the purge should be done through DELETE or TRUNCATE statements * * @var int */ - private $purgeMode = self::PURGE_MODE_DELETE; + private int $purgeMode = self::PURGE_MODE_DELETE; /** * Table/view names to be excluded from purge * * @var string[] */ - private $excluded; + private array $excluded; /** * Construct new purger instance. diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php index ad7a0e61..33ed8b18 100644 --- a/src/Entity/Attachments/AttachmentType.php +++ b/src/Entity/Attachments/AttachmentType.php @@ -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 diff --git a/src/Entity/Base/AbstractStructuralDBElement.php b/src/Entity/Base/AbstractStructuralDBElement.php index 629669e9..eec1a73e 100644 --- a/src/Entity/Base/AbstractStructuralDBElement.php +++ b/src/Entity/Base/AbstractStructuralDBElement.php @@ -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 diff --git a/src/Entity/LogSystem/AbstractLogEntry.php b/src/Entity/LogSystem/AbstractLogEntry.php index 8055a383..2c7c7e40 100644 --- a/src/Entity/LogSystem/AbstractLogEntry.php +++ b/src/Entity/LogSystem/AbstractLogEntry.php @@ -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() { diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index 01aca08a..08e4d7b7 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -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() { diff --git a/src/Entity/Parameters/AttachmentTypeParameter.php b/src/Entity/Parameters/AttachmentTypeParameter.php index aa39a9a6..89fdbbc3 100644 --- a/src/Entity/Parameters/AttachmentTypeParameter.php +++ b/src/Entity/Parameters/AttachmentTypeParameter.php @@ -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; } diff --git a/src/Entity/Parameters/CategoryParameter.php b/src/Entity/Parameters/CategoryParameter.php index f2ce3807..f5989823 100644 --- a/src/Entity/Parameters/CategoryParameter.php +++ b/src/Entity/Parameters/CategoryParameter.php @@ -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; } diff --git a/src/Entity/Parameters/CurrencyParameter.php b/src/Entity/Parameters/CurrencyParameter.php index c5fa1e2a..4afdedbe 100644 --- a/src/Entity/Parameters/CurrencyParameter.php +++ b/src/Entity/Parameters/CurrencyParameter.php @@ -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; } diff --git a/src/Entity/Parameters/FootprintParameter.php b/src/Entity/Parameters/FootprintParameter.php index 9c682720..aa6f803c 100644 --- a/src/Entity/Parameters/FootprintParameter.php +++ b/src/Entity/Parameters/FootprintParameter.php @@ -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; } diff --git a/src/Entity/Parameters/GroupParameter.php b/src/Entity/Parameters/GroupParameter.php index aa15edb8..0d22ae62 100644 --- a/src/Entity/Parameters/GroupParameter.php +++ b/src/Entity/Parameters/GroupParameter.php @@ -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; } diff --git a/src/Entity/Parameters/ManufacturerParameter.php b/src/Entity/Parameters/ManufacturerParameter.php index 1f01ce4d..547e3b80 100644 --- a/src/Entity/Parameters/ManufacturerParameter.php +++ b/src/Entity/Parameters/ManufacturerParameter.php @@ -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; } diff --git a/src/Entity/Parameters/MeasurementUnitParameter.php b/src/Entity/Parameters/MeasurementUnitParameter.php index 7ca4b1c5..c95f8844 100644 --- a/src/Entity/Parameters/MeasurementUnitParameter.php +++ b/src/Entity/Parameters/MeasurementUnitParameter.php @@ -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; } diff --git a/src/Entity/Parameters/ParametersTrait.php b/src/Entity/Parameters/ParametersTrait.php index c7ccbddf..f8ac8e78 100644 --- a/src/Entity/Parameters/ParametersTrait.php +++ b/src/Entity/Parameters/ParametersTrait.php @@ -52,7 +52,7 @@ trait ParametersTrait * @var Collection * @Assert\Valid() */ - protected $parameters; + protected Collection $parameters; /** * Return all associated specifications. diff --git a/src/Entity/Parameters/PartParameter.php b/src/Entity/Parameters/PartParameter.php index 45c566d9..b5d0fbaa 100644 --- a/src/Entity/Parameters/PartParameter.php +++ b/src/Entity/Parameters/PartParameter.php @@ -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; } diff --git a/src/Entity/Parameters/ProjectParameter.php b/src/Entity/Parameters/ProjectParameter.php index 2961a843..b4269e9c 100644 --- a/src/Entity/Parameters/ProjectParameter.php +++ b/src/Entity/Parameters/ProjectParameter.php @@ -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; } diff --git a/src/Entity/Parameters/StorelocationParameter.php b/src/Entity/Parameters/StorelocationParameter.php index 2a7aa202..b236ad1c 100644 --- a/src/Entity/Parameters/StorelocationParameter.php +++ b/src/Entity/Parameters/StorelocationParameter.php @@ -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; } diff --git a/src/Entity/Parameters/SupplierParameter.php b/src/Entity/Parameters/SupplierParameter.php index a40e3e92..534cc949 100644 --- a/src/Entity/Parameters/SupplierParameter.php +++ b/src/Entity/Parameters/SupplierParameter.php @@ -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; } diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php index 8bcf32d2..7dd37c0f 100644 --- a/src/Entity/Parts/Category.php +++ b/src/Entity/Parts/Category.php @@ -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 diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php index cac63fe2..079d1168 100644 --- a/src/Entity/Parts/Footprint.php +++ b/src/Entity/Parts/Footprint.php @@ -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") diff --git a/src/Entity/Parts/Manufacturer.php b/src/Entity/Parts/Manufacturer.php index 45e4d140..17ab8543 100644 --- a/src/Entity/Parts/Manufacturer.php +++ b/src/Entity/Parts/Manufacturer.php @@ -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") diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php index 5ff9cef4..7ebdfc85 100644 --- a/src/Entity/Parts/MeasurementUnit.php +++ b/src/Entity/Parts/MeasurementUnit.php @@ -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 diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php index e7a7dfb7..58e2f2e8 100644 --- a/src/Entity/Parts/Storelocation.php +++ b/src/Entity/Parts/Storelocation.php @@ -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 diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php index ae1e4ca1..e6068115 100644 --- a/src/Entity/Parts/Supplier.php +++ b/src/Entity/Parts/Supplier.php @@ -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") diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php index f2c44504..4f6e0923 100644 --- a/src/Entity/PriceInformations/Currency.php +++ b/src/Entity/PriceInformations/Currency.php @@ -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 diff --git a/src/Entity/PriceInformations/Orderdetail.php b/src/Entity/PriceInformations/Orderdetail.php index 60f43ee9..c1d182a2 100644 --- a/src/Entity/PriceInformations/Orderdetail.php +++ b/src/Entity/PriceInformations/Orderdetail.php @@ -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 diff --git a/src/Entity/ProjectSystem/Project.php b/src/Entity/ProjectSystem/Project.php index 8c8192f8..ab0f2739 100644 --- a/src/Entity/ProjectSystem/Project.php +++ b/src/Entity/ProjectSystem/Project.php @@ -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") diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php index 30bec19c..e07d6fad 100644 --- a/src/Entity/UserSystem/Group.php +++ b/src/Entity/UserSystem/Group.php @@ -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 * @ORM\OneToMany(targetEntity="App\Entity\Attachments\GroupAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) diff --git a/src/Entity/UserSystem/PermissionData.php b/src/Entity/UserSystem/PermissionData.php index 2c84c6e3..90fe3289 100644 --- a/src/Entity/UserSystem/PermissionData.php +++ b/src/Entity/UserSystem/PermissionData.php @@ -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; }); diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index 1850d9f7..77182159 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -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) diff --git a/src/Form/AdminPages/BaseEntityAdminForm.php b/src/Form/AdminPages/BaseEntityAdminForm.php index 1a95a119..31dd39f0 100644 --- a/src/Form/AdminPages/BaseEntityAdminForm.php +++ b/src/Form/AdminPages/BaseEntityAdminForm.php @@ -25,14 +25,12 @@ namespace App\Form\AdminPages; use App\Entity\Base\AbstractNamedDBElement; use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\LabelSystem\LabelProfile; -use App\Entity\Parameters\AbstractParameter; use App\Form\AttachmentFormType; use App\Form\ParameterType; use App\Form\Type\MasterPictureAttachmentType; use App\Form\Type\RichTextEditorType; use App\Form\Type\StructuralEntityType; use App\Services\LogSystem\EventCommentNeededHelper; -use FOS\CKEditorBundle\Form\Type\CKEditorType; use function get_class; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index 6f33fde0..23069dd3 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -27,7 +27,6 @@ use App\Entity\Attachments\AttachmentType; use App\Form\Type\StructuralEntityType; use App\Services\Attachments\AttachmentManager; use App\Services\Attachments\AttachmentSubmitHandler; -use App\Validator\Constraints\AllowedFileExtension; use App\Validator\Constraints\UrlOrBuiltin; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; diff --git a/src/Form/Part/OrderdetailType.php b/src/Form/Part/OrderdetailType.php index 8489bc73..ece78af5 100644 --- a/src/Form/Part/OrderdetailType.php +++ b/src/Form/Part/OrderdetailType.php @@ -27,7 +27,6 @@ use App\Entity\Parts\Supplier; use App\Entity\PriceInformations\Orderdetail; use App\Entity\PriceInformations\Pricedetail; use App\Form\Type\StructuralEntityType; -use App\Form\WorkaroundCollectionType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; diff --git a/src/Form/Part/PartBaseType.php b/src/Form/Part/PartBaseType.php index ef9bd60c..141b5eca 100644 --- a/src/Form/Part/PartBaseType.php +++ b/src/Form/Part/PartBaseType.php @@ -36,7 +36,6 @@ use App\Form\Type\MasterPictureAttachmentType; use App\Form\Type\RichTextEditorType; use App\Form\Type\SIUnitType; use App\Form\Type\StructuralEntityType; -use App\Form\WorkaroundCollectionType; use App\Services\LogSystem\EventCommentNeededHelper; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; diff --git a/src/Form/Type/PartLotSelectType.php b/src/Form/Type/PartLotSelectType.php index 9e93c85b..76e31ecb 100644 --- a/src/Form/Type/PartLotSelectType.php +++ b/src/Form/Type/PartLotSelectType.php @@ -43,12 +43,12 @@ class PartLotSelectType extends AbstractType $resolver->setDefaults([ 'class' => PartLot::class, - 'choice_label' => ChoiceList::label($this, function (PartLot $part_lot) { + 'choice_label' => ChoiceList::label($this, static function (PartLot $part_lot) { return ($part_lot->getStorageLocation() ? $part_lot->getStorageLocation()->getFullPath() : '') . ' (' . $part_lot->getName() . '): ' . $part_lot->getAmount(); }), 'query_builder' => function (Options $options) { - return function (EntityRepository $er) use ($options) { + return static function (EntityRepository $er) use ($options) { return $er->createQueryBuilder('l') ->where('l.part = :part') ->setParameter('part', $options['part']); diff --git a/src/Helpers/Trees/TreeViewNode.php b/src/Helpers/Trees/TreeViewNode.php index 89e4a02e..f43a1eb6 100644 --- a/src/Helpers/Trees/TreeViewNode.php +++ b/src/Helpers/Trees/TreeViewNode.php @@ -30,17 +30,17 @@ use JsonSerializable; */ final class TreeViewNode implements JsonSerializable { - private $text; - private $href; - private $nodes; + private string $text; + private ?string $href; + private ?array $nodes; - private $state = null; + private ?TreeViewNodeState $state = null; - private $tags; + private ?array $tags; - private $id; + private ?int $id; - private $icon; + private ?string $icon; /** * Creates a new TreeView node with the given parameters. diff --git a/src/Helpers/Trees/TreeViewNodeState.php b/src/Helpers/Trees/TreeViewNodeState.php index 92b4611c..727135bc 100644 --- a/src/Helpers/Trees/TreeViewNodeState.php +++ b/src/Helpers/Trees/TreeViewNodeState.php @@ -29,17 +29,17 @@ final class TreeViewNodeState implements JsonSerializable /** * @var bool|null */ - private $disabled = null; + private ?bool $disabled = null; /** * @var bool|null */ - private $expanded = null; + private ?bool $expanded = null; /** * @var bool|null */ - private $selected = null; + private ?bool $selected = null; public function getDisabled(): ?bool { diff --git a/src/Migration/AbstractMultiPlatformMigration.php b/src/Migration/AbstractMultiPlatformMigration.php index 38b86644..ab7e5977 100644 --- a/src/Migration/AbstractMultiPlatformMigration.php +++ b/src/Migration/AbstractMultiPlatformMigration.php @@ -21,13 +21,8 @@ namespace App\Migration; use Doctrine\DBAL\Connection; -use Doctrine\DBAL\DBALException; -use Doctrine\DBAL\Driver\AbstractMySQLDriver; -use Doctrine\DBAL\Driver\AbstractSQLiteDriver; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; -use Doctrine\DBAL\Platforms\MariaDBPlatform; -use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -43,7 +38,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration public function __construct(Connection $connection, LoggerInterface $logger) { $this->logger = $logger; - AbstractMigration::__construct($connection, $logger); + parent::__construct($connection, $logger); } public function up(Schema $schema): void diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php index b0ccd964..6913dea4 100644 --- a/src/Repository/UserRepository.php +++ b/src/Repository/UserRepository.php @@ -35,7 +35,7 @@ use Symfony\Component\Security\Core\User\UserInterface; */ final class UserRepository extends NamedDBElementRepository implements PasswordUpgraderInterface { - protected $anonymous_user; + protected ?User $anonymous_user; /** * Returns the anonymous user. diff --git a/src/Security/Voter/AttachmentVoter.php b/src/Security/Voter/AttachmentVoter.php index 135ba57f..25a856a8 100644 --- a/src/Security/Voter/AttachmentVoter.php +++ b/src/Security/Voter/AttachmentVoter.php @@ -32,7 +32,7 @@ use function in_array; class AttachmentVoter extends ExtendedVoter { - protected $security; + protected Security $security; public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) { diff --git a/src/Serializer/StructuralElementDenormalizer.php b/src/Serializer/StructuralElementDenormalizer.php index 5b1396c1..c9880daf 100644 --- a/src/Serializer/StructuralElementDenormalizer.php +++ b/src/Serializer/StructuralElementDenormalizer.php @@ -48,7 +48,7 @@ class StructuralElementDenormalizer implements ContextAwareDenormalizerInterface return is_array($data) && is_subclass_of($type, AbstractStructuralDBElement::class) //Only denormalize if we are doing an file import operation - && in_array('import', $context['groups'] ?? []); + && in_array('import', $context['groups'] ?? [], true); } public function denormalize($data, string $type, string $format = null, array $context = []): ?AbstractStructuralDBElement diff --git a/src/Services/Attachments/AttachmentSubmitHandler.php b/src/Services/Attachments/AttachmentSubmitHandler.php index 65e5c7db..db88154d 100644 --- a/src/Services/Attachments/AttachmentSubmitHandler.php +++ b/src/Services/Attachments/AttachmentSubmitHandler.php @@ -443,11 +443,13 @@ class AttachmentSubmitHandler ]; if (ctype_digit((string) $maxSize)) { return (int) $maxSize; - } elseif (preg_match('/^(\d++)('.implode('|', array_keys($factors)).')$/i', $maxSize, $matches)) { - return (((int) $matches[1]) * $factors[strtolower($matches[2])]); - } else { - throw new RuntimeException(sprintf('"%s" is not a valid maximum size.', $maxSize)); } + + if (preg_match('/^(\d++)('.implode('|', array_keys($factors)).')$/i', $maxSize, $matches)) { + return (((int) $matches[1]) * $factors[strtolower($matches[2])]); + } + + throw new RuntimeException(sprintf('"%s" is not a valid maximum size.', $maxSize)); } /* diff --git a/src/Services/ImportExportSystem/BOMImporter.php b/src/Services/ImportExportSystem/BOMImporter.php index d3fa4b9c..4bf9d9a3 100644 --- a/src/Services/ImportExportSystem/BOMImporter.php +++ b/src/Services/ImportExportSystem/BOMImporter.php @@ -114,7 +114,7 @@ class BOMImporter foreach ($csv->getRecords() as $offset => $entry) { //Translate the german field names to english - $entry = array_combine(array_map(function ($key) { + $entry = array_combine(array_map(static function ($key) { return self::MAP_KICAD_PCB_FIELDS[$key] ?? $key; }, array_keys($entry)), $entry); diff --git a/src/Services/LabelSystem/BarcodeGenerator.php b/src/Services/LabelSystem/BarcodeGenerator.php index a192abf2..6bdd021b 100644 --- a/src/Services/LabelSystem/BarcodeGenerator.php +++ b/src/Services/LabelSystem/BarcodeGenerator.php @@ -41,6 +41,8 @@ declare(strict_types=1); namespace App\Services\LabelSystem; +use App\Entity\Base\AbstractDBElement; +use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\LabelSystem\LabelOptions; use App\Services\LabelSystem\Barcodes\BarcodeContentGenerator; use Com\Tecnick\Barcode\Barcode; @@ -125,7 +127,7 @@ final class BarcodeGenerator return $bobj->getSvgCode(); } - public function getContent(LabelOptions $options, object $target): ?string + public function getContent(LabelOptions $options, AbstractDBElement $target): ?string { switch ($options->getBarcodeType()) { case 'qr': diff --git a/src/Services/Trees/TreeViewGenerator.php b/src/Services/Trees/TreeViewGenerator.php index bc66ba47..e89a3e80 100644 --- a/src/Services/Trees/TreeViewGenerator.php +++ b/src/Services/Trees/TreeViewGenerator.php @@ -49,14 +49,14 @@ use function count; class TreeViewGenerator { - protected $urlGenerator; - protected $em; - protected $cache; - protected $keyGenerator; - protected $translator; + protected EntityURLGenerator $urlGenerator; + protected EntityManagerInterface $em; + protected TagAwareCacheInterface $cache; + protected UserCacheKeyGenerator $keyGenerator; + protected TranslatorInterface $translator; - protected $rootNodeExpandedByDefault; - protected $rootNodeEnabled; + protected bool $rootNodeExpandedByDefault; + protected bool $rootNodeEnabled; public function __construct(EntityURLGenerator $URLGenerator, EntityManagerInterface $em, TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator, TranslatorInterface $translator, bool $rootNodeExpandedByDefault, bool $rootNodeEnabled) diff --git a/src/Services/UserSystem/PermissionSchemaUpdater.php b/src/Services/UserSystem/PermissionSchemaUpdater.php index e8ebc6d0..f182c018 100644 --- a/src/Services/UserSystem/PermissionSchemaUpdater.php +++ b/src/Services/UserSystem/PermissionSchemaUpdater.php @@ -36,11 +36,7 @@ class PermissionSchemaUpdater { $perm_data = $holder->getPermissions(); - if ($perm_data->getSchemaVersion() < PermissionData::CURRENT_SCHEMA_VERSION) { - return true; - } - - return false; + return $perm_data->getSchemaVersion() < PermissionData::CURRENT_SCHEMA_VERSION; } /** diff --git a/src/Validator/Constraints/Misc/ValidRange.php b/src/Validator/Constraints/Misc/ValidRange.php index eb14cf0d..15781498 100644 --- a/src/Validator/Constraints/Misc/ValidRange.php +++ b/src/Validator/Constraints/Misc/ValidRange.php @@ -48,5 +48,5 @@ use Symfony\Component\Validator\Constraint; */ class ValidRange extends Constraint { - public $message = 'validator.invalid_range'; + public string $message = 'validator.invalid_range'; } diff --git a/src/Validator/Constraints/NoLockout.php b/src/Validator/Constraints/NoLockout.php index 1a515e4d..323dddb4 100644 --- a/src/Validator/Constraints/NoLockout.php +++ b/src/Validator/Constraints/NoLockout.php @@ -31,5 +31,5 @@ use Symfony\Component\Validator\Constraint; */ class NoLockout extends Constraint { - public $message = 'validator.noLockout'; + public string $message = 'validator.noLockout'; } diff --git a/src/Validator/Constraints/NoneOfItsChildren.php b/src/Validator/Constraints/NoneOfItsChildren.php index e3bed2f8..15d98a2a 100644 --- a/src/Validator/Constraints/NoneOfItsChildren.php +++ b/src/Validator/Constraints/NoneOfItsChildren.php @@ -35,9 +35,9 @@ class NoneOfItsChildren extends Constraint /** * @var string The message used if it is tried to assign a object as its own parent */ - public $self_message = 'validator.noneofitschild.self'; + public string $self_message = 'validator.noneofitschild.self'; /** * @var string The message used if it is tried to use one of the children for as parent */ - public $children_message = 'validator.noneofitschild.children'; + public string $children_message = 'validator.noneofitschild.children'; } diff --git a/src/Validator/Constraints/UrlOrBuiltin.php b/src/Validator/Constraints/UrlOrBuiltin.php index d2c5715f..5f68d5f4 100644 --- a/src/Validator/Constraints/UrlOrBuiltin.php +++ b/src/Validator/Constraints/UrlOrBuiltin.php @@ -35,5 +35,5 @@ class UrlOrBuiltin extends Url /** * @var array A list of the placeholders that are treated as builtin */ - public $allowed_placeholders = Attachment::BUILTIN_PLACEHOLDER; + public array $allowed_placeholders = Attachment::BUILTIN_PLACEHOLDER; } diff --git a/tests/Controller/AdminPages/AbstractAdminControllerTest.php b/tests/Controller/AdminPages/AbstractAdminControllerTest.php index 532f0e92..92ba0027 100644 --- a/tests/Controller/AdminPages/AbstractAdminControllerTest.php +++ b/tests/Controller/AdminPages/AbstractAdminControllerTest.php @@ -31,8 +31,8 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; */ abstract class AbstractAdminControllerTest extends WebTestCase { - protected static $base_path = 'not_valid'; - protected static $entity_class = 'not valid'; + protected static string $base_path = 'not_valid'; + protected static string $entity_class = 'not valid'; public function readDataProvider(): array { diff --git a/tests/Controller/AdminPages/AttachmentTypeControllerTest.php b/tests/Controller/AdminPages/AttachmentTypeControllerTest.php index 12233942..e4b47069 100644 --- a/tests/Controller/AdminPages/AttachmentTypeControllerTest.php +++ b/tests/Controller/AdminPages/AttachmentTypeControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Attachments\AttachmentType; */ class AttachmentTypeControllerTest extends AbstractAdminControllerTest { - protected static $base_path = '/en'.'/attachment_type'; - protected static $entity_class = AttachmentType::class; + protected static string $base_path = '/en'.'/attachment_type'; + protected static string $entity_class = AttachmentType::class; } diff --git a/tests/Controller/AdminPages/CategoryControllerTest.php b/tests/Controller/AdminPages/CategoryControllerTest.php index 1a9efee7..df4de1bd 100644 --- a/tests/Controller/AdminPages/CategoryControllerTest.php +++ b/tests/Controller/AdminPages/CategoryControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\Category; */ class CategoryControllerTest extends AbstractAdminControllerTest { - protected static $base_path = '/en'.'/category'; - protected static $entity_class = Category::class; + protected static string $base_path = '/en'.'/category'; + protected static string $entity_class = Category::class; } diff --git a/tests/Controller/AdminPages/FootprintControllerTest.php b/tests/Controller/AdminPages/FootprintControllerTest.php index ac5d8242..972248c9 100644 --- a/tests/Controller/AdminPages/FootprintControllerTest.php +++ b/tests/Controller/AdminPages/FootprintControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\Footprint; */ class FootprintControllerTest extends AbstractAdminControllerTest { - protected static $base_path = '/en'.'/footprint'; - protected static $entity_class = Footprint::class; + protected static string $base_path = '/en'.'/footprint'; + protected static string $entity_class = Footprint::class; } diff --git a/tests/Controller/AdminPages/LabelProfileControllerTest.php b/tests/Controller/AdminPages/LabelProfileControllerTest.php index 80cf8348..0a59ffcc 100644 --- a/tests/Controller/AdminPages/LabelProfileControllerTest.php +++ b/tests/Controller/AdminPages/LabelProfileControllerTest.php @@ -46,8 +46,8 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; class LabelProfileControllerTest extends AbstractAdminControllerTest { - protected static $base_path = '/en'.'/label_profile'; - protected static $entity_class = LabelProfile::class; + protected static string $base_path = '/en'.'/label_profile'; + protected static string $entity_class = LabelProfile::class; /** * Tests if deleting an entity is working. diff --git a/tests/Controller/AdminPages/ManufacturerControllerTest.php b/tests/Controller/AdminPages/ManufacturerControllerTest.php index 56b2cd1a..d66441c9 100644 --- a/tests/Controller/AdminPages/ManufacturerControllerTest.php +++ b/tests/Controller/AdminPages/ManufacturerControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\Manufacturer; */ class ManufacturerControllerTest extends AbstractAdminControllerTest { - protected static $base_path = '/en'.'/manufacturer'; - protected static $entity_class = Manufacturer::class; + protected static string $base_path = '/en'.'/manufacturer'; + protected static string $entity_class = Manufacturer::class; } diff --git a/tests/Controller/AdminPages/MeasurementUnitControllerTest.php b/tests/Controller/AdminPages/MeasurementUnitControllerTest.php index 53302e22..62a90cc4 100644 --- a/tests/Controller/AdminPages/MeasurementUnitControllerTest.php +++ b/tests/Controller/AdminPages/MeasurementUnitControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\MeasurementUnit; */ class MeasurementUnitControllerTest extends AbstractAdminControllerTest { - protected static $base_path = '/en'.'/measurement_unit'; - protected static $entity_class = MeasurementUnit::class; + protected static string $base_path = '/en'.'/measurement_unit'; + protected static string $entity_class = MeasurementUnit::class; } diff --git a/tests/Controller/AdminPages/ProjectControllerTest.php b/tests/Controller/AdminPages/ProjectControllerTest.php index 586c1b93..01588e52 100644 --- a/tests/Controller/AdminPages/ProjectControllerTest.php +++ b/tests/Controller/AdminPages/ProjectControllerTest.php @@ -31,6 +31,6 @@ use App\Entity\ProjectSystem\Project; */ class ProjectControllerTest extends AbstractAdminControllerTest { - protected static $base_path = '/en'.'/project'; - protected static $entity_class = Project::class; + protected static string $base_path = '/en'.'/project'; + protected static string $entity_class = Project::class; } diff --git a/tests/Controller/AdminPages/StorelocationControllerTest.php b/tests/Controller/AdminPages/StorelocationControllerTest.php index 1844c75e..bcfd3212 100644 --- a/tests/Controller/AdminPages/StorelocationControllerTest.php +++ b/tests/Controller/AdminPages/StorelocationControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\Storelocation; */ class StorelocationControllerTest extends AbstractAdminControllerTest { - protected static $base_path = '/en'.'/store_location'; - protected static $entity_class = Storelocation::class; + protected static string $base_path = '/en'.'/store_location'; + protected static string $entity_class = Storelocation::class; } diff --git a/tests/Controller/AdminPages/SupplierControllerTest.php b/tests/Controller/AdminPages/SupplierControllerTest.php index de6f8d7c..f2c3e066 100644 --- a/tests/Controller/AdminPages/SupplierControllerTest.php +++ b/tests/Controller/AdminPages/SupplierControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\Supplier; */ class SupplierControllerTest extends AbstractAdminControllerTest { - protected static $base_path = '/en'.'/supplier'; - protected static $entity_class = Supplier::class; + protected static string $base_path = '/en'.'/supplier'; + protected static string $entity_class = Supplier::class; } diff --git a/tests/Controller/RedirectControllerTest.php b/tests/Controller/RedirectControllerTest.php index 59e884d3..bb4543b6 100644 --- a/tests/Controller/RedirectControllerTest.php +++ b/tests/Controller/RedirectControllerTest.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace App\Tests\Controller; use App\Entity\UserSystem\User; +use App\Repository\UserRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; @@ -32,9 +33,9 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ class RedirectControllerTest extends WebTestCase { - protected $em; - protected $userRepo; - protected $client; + protected EntityManagerInterface $em; + protected UserRepository $userRepo; + protected \Symfony\Bundle\FrameworkBundle\KernelBrowser $client; protected function setUp(): void { diff --git a/tests/Entity/Attachments/AttachmentTest.php b/tests/Entity/Attachments/AttachmentTest.php index 91a3cb53..4a90ac3a 100644 --- a/tests/Entity/Attachments/AttachmentTest.php +++ b/tests/Entity/Attachments/AttachmentTest.php @@ -282,7 +282,7 @@ class AttachmentTest extends TestCase * @param string $property - property on instance being modified * @param mixed $value - new value of the property being modified */ - public function setProtectedProperty($object, $property, $value): void + public function setProtectedProperty(object $object, string $property, $value): void { $reflection = new ReflectionClass($object); $reflection_property = $reflection->getProperty($property); diff --git a/tests/Entity/Base/AbstractStructuralDBElementTest.php b/tests/Entity/Base/AbstractStructuralDBElementTest.php index 9a4104e5..6ff643e2 100644 --- a/tests/Entity/Base/AbstractStructuralDBElementTest.php +++ b/tests/Entity/Base/AbstractStructuralDBElementTest.php @@ -33,12 +33,12 @@ use PHPUnit\Framework\TestCase; */ class AbstractStructuralDBElementTest extends TestCase { - protected $root; - protected $child1; - protected $child2; - protected $child3; - protected $child1_1; - protected $child1_2; + protected AttachmentType $root; + protected AttachmentType $child1; + protected AttachmentType $child2; + protected AttachmentType $child3; + protected AttachmentType $child1_1; + protected AttachmentType $child1_2; protected function setUp(): void { diff --git a/tests/Helpers/BBCodeToMarkdownConverterTest.php b/tests/Helpers/BBCodeToMarkdownConverterTest.php index 35dea60d..a4703d95 100644 --- a/tests/Helpers/BBCodeToMarkdownConverterTest.php +++ b/tests/Helpers/BBCodeToMarkdownConverterTest.php @@ -27,7 +27,7 @@ use PHPUnit\Framework\TestCase; class BBCodeToMarkdownConverterTest extends TestCase { - protected $converter; + protected BBCodeToMarkdownConverter $converter; protected function setUp(): void { diff --git a/tests/Helpers/Projects/ProjectBuildRequestTest.php b/tests/Helpers/Projects/ProjectBuildRequestTest.php index 92c61a28..ad14035c 100644 --- a/tests/Helpers/Projects/ProjectBuildRequestTest.php +++ b/tests/Helpers/Projects/ProjectBuildRequestTest.php @@ -35,24 +35,24 @@ class ProjectBuildRequestTest extends TestCase private MeasurementUnit $float_unit; /** @var Project */ - private $project1; + private Project $project1; /** @var ProjectBOMEntry */ - private $bom_entry1a; + private ProjectBOMEntry $bom_entry1a; /** @var ProjectBOMEntry */ - private $bom_entry1b; + private ProjectBOMEntry $bom_entry1b; /** @var ProjectBOMEntry */ - private $bom_entry1c; + private ProjectBOMEntry $bom_entry1c; /** @var PartLot $lot1a */ private $lot1a; /** @var PartLot $lot1b */ private $lot1b; - private $lot2; + private PartLot $lot2; /** @var Part */ - private $part1; + private Part $part1; /** @var Part */ - private $part2; + private Part $part2; public function setUp(): void diff --git a/tests/Helpers/TreeViewNodeTest.php b/tests/Helpers/TreeViewNodeTest.php index d7ee81f9..9005651d 100644 --- a/tests/Helpers/TreeViewNodeTest.php +++ b/tests/Helpers/TreeViewNodeTest.php @@ -30,11 +30,11 @@ class TreeViewNodeTest extends TestCase /** * @var TreeViewNode */ - protected $node1; + protected TreeViewNode $node1; /** * @var TreeViewNode */ - protected $node2; + protected TreeViewNode $node2; protected function setUp(): void { diff --git a/tests/Services/Attachments/AttachmentPathResolverTest.php b/tests/Services/Attachments/AttachmentPathResolverTest.php index 76694412..a3f1595f 100644 --- a/tests/Services/Attachments/AttachmentPathResolverTest.php +++ b/tests/Services/Attachments/AttachmentPathResolverTest.php @@ -29,8 +29,8 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class AttachmentPathResolverTest extends WebTestCase { - protected $media_path; - protected $footprint_path; + protected string $media_path; + protected string $footprint_path; protected $projectDir_orig; protected $projectDir; /** diff --git a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php index 499ab8f4..597b05ca 100644 --- a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php +++ b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php @@ -27,7 +27,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class BuiltinAttachmentsFinderTest extends WebTestCase { - protected static $mock_list = [ + protected static array $mock_list = [ '%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS%/123.jpg', '%FOOTPRINTS%/123.jpeg', '%FOOTPRINTS_3D%/test.jpg', '%FOOTPRINTS_3D%/hallo.txt', ]; diff --git a/tests/Services/LabelSystem/LabelTextReplacerTest.php b/tests/Services/LabelSystem/LabelTextReplacerTest.php index 09635562..dd2e7c7b 100644 --- a/tests/Services/LabelSystem/LabelTextReplacerTest.php +++ b/tests/Services/LabelSystem/LabelTextReplacerTest.php @@ -51,12 +51,12 @@ class LabelTextReplacerTest extends WebTestCase /** * @var LabelTextReplacer */ - protected $service; + protected LabelTextReplacer $service; /** * @var Part */ - protected $target; + protected Part $target; protected function setUp(): void { diff --git a/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php index cd9e2c23..83d7f3d9 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php @@ -53,9 +53,9 @@ class PartLotProviderTest extends WebTestCase /** * @var PartLotProvider */ - protected $service; + protected PartLotProvider $service; - protected $target; + protected PartLot $target; protected function setUp(): void { diff --git a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php index a97cb438..8e2b784e 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php @@ -56,9 +56,9 @@ class PartProviderTest extends WebTestCase /** * @var PartProvider */ - protected $service; + protected PartProvider $service; - protected $target; + protected Part $target; /** * @var \Doctrine\ORM\EntityManager diff --git a/tests/Services/Misc/FAIconGeneratorTest.php b/tests/Services/Misc/FAIconGeneratorTest.php index 63015d7b..b2da6a58 100644 --- a/tests/Services/Misc/FAIconGeneratorTest.php +++ b/tests/Services/Misc/FAIconGeneratorTest.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace App\Tests\Services\Misc; use App\Services\Misc\FAIconGenerator; -use App\Tests\Services\AmountFormatter; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class FAIconGeneratorTest extends WebTestCase diff --git a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php index 33968857..b4404773 100644 --- a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php +++ b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php @@ -27,24 +27,24 @@ class PartLotWithdrawAddHelperTest extends WebTestCase protected $service; /** @var Part */ - private $part; + private Part $part; /** @var Storelocation */ - private $storageLocation; + private Storelocation $storageLocation; /** @var Storelocation */ - private $full_storageLocation; + private Storelocation $full_storageLocation; /** @var PartLot */ - private $partLot1; + private PartLot $partLot1; /** @var PartLot */ - private $partLot2; + private PartLot $partLot2; /** @var PartLot */ - private $partLot3; + private PartLot $partLot3; /** @var PartLot */ - private $fullLot; + private PartLot $fullLot; /** @var PartLot */ - private $lotWithUnknownInstock; + private PartLot $lotWithUnknownInstock; protected function setUp(): void { diff --git a/tests/Services/UserSystem/PermissionManagerTest.php b/tests/Services/UserSystem/PermissionManagerTest.php index 57905253..b6ed5668 100644 --- a/tests/Services/UserSystem/PermissionManagerTest.php +++ b/tests/Services/UserSystem/PermissionManagerTest.php @@ -24,7 +24,6 @@ namespace App\Tests\Services\UserSystem; use App\Entity\UserSystem\Group; use App\Entity\UserSystem\PermissionData; -use App\Entity\UserSystem\PermissionsEmbed; use App\Entity\UserSystem\User; use App\Services\UserSystem\PermissionManager; use InvalidArgumentException;