diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 8ad7bf1a..05dc5d0e 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -30,9 +30,6 @@ framework: php_errors: log: true - form: - legacy_error_messages: false # Enable to use the new Form component validation messages - when@test: framework: test: true diff --git a/config/packages/security.yaml b/config/packages/security.yaml index f664e7f9..342e38bf 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -1,5 +1,4 @@ security: - enable_authenticator_manager: true # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords password_hashers: Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' diff --git a/src/Command/Migrations/ImportPartKeeprCommand.php b/src/Command/Migrations/ImportPartKeeprCommand.php index f1c7b47c..20269c0a 100644 --- a/src/Command/Migrations/ImportPartKeeprCommand.php +++ b/src/Command/Migrations/ImportPartKeeprCommand.php @@ -45,7 +45,7 @@ class ImportPartKeeprCommand extends Command parent::__construct(self::$defaultName); } - protected function configure() + protected function configure(): void { $this->setHelp('This command allows you to import a PartKeepr database exported by mysqldump as XML file into Part-DB'); diff --git a/src/Doctrine/SQLiteRegexExtension.php b/src/Doctrine/SQLiteRegexExtension.php index cc1ff5f8..3482348e 100644 --- a/src/Doctrine/SQLiteRegexExtension.php +++ b/src/Doctrine/SQLiteRegexExtension.php @@ -21,6 +21,7 @@ namespace App\Doctrine; use App\Exceptions\InvalidRegexException; +use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener; use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface; use Doctrine\DBAL\Event\ConnectionEventArgs; use Doctrine\DBAL\Events; @@ -31,7 +32,8 @@ use Doctrine\DBAL\Platforms\SqlitePlatform; * As a PHP callback is called for every entry to compare it is most likely much slower than using regex on MySQL. * But as regex is not often used, this should be fine for most use cases, also it is almost impossible to implement a better solution. */ -class SQLiteRegexExtension implements EventSubscriberInterface +#[AsDoctrineListener(Events::postConnect)] +class SQLiteRegexExtension { public function postConnect(ConnectionEventArgs $eventArgs): void { @@ -53,11 +55,4 @@ class SQLiteRegexExtension implements EventSubscriberInterface } } } - - public function getSubscribedEvents(): array - { - return[ - Events::postConnect - ]; - } } \ No newline at end of file diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index 6e4a77f3..1a090b78 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -121,7 +121,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement * @var string the group this parameter belongs to */ #[Groups(['full'])] - #[Groups(['full'])] #[ORM\Column(type: Types::STRING, name: 'param_group')] protected string $group = ''; diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index ea96666a..dd05a0e5 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -170,7 +170,7 @@ class AttachmentFormType extends AbstractType ]); } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { $view->vars['max_upload_size'] = $this->submitHandler->getMaximumAllowedUploadSize(); } diff --git a/src/Form/CollectionTypeExtension.php b/src/Form/CollectionTypeExtension.php index a70576fd..38266315 100644 --- a/src/Form/CollectionTypeExtension.php +++ b/src/Form/CollectionTypeExtension.php @@ -98,7 +98,7 @@ class CollectionTypeExtension extends AbstractTypeExtension $resolver->setAllowedTypes('reindex_path', 'string'); } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { parent::finishView($view, $form, $options); //Add prototype name to view, so that we can pass it to the stimulus controller diff --git a/src/Form/Filters/AttachmentFilterType.php b/src/Form/Filters/AttachmentFilterType.php index 1b4967f5..9908b542 100644 --- a/src/Form/Filters/AttachmentFilterType.php +++ b/src/Form/Filters/AttachmentFilterType.php @@ -58,7 +58,7 @@ class AttachmentFilterType extends AbstractType ]); } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('dbId', NumberConstraintType::class, [ 'label' => 'part.filter.dbId', diff --git a/src/Form/Filters/Constraints/BooleanConstraintType.php b/src/Form/Filters/Constraints/BooleanConstraintType.php index ebc5ce09..0c431a21 100644 --- a/src/Form/Filters/Constraints/BooleanConstraintType.php +++ b/src/Form/Filters/Constraints/BooleanConstraintType.php @@ -46,7 +46,7 @@ class BooleanConstraintType extends AbstractType ]); } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { //Remove the label from the compound form, as the checkbox already has a label $view->vars['label'] = false; diff --git a/src/Form/Filters/Constraints/DateTimeConstraintType.php b/src/Form/Filters/Constraints/DateTimeConstraintType.php index b24346ee..56cde796 100644 --- a/src/Form/Filters/Constraints/DateTimeConstraintType.php +++ b/src/Form/Filters/Constraints/DateTimeConstraintType.php @@ -84,7 +84,7 @@ class DateTimeConstraintType extends AbstractType ]); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); diff --git a/src/Form/Filters/Constraints/InstanceOfConstraintType.php b/src/Form/Filters/Constraints/InstanceOfConstraintType.php index b88fa50f..af15117d 100644 --- a/src/Form/Filters/Constraints/InstanceOfConstraintType.php +++ b/src/Form/Filters/Constraints/InstanceOfConstraintType.php @@ -31,7 +31,7 @@ class InstanceOfConstraintType extends AbstractType { } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefault('data_class', InstanceOfConstraint::class); } diff --git a/src/Form/Filters/Constraints/NumberConstraintType.php b/src/Form/Filters/Constraints/NumberConstraintType.php index a04fc9a1..38b9539c 100644 --- a/src/Form/Filters/Constraints/NumberConstraintType.php +++ b/src/Form/Filters/Constraints/NumberConstraintType.php @@ -91,10 +91,8 @@ class NumberConstraintType extends AbstractType ]); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { - parent::buildView($view, $form, $options); - $view->vars['text_suffix'] = $options['text_suffix']; } } \ No newline at end of file diff --git a/src/Form/Filters/Constraints/StructuralEntityConstraintType.php b/src/Form/Filters/Constraints/StructuralEntityConstraintType.php index 1ef6a333..7396c54a 100644 --- a/src/Form/Filters/Constraints/StructuralEntityConstraintType.php +++ b/src/Form/Filters/Constraints/StructuralEntityConstraintType.php @@ -65,7 +65,7 @@ class StructuralEntityConstraintType extends AbstractType ]); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); $view->vars['text_suffix'] = $options['text_suffix']; diff --git a/src/Form/Filters/Constraints/TextConstraintType.php b/src/Form/Filters/Constraints/TextConstraintType.php index b9415977..517fe980 100644 --- a/src/Form/Filters/Constraints/TextConstraintType.php +++ b/src/Form/Filters/Constraints/TextConstraintType.php @@ -70,7 +70,7 @@ class TextConstraintType extends AbstractType ]); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); diff --git a/src/Form/Filters/Constraints/UserEntityConstraintType.php b/src/Form/Filters/Constraints/UserEntityConstraintType.php index 86c9eb97..cf646fe9 100644 --- a/src/Form/Filters/Constraints/UserEntityConstraintType.php +++ b/src/Form/Filters/Constraints/UserEntityConstraintType.php @@ -60,7 +60,7 @@ class UserEntityConstraintType extends AbstractType ]); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); $view->vars['text_suffix'] = $options['text_suffix']; diff --git a/src/Form/Filters/LogFilterType.php b/src/Form/Filters/LogFilterType.php index ad1082b7..45e6cccf 100644 --- a/src/Form/Filters/LogFilterType.php +++ b/src/Form/Filters/LogFilterType.php @@ -101,7 +101,7 @@ class LogFilterType extends AbstractType ]); } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('dbId', NumberConstraintType::class, [ 'label' => 'part.filter.dbId', diff --git a/src/Form/Filters/PartFilterType.php b/src/Form/Filters/PartFilterType.php index 249b0c1c..fceb3c16 100644 --- a/src/Form/Filters/PartFilterType.php +++ b/src/Form/Filters/PartFilterType.php @@ -59,7 +59,7 @@ class PartFilterType extends AbstractType ]); } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { /* * Common tab diff --git a/src/Form/ParameterType.php b/src/Form/ParameterType.php index 09293b97..66e664be 100644 --- a/src/Form/ParameterType.php +++ b/src/Form/ParameterType.php @@ -148,7 +148,7 @@ class ParameterType extends AbstractType ]); } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { //By default use part parameters for autocomplete $view->vars['type'] = 'part'; diff --git a/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php b/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php index f92cf3a9..5f4e5210 100644 --- a/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php +++ b/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php @@ -13,7 +13,7 @@ class ProjectBOMEntryCollectionType extends AbstractType return CollectionType::class; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'entry_type' => ProjectBOMEntryType::class, diff --git a/src/Form/ProjectSystem/ProjectBOMEntryType.php b/src/Form/ProjectSystem/ProjectBOMEntryType.php index 2350f61d..35a00e67 100644 --- a/src/Form/ProjectSystem/ProjectBOMEntryType.php +++ b/src/Form/ProjectSystem/ProjectBOMEntryType.php @@ -18,7 +18,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class ProjectBOMEntryType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { diff --git a/src/Form/ProjectSystem/ProjectBuildType.php b/src/Form/ProjectSystem/ProjectBuildType.php index 28c7c18a..77260fcb 100644 --- a/src/Form/ProjectSystem/ProjectBuildType.php +++ b/src/Form/ProjectSystem/ProjectBuildType.php @@ -43,7 +43,7 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface { } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'compound' => true, @@ -51,7 +51,7 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface ]); } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->setDataMapper($this); @@ -104,7 +104,7 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface }); } - public function mapDataToForms($data, \Traversable $forms) + public function mapDataToForms($data, \Traversable $forms): void { if (!$data instanceof ProjectBuildRequest) { throw new \RuntimeException('Data must be an instance of ' . ProjectBuildRequest::class); @@ -129,7 +129,7 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface } - public function mapFormsToData(\Traversable $forms, &$data) + public function mapFormsToData(\Traversable $forms, &$data): void { if (!$data instanceof ProjectBuildRequest) { throw new \RuntimeException('Data must be an instance of ' . ProjectBuildRequest::class); diff --git a/src/Form/Type/BigDecimalMoneyType.php b/src/Form/Type/BigDecimalMoneyType.php index 2fb8d7ee..3c7d252f 100644 --- a/src/Form/Type/BigDecimalMoneyType.php +++ b/src/Form/Type/BigDecimalMoneyType.php @@ -28,7 +28,7 @@ use Symfony\Component\Form\FormBuilderInterface; class BigDecimalMoneyType extends AbstractType implements DataTransformerInterface { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->addModelTransformer($this); } diff --git a/src/Form/Type/BigDecimalNumberType.php b/src/Form/Type/BigDecimalNumberType.php index 8ee0911e..b236cfe0 100644 --- a/src/Form/Type/BigDecimalNumberType.php +++ b/src/Form/Type/BigDecimalNumberType.php @@ -28,7 +28,7 @@ use Symfony\Component\Form\FormBuilderInterface; class BigDecimalNumberType extends AbstractType implements DataTransformerInterface { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->addModelTransformer($this); } diff --git a/src/Form/Type/PartLotSelectType.php b/src/Form/Type/PartLotSelectType.php index bc8d0d84..6c1de117 100644 --- a/src/Form/Type/PartLotSelectType.php +++ b/src/Form/Type/PartLotSelectType.php @@ -37,7 +37,7 @@ class PartLotSelectType extends AbstractType return EntityType::class; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired('part'); $resolver->setAllowedTypes('part', Part::class); diff --git a/src/Form/Type/PartSelectType.php b/src/Form/Type/PartSelectType.php index cbbe9668..43f5c44d 100644 --- a/src/Form/Type/PartSelectType.php +++ b/src/Form/Type/PartSelectType.php @@ -26,7 +26,7 @@ class PartSelectType extends AbstractType implements DataMapperInterface { } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { //At initialization, we have to fill the form element with our selected data, so the user can see it $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) { @@ -66,7 +66,7 @@ class PartSelectType extends AbstractType implements DataMapperInterface $builder->setDataMapper($this); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'class' => Part::class, @@ -110,13 +110,13 @@ class PartSelectType extends AbstractType implements DataMapperInterface ]); } - public function mapDataToForms($data, \Traversable $forms) + public function mapDataToForms($data, \Traversable $forms): void { $form = current(iterator_to_array($forms, false)); $form->setData($data); } - public function mapFormsToData(\Traversable $forms, &$data) + public function mapFormsToData(\Traversable $forms, &$data): void { $form = current(iterator_to_array($forms, false)); $data = $form->getData(); diff --git a/src/Form/Type/RichTextEditorType.php b/src/Form/Type/RichTextEditorType.php index fd796e52..ab81eeb7 100644 --- a/src/Form/Type/RichTextEditorType.php +++ b/src/Form/Type/RichTextEditorType.php @@ -28,7 +28,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class RichTextEditorType extends AbstractType { - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { parent::configureOptions($resolver); // TODO: Change the autogenerated stub @@ -39,7 +39,7 @@ class RichTextEditorType extends AbstractType } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { $view->vars['attr'] = array_merge($view->vars['attr'], $this->optionsToAttrArray($options)); diff --git a/src/Form/Type/ThemeChoiceType.php b/src/Form/Type/ThemeChoiceType.php index c5a45ac4..79e7644b 100644 --- a/src/Form/Type/ThemeChoiceType.php +++ b/src/Form/Type/ThemeChoiceType.php @@ -35,7 +35,7 @@ class ThemeChoiceType extends AbstractType return ChoiceType::class; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'choices' => $this->available_themes, diff --git a/src/Form/Type/UserSelectType.php b/src/Form/Type/UserSelectType.php index a089f66d..cfc501ee 100644 --- a/src/Form/Type/UserSelectType.php +++ b/src/Form/Type/UserSelectType.php @@ -28,7 +28,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class UserSelectType extends AbstractType { - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'class' => User::class, diff --git a/src/Serializer/BigNumberNormalizer.php b/src/Serializer/BigNumberNormalizer.php index 49477725..1f310810 100644 --- a/src/Serializer/BigNumberNormalizer.php +++ b/src/Serializer/BigNumberNormalizer.php @@ -30,7 +30,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class BigNumberNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface { - public function supportsNormalization($data, string $format = null): bool + public function supportsNormalization($data, string $format = null, array $context = []): bool { return $data instanceof BigNumber; } diff --git a/src/Serializer/PartNormalizer.php b/src/Serializer/PartNormalizer.php index 58158cfe..634d6335 100644 --- a/src/Serializer/PartNormalizer.php +++ b/src/Serializer/PartNormalizer.php @@ -51,7 +51,7 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Cach { } - public function supportsNormalization($data, string $format = null): bool + public function supportsNormalization($data, string $format = null, array $context = []): bool { return $data instanceof Part; } @@ -74,7 +74,7 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Cach return $data; } - public function supportsDenormalization($data, string $type, string $format = null): bool + public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool { return is_array($data) && is_a($type, Part::class, true); } diff --git a/src/Serializer/StructuralElementFromNameDenormalizer.php b/src/Serializer/StructuralElementFromNameDenormalizer.php index 662e3afa..c5dbfdf2 100644 --- a/src/Serializer/StructuralElementFromNameDenormalizer.php +++ b/src/Serializer/StructuralElementFromNameDenormalizer.php @@ -35,7 +35,7 @@ class StructuralElementFromNameDenormalizer implements DenormalizerInterface, Ca { } - public function supportsDenormalization($data, string $type, string $format = null): bool + public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool { return is_string($data) && is_subclass_of($type, AbstractStructuralDBElement::class); } diff --git a/src/Serializer/StructuralElementNormalizer.php b/src/Serializer/StructuralElementNormalizer.php index aeae9aae..f71a56d5 100644 --- a/src/Serializer/StructuralElementNormalizer.php +++ b/src/Serializer/StructuralElementNormalizer.php @@ -34,7 +34,7 @@ class StructuralElementNormalizer implements NormalizerInterface, CacheableSuppo { } - public function supportsNormalization($data, string $format = null): bool + public function supportsNormalization($data, string $format = null, array $context = []): bool { return $data instanceof AbstractStructuralDBElement; } diff --git a/src/Twig/LogExtension.php b/src/Twig/LogExtension.php index 8a0be446..dde70e18 100644 --- a/src/Twig/LogExtension.php +++ b/src/Twig/LogExtension.php @@ -33,7 +33,7 @@ final class LogExtension extends AbstractExtension { } - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction('format_log_data', fn($data, AbstractLogEntry $logEntry, string $fieldName): string => $this->logDataFormatter->formatData($data, $logEntry, $fieldName), ['is_safe' => ['html']]), diff --git a/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php b/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php index 03a9b81f..08350f55 100644 --- a/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php +++ b/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php @@ -36,7 +36,7 @@ class ValidProjectBuildRequestValidator extends ConstraintValidator ->setParameter('{{ lot }}', $partLot->getName()); } - public function validate($value, Constraint $constraint) + public function validate($value, Constraint $constraint): void { if (!$constraint instanceof ValidProjectBuildRequest) { throw new UnexpectedTypeException($constraint, ValidProjectBuildRequest::class); diff --git a/tests/DataTables/Filters/CompoundFilterTraitTest.php b/tests/DataTables/Filters/CompoundFilterTraitTest.php index 1249cfa2..e73e639a 100644 --- a/tests/DataTables/Filters/CompoundFilterTraitTest.php +++ b/tests/DataTables/Filters/CompoundFilterTraitTest.php @@ -74,7 +74,7 @@ class CompoundFilterTraitTest extends TestCase 'filter3' => $f3 ], $result); } - + public function testApplyAllChildFilters(): void { $f1 = $this->createMock(FilterInterface::class);