From 58d4207b49082d71d08d6b2b89b7f22a89b61081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 3 Aug 2025 21:59:51 +0200 Subject: [PATCH] Fixed phpstan issues --- src/Command/CheckRequirementsCommand.php | 6 +++--- src/Command/Migrations/ImportPartKeeprCommand.php | 2 +- src/Command/User/UpgradePermissionsSchemaCommand.php | 9 +-------- src/Command/User/UsersPermissionsCommand.php | 2 +- src/Entity/Base/AbstractDBElement.php | 3 ++- src/Services/ImportExportSystem/EntityExporter.php | 2 +- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/Command/CheckRequirementsCommand.php b/src/Command/CheckRequirementsCommand.php index 5e15e8e2..f9080c42 100644 --- a/src/Command/CheckRequirementsCommand.php +++ b/src/Command/CheckRequirementsCommand.php @@ -69,8 +69,8 @@ class CheckRequirementsCommand extends Command if ($io->isVerbose()) { $io->comment('Checking PHP version...'); } - //We recommend PHP 8.2, but 8.1 is the minimum - if (PHP_VERSION_ID < 80200) { + //We recommend PHP 8.2, but 8.2 is the minimum + if (PHP_VERSION_ID < 80400) { $io->warning('You are using PHP '. PHP_VERSION .'. This will work, but a newer version is recommended.'); } elseif (!$only_issues) { $io->success('PHP version is sufficient.'); @@ -84,7 +84,7 @@ class CheckRequirementsCommand extends Command $io->success('You are using a 64-bit system.'); } } else { - $io->warning('You are using a system with an unknown bit size. That is interesting xD'); + $io->warning(' areYou using a system with an unknown bit size. That is interesting xD'); } //Check if opcache is enabled diff --git a/src/Command/Migrations/ImportPartKeeprCommand.php b/src/Command/Migrations/ImportPartKeeprCommand.php index 98272440..aee71afe 100644 --- a/src/Command/Migrations/ImportPartKeeprCommand.php +++ b/src/Command/Migrations/ImportPartKeeprCommand.php @@ -44,7 +44,7 @@ class ImportPartKeeprCommand extends Command protected PKDatastructureImporter $datastructureImporter, protected PKPartImporter $partImporter, protected PKImportHelper $importHelper, protected PKOptionalImporter $optionalImporter) { - parent::__construct(self::$defaultName); + parent::__construct(); } protected function configure(): void diff --git a/src/Command/User/UpgradePermissionsSchemaCommand.php b/src/Command/User/UpgradePermissionsSchemaCommand.php index 4947fd5c..a53e21a0 100644 --- a/src/Command/User/UpgradePermissionsSchemaCommand.php +++ b/src/Command/User/UpgradePermissionsSchemaCommand.php @@ -39,14 +39,7 @@ final class UpgradePermissionsSchemaCommand extends Command { public function __construct(private readonly PermissionSchemaUpdater $permissionSchemaUpdater, private readonly EntityManagerInterface $em, private readonly EventCommentHelper $eventCommentHelper) { - parent::__construct(self::$defaultName); - } - - protected function configure(): void - { - $this - ->setDescription(self::$defaultDescription) - ; + parent::__construct(); } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Command/User/UsersPermissionsCommand.php b/src/Command/User/UsersPermissionsCommand.php index 6408e9c9..27382371 100644 --- a/src/Command/User/UsersPermissionsCommand.php +++ b/src/Command/User/UsersPermissionsCommand.php @@ -46,7 +46,7 @@ class UsersPermissionsCommand extends Command { $this->userRepository = $entityManager->getRepository(User::class); - parent::__construct(self::$defaultName); + parent::__construct(); } protected function configure(): void diff --git a/src/Entity/Base/AbstractDBElement.php b/src/Entity/Base/AbstractDBElement.php index 871a22d0..9fb5d648 100644 --- a/src/Entity/Base/AbstractDBElement.php +++ b/src/Entity/Base/AbstractDBElement.php @@ -39,6 +39,7 @@ use App\Entity\Attachments\SupplierAttachment; use App\Entity\Attachments\UserAttachment; use App\Entity\Parameters\AbstractParameter; use App\Entity\Parts\Category; +use App\Entity\PriceInformations\Pricedetail; use App\Entity\ProjectSystem\Project; use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Entity\Parts\Footprint; @@ -67,7 +68,7 @@ use Symfony\Component\Serializer\Annotation\Groups; * Every database table which are managed with this class (or a subclass of it) * must have the table row "id"!! The ID is the unique key to identify the elements. */ -#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => AttachmentType::class, 'attachment' => Attachment::class, 'attachment_type_attachment' => AttachmentTypeAttachment::class, 'category_attachment' => CategoryAttachment::class, 'currency_attachment' => CurrencyAttachment::class, 'footprint_attachment' => FootprintAttachment::class, 'group_attachment' => GroupAttachment::class, 'label_attachment' => LabelAttachment::class, 'manufacturer_attachment' => ManufacturerAttachment::class, 'measurement_unit_attachment' => MeasurementUnitAttachment::class, 'part_attachment' => PartAttachment::class, 'project_attachment' => ProjectAttachment::class, 'storelocation_attachment' => StorageLocationAttachment::class, 'supplier_attachment' => SupplierAttachment::class, 'user_attachment' => UserAttachment::class, 'category' => Category::class, 'project' => Project::class, 'project_bom_entry' => ProjectBOMEntry::class, 'footprint' => Footprint::class, 'group' => Group::class, 'manufacturer' => Manufacturer::class, 'orderdetail' => Orderdetail::class, 'part' => Part::class, 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => StorageLocation::class, 'part_lot' => PartLot::class, 'currency' => Currency::class, 'measurement_unit' => MeasurementUnit::class, 'parameter' => AbstractParameter::class, 'supplier' => Supplier::class, 'user' => User::class])] +#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => AttachmentType::class, 'attachment' => Attachment::class, 'attachment_type_attachment' => AttachmentTypeAttachment::class, 'category_attachment' => CategoryAttachment::class, 'currency_attachment' => CurrencyAttachment::class, 'footprint_attachment' => FootprintAttachment::class, 'group_attachment' => GroupAttachment::class, 'label_attachment' => LabelAttachment::class, 'manufacturer_attachment' => ManufacturerAttachment::class, 'measurement_unit_attachment' => MeasurementUnitAttachment::class, 'part_attachment' => PartAttachment::class, 'project_attachment' => ProjectAttachment::class, 'storelocation_attachment' => StorageLocationAttachment::class, 'supplier_attachment' => SupplierAttachment::class, 'user_attachment' => UserAttachment::class, 'category' => Category::class, 'project' => Project::class, 'project_bom_entry' => ProjectBOMEntry::class, 'footprint' => Footprint::class, 'group' => Group::class, 'manufacturer' => Manufacturer::class, 'orderdetail' => Orderdetail::class, 'part' => Part::class, 'pricedetail' => Pricedetail::class, 'storelocation' => StorageLocation::class, 'part_lot' => PartLot::class, 'currency' => Currency::class, 'measurement_unit' => MeasurementUnit::class, 'parameter' => AbstractParameter::class, 'supplier' => Supplier::class, 'user' => User::class])] #[ORM\MappedSuperclass(repositoryClass: DBElementRepository::class)] abstract class AbstractDBElement implements JsonSerializable { diff --git a/src/Services/ImportExportSystem/EntityExporter.php b/src/Services/ImportExportSystem/EntityExporter.php index c37db50c..271642da 100644 --- a/src/Services/ImportExportSystem/EntityExporter.php +++ b/src/Services/ImportExportSystem/EntityExporter.php @@ -137,7 +137,7 @@ class EntityExporter $options = [ 'format' => $request->get('format') ?? 'json', 'level' => $request->get('level') ?? 'extended', - 'include_children' => $request->request->getBoolean('include_children') ?? false, + 'include_children' => $request->request->getBoolean('include_children'), ]; if (!is_array($entities)) {