diff --git a/psalm.xml b/psalm.xml index d923057e..866e06ba 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,5 +1,5 @@ - + @@ -7,6 +7,16 @@ + + + + + + + + + + diff --git a/src/Bridge/Symfony/DependencyInjection/SonataFormExtension.php b/src/Bridge/Symfony/DependencyInjection/SonataFormExtension.php index 465f45f7..89e6cd31 100644 --- a/src/Bridge/Symfony/DependencyInjection/SonataFormExtension.php +++ b/src/Bridge/Symfony/DependencyInjection/SonataFormExtension.php @@ -62,6 +62,8 @@ public function load(array $configs, ContainerBuilder $container): void /** * NEXT_MAJOR: Remove this method. * + * @psalm-suppress DeprecatedClass + * * @param mixed[] $config */ private function configureSerializerFormats(array $config): void diff --git a/src/EventListener/ResizeFormListener.php b/src/EventListener/ResizeFormListener.php index 3b5fa37f..21f6f66f 100644 --- a/src/EventListener/ResizeFormListener.php +++ b/src/EventListener/ResizeFormListener.php @@ -68,9 +68,12 @@ public function preSetData(FormEvent $event): void } // First remove all rows except for the prototype row - // Type cast to string, because Symfony form can returns integer keys + // Type cast to string, because Symfony form can return integer keys + /** + * @psalm-suppress RedundantCastGivenDocblockType -- Remove this and the casting when dropping support of < Symfony 6.2 + */ foreach ($form as $name => $child) { - // @phpstan-ignore-next-line + // @phpstan-ignore-next-line -- Remove this and the casting when dropping support of < Symfony 6.2 $form->remove((string) $name); } @@ -108,9 +111,12 @@ public function preSubmit(FormEvent $event): void } // Remove all empty rows except for the prototype row - // Type cast to string, because Symfony form can returns integer keys + // Type cast to string, because Symfony form can return integer keys + /** + * @psalm-suppress RedundantCastGivenDocblockType -- Remove this and the casting when dropping support of < Symfony 6.2 + */ foreach ($form as $name => $child) { - // @phpstan-ignore-next-line + // @phpstan-ignore-next-line -- Remove this and the casting when dropping support of < Symfony 6.2 $form->remove((string) $name); } @@ -140,6 +146,8 @@ public function preSubmit(FormEvent $event): void } /** + * @psalm-suppress PossibleRawObjectIteration -- https://github.com/vimeo/psalm/issues/9489 + * * @throws UnexpectedTypeException */ public function onSubmit(FormEvent $event): void diff --git a/src/Serializer/BaseSerializerHandler.php b/src/Serializer/BaseSerializerHandler.php index 99d33fcf..56bdd34f 100644 --- a/src/Serializer/BaseSerializerHandler.php +++ b/src/Serializer/BaseSerializerHandler.php @@ -23,6 +23,8 @@ /** * NEXT_MAJOR: Remove this class. * + * @psalm-suppress DeprecatedInterface + * * @deprecated since sonata-project/form-extensions version 1.13 and will be removed in 2.0. * * @author Sylvain Deloux diff --git a/src/Type/BasePickerType.php b/src/Type/BasePickerType.php index 804fbe19..9b0b523a 100644 --- a/src/Type/BasePickerType.php +++ b/src/Type/BasePickerType.php @@ -80,10 +80,7 @@ public function configureOptions(OptionsResolver $resolver): void { $resolver->setNormalizer( 'format', - /** - * @param int|string $format - */ - function (Options $options, $format): string { + function (Options $options, int|string $format): string { if (isset($options['date_format']) && \is_string($options['date_format'])) { return $options['date_format']; } diff --git a/src/Validator/Constraints/InlineConstraint.php b/src/Validator/Constraints/InlineConstraint.php index 79ee9a8f..ca66ef74 100755 --- a/src/Validator/Constraints/InlineConstraint.php +++ b/src/Validator/Constraints/InlineConstraint.php @@ -108,10 +108,7 @@ public function getRequiredOptions(): array ]; } - /** - * @return string|callable - */ - public function getMethod() + public function getMethod(): string|callable { return $this->method; } diff --git a/src/Validator/ErrorElement.php b/src/Validator/ErrorElement.php index 8ffe3473..969e8eba 100755 --- a/src/Validator/ErrorElement.php +++ b/src/Validator/ErrorElement.php @@ -179,6 +179,8 @@ public function getSubject() } /** + * @psalm-suppress RedundantCastGivenDocblockType + * * @param string|array{0?:string, 1?:array, 2?:mixed} $message * @param array $parameters */ @@ -247,6 +249,8 @@ private function getValue() } /** + * @psalm-suppress UnsafeInstantiation -- it is supposed that Constraint constructor is not going to change + * * @param array $options * * @throws \RuntimeException