diff --git a/src/Datagrid/Datagrid.php b/src/Datagrid/Datagrid.php index 95d7ad0c2c..0ffb9eaedb 100644 --- a/src/Datagrid/Datagrid.php +++ b/src/Datagrid/Datagrid.php @@ -154,7 +154,7 @@ public function getValues(): array return $this->values; } - public function setValue(string $name, ?string $operator, $value): void + public function setValue(string $name, ?string $operator, mixed $value): void { $this->values[$name] = [ 'type' => $operator, diff --git a/tests/Admin/AdminTest.php b/tests/Admin/AdminTest.php index 11921ef241..df1a68c10a 100644 --- a/tests/Admin/AdminTest.php +++ b/tests/Admin/AdminTest.php @@ -330,7 +330,7 @@ public function testConfigureWithValidParentAssociationMapping(): void /** * @phpstan-return iterable * - * @psalm-suppress InvalidReturnType, InvalidReturnStatement + * @psalm-suppress MoreSpecificReturnType */ public function provideGetBaseRoutePattern(): iterable { @@ -339,58 +339,72 @@ public function provideGetBaseRoutePattern(): iterable 'Application\Sonata\NewsBundle\Entity\Post', '/sonata/news/post', ]; + // @phpstan-ignore-next-line yield [ 'Application\Sonata\NewsBundle\Document\Post', '/sonata/news/post', ]; + // @phpstan-ignore-next-line yield [ 'MyApplication\MyBundle\Entity\Post', '/myapplication/my/post', ]; + // @phpstan-ignore-next-line yield [ 'MyApplication\MyBundle\Entity\Post\Category', '/myapplication/my/post-category', ]; + // @phpstan-ignore-next-line yield [ 'MyApplication\MyBundle\Entity\Product\Category', '/myapplication/my/product-category', ]; + // @phpstan-ignore-next-line yield [ 'MyApplication\MyBundle\Entity\Other\Product\Category', '/myapplication/my/other-product-category', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Cmf\Bundle\FooBundle\Document\Menu', '/cmf/foo/menu', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Cmf\Bundle\FooBundle\Doctrine\Phpcr\Menu', '/cmf/foo/menu', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Bundle\BarBarBundle\Doctrine\Phpcr\Menu', '/symfony/barbar/menu', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Bundle\BarBarBundle\Doctrine\Phpcr\Menu\Item', '/symfony/barbar/menu-item', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Cmf\Bundle\FooBundle\Doctrine\Orm\Menu', '/cmf/foo/menu', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Cmf\Bundle\FooBundle\Doctrine\MongoDB\Menu', '/cmf/foo/menu', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Cmf\Bundle\FooBundle\Doctrine\CouchDB\Menu', '/cmf/foo/menu', ]; + // @phpstan-ignore-next-line yield [ 'AppBundle\Entity\User', '/app/user', ]; + // @phpstan-ignore-next-line yield [ 'App\Entity\User', '/app/user', @@ -483,7 +497,7 @@ public function testGetBaseRoutePatternWithUnrecognizedClassname(): void /** * @phpstan-return iterable * - * @psalm-suppress InvalidReturnType, InvalidReturnStatement + * @psalm-suppress MoreSpecificReturnType */ public function provideGetBaseRouteName(): iterable { @@ -492,58 +506,72 @@ public function provideGetBaseRouteName(): iterable 'Application\Sonata\NewsBundle\Entity\Post', 'admin_sonata_news_post', ]; + // @phpstan-ignore-next-line yield [ 'Application\Sonata\NewsBundle\Document\Post', 'admin_sonata_news_post', ]; + // @phpstan-ignore-next-line yield [ 'MyApplication\MyBundle\Entity\Post', 'admin_myapplication_my_post', ]; + // @phpstan-ignore-next-line yield [ 'MyApplication\MyBundle\Entity\Post\Category', 'admin_myapplication_my_post_category', ]; + // @phpstan-ignore-next-line yield [ 'MyApplication\MyBundle\Entity\Product\Category', 'admin_myapplication_my_product_category', ]; + // @phpstan-ignore-next-line yield [ 'MyApplication\MyBundle\Entity\Other\Product\Category', 'admin_myapplication_my_other_product_category', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Cmf\Bundle\FooBundle\Document\Menu', 'admin_cmf_foo_menu', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Cmf\Bundle\FooBundle\Doctrine\Phpcr\Menu', 'admin_cmf_foo_menu', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Bundle\BarBarBundle\Doctrine\Phpcr\Menu', 'admin_symfony_barbar_menu', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Bundle\BarBarBundle\Doctrine\Phpcr\Menu\Item', 'admin_symfony_barbar_menu_item', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Cmf\Bundle\FooBundle\Doctrine\Orm\Menu', 'admin_cmf_foo_menu', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Cmf\Bundle\FooBundle\Doctrine\MongoDB\Menu', 'admin_cmf_foo_menu', ]; + // @phpstan-ignore-next-line yield [ 'Symfony\Cmf\Bundle\FooBundle\Doctrine\CouchDB\Menu', 'admin_cmf_foo_menu', ]; + // @phpstan-ignore-next-line yield [ 'AppBundle\Entity\User', 'admin_app_user', ]; + // @phpstan-ignore-next-line yield [ 'App\Entity\User', 'admin_app_user', diff --git a/tests/Admin/BreadcrumbsBuilderTest.php b/tests/Admin/BreadcrumbsBuilderTest.php index 659b92027c..e7521265f6 100644 --- a/tests/Admin/BreadcrumbsBuilderTest.php +++ b/tests/Admin/BreadcrumbsBuilderTest.php @@ -134,7 +134,7 @@ public function testChildGetBreadCrumbs(): void } /** - * @phpstan-return array + * @phpstan-return iterable */ public function provideBuildBreadcrumbsCases(): iterable { diff --git a/tests/Form/DataTransformer/ModelToIdPropertyTransformerTest.php b/tests/Form/DataTransformer/ModelToIdPropertyTransformerTest.php index 16735b6791..3ae9323cd0 100644 --- a/tests/Form/DataTransformer/ModelToIdPropertyTransformerTest.php +++ b/tests/Form/DataTransformer/ModelToIdPropertyTransformerTest.php @@ -160,7 +160,7 @@ public function testReverseTransformMultipleInvalidTypeTests(mixed $params, stri } /** - * @phpstan-return array + * @phpstan-return iterable */ public function provideReverseTransformMultipleInvalidTypeTestsCases(): iterable { diff --git a/tests/Form/DataTransformer/ModelToIdTransformerTest.php b/tests/Form/DataTransformer/ModelToIdTransformerTest.php index 01630144af..44fcecd814 100644 --- a/tests/Form/DataTransformer/ModelToIdTransformerTest.php +++ b/tests/Form/DataTransformer/ModelToIdTransformerTest.php @@ -48,7 +48,7 @@ public function testReverseTransform(int|string $value): void } /** - * @return array + * @return iterable */ public function provideReverseTransformCases(): iterable { diff --git a/tests/Form/DataTransformerResolverTest.php b/tests/Form/DataTransformerResolverTest.php index 1462ad0288..e2616f9c03 100644 --- a/tests/Form/DataTransformerResolverTest.php +++ b/tests/Form/DataTransformerResolverTest.php @@ -55,7 +55,7 @@ public function testFailedResolve(): void } /** - * @phpstan-return array + * @phpstan-return iterable */ public function provideFieldTypes(): iterable { diff --git a/tests/Form/Type/ChoiceFieldMaskTypeTest.php b/tests/Form/Type/ChoiceFieldMaskTypeTest.php index 8d0b4b5f39..14d63280ba 100644 --- a/tests/Form/Type/ChoiceFieldMaskTypeTest.php +++ b/tests/Form/Type/ChoiceFieldMaskTypeTest.php @@ -43,7 +43,7 @@ public function testGetDefaultOptions2(): void } /** - * @phpstan-return array + * @phpstan-return iterable */ public function provideSetAllowedTypesCases(): iterable { diff --git a/tests/Form/Type/ModelTypeTest.php b/tests/Form/Type/ModelTypeTest.php index dcfea86d9e..4debb34af9 100644 --- a/tests/Form/Type/ModelTypeTest.php +++ b/tests/Form/Type/ModelTypeTest.php @@ -110,7 +110,7 @@ public function testCompoundOption(bool $expectedCompound, bool $multiple, bool } /** - * @phpstan-return array + * @phpstan-return iterable */ public function provideCompoundOptionCases(): iterable { diff --git a/tests/Form/Widget/FormSonataNativeCollectionWidgetTest.php b/tests/Form/Widget/FormSonataNativeCollectionWidgetTest.php index 8b90d508ed..612b843d7a 100644 --- a/tests/Form/Widget/FormSonataNativeCollectionWidgetTest.php +++ b/tests/Form/Widget/FormSonataNativeCollectionWidgetTest.php @@ -30,7 +30,7 @@ protected function setUp(): void } /** - * @phpstan-return array}> + * @phpstan-return iterable}> */ public function providePrototypeIsDeletableNoMatterTheShrinkabilityCases(): iterable { diff --git a/tests/Mapper/BaseGroupedMapperTest.php b/tests/Mapper/BaseGroupedMapperTest.php index 3ac9b0a099..478c1e2649 100644 --- a/tests/Mapper/BaseGroupedMapperTest.php +++ b/tests/Mapper/BaseGroupedMapperTest.php @@ -204,7 +204,7 @@ public function testIfEndException(): void } /** - * @phpstan-return array + * @phpstan-return iterable */ public function provideLabelCases(): iterable { diff --git a/tests/Menu/Provider/GroupMenuProviderTest.php b/tests/Menu/Provider/GroupMenuProviderTest.php index 427cc1bf30..c6fd9b208c 100644 --- a/tests/Menu/Provider/GroupMenuProviderTest.php +++ b/tests/Menu/Provider/GroupMenuProviderTest.php @@ -383,7 +383,7 @@ public function testRootMenuItemUrl(string $expectedUrl, array $item): void } /** - * @phpstan-return array + * @phpstan-return iterable */ public function getAdminGroups(): iterable { @@ -426,7 +426,7 @@ public function getAdminGroups(): iterable } /** - * @phpstan-return array + * @phpstan-return iterable */ public function getAdminGroupsMultipleRoles(): iterable { @@ -523,7 +523,7 @@ public function getAdminGroupsMultipleRoles(): iterable } /** - * @phpstan-return array + * @phpstan-return iterable */ public function provideGetMenuProviderWithCheckerGrantedMultipleGroupRolesOnTopCases(): iterable { @@ -590,7 +590,7 @@ public function provideGetMenuProviderWithCheckerGrantedMultipleGroupRolesOnTopC } /** - * @phpstan-return array + * @phpstan-return iterable */ public function provideGetMenuProviderOnTopOptionsCases(): iterable { diff --git a/tests/Route/DefaultRouteGeneratorTest.php b/tests/Route/DefaultRouteGeneratorTest.php index 28fa62c7b7..baf2151ffd 100644 --- a/tests/Route/DefaultRouteGeneratorTest.php +++ b/tests/Route/DefaultRouteGeneratorTest.php @@ -104,7 +104,7 @@ public function testGenerateUrl( } /** - * @phpstan-return array, 3?: int}> + * @phpstan-return iterable, 3?: int}> */ public function provideGenerateUrlCases(): iterable { @@ -223,7 +223,7 @@ public function testGenerateUrlChild(string $type, string $expected, string $nam } /** - * @phpstan-return array}> + * @phpstan-return iterable}> */ public function provideGenerateUrlChildCases(): iterable { @@ -296,7 +296,7 @@ public function testGenerateUrlParentFieldDescription(string $expected, string $ } /** - * @phpstan-return array}> + * @phpstan-return iterable}> */ public function provideGenerateUrlParentFieldDescriptionCases(): iterable { @@ -396,7 +396,7 @@ public function testGenerateUrlLoadCache(string $expected, string $name, array $ } /** - * @phpstan-return array}> + * @phpstan-return iterable}> */ public function provideGenerateUrlLoadCacheCases(): iterable { diff --git a/tests/Security/Acl/Permission/AdminPermissionMapTest.php b/tests/Security/Acl/Permission/AdminPermissionMapTest.php index d23f0f6c3c..a3bf2470a2 100644 --- a/tests/Security/Acl/Permission/AdminPermissionMapTest.php +++ b/tests/Security/Acl/Permission/AdminPermissionMapTest.php @@ -54,7 +54,7 @@ public function testGetMaskReturnsNullIfPermissionIsNotSupported(): void } /** - * @phpstan-return array + * @phpstan-return iterable */ public function provideContainsReturnsABooleanCases(): iterable { diff --git a/tests/Security/Handler/RoleSecurityHandlerTest.php b/tests/Security/Handler/RoleSecurityHandlerTest.php index cdfef2f398..76a0b6e92a 100644 --- a/tests/Security/Handler/RoleSecurityHandlerTest.php +++ b/tests/Security/Handler/RoleSecurityHandlerTest.php @@ -57,7 +57,7 @@ public function testGetBaseRole(string $expected, string $code): void } /** - * @phpstan-return array + * @phpstan-return iterable */ public function provideGetBaseRoleCases(): iterable { @@ -117,7 +117,7 @@ public function testIsGranted( } /** - * @phpstan-return array, 2: string, 3: string|Expression|array, 4?: object|null}> + * @phpstan-return iterable, 2: string, 3: string|Expression|array, 4?: object|null}> */ public function provideIsGrantedCases(): iterable { diff --git a/tests/Translator/NativeLabelTranslatorStrategyTest.php b/tests/Translator/NativeLabelTranslatorStrategyTest.php index 8e8a50f062..597253955c 100644 --- a/tests/Translator/NativeLabelTranslatorStrategyTest.php +++ b/tests/Translator/NativeLabelTranslatorStrategyTest.php @@ -29,7 +29,7 @@ public function testLabel(string $expectedLabel, string $label): void } /** - * @phpstan-return array + * @phpstan-return iterable */ public function provideLabelCases(): iterable { diff --git a/tests/Twig/CanonicalizeRuntimeTest.php b/tests/Twig/CanonicalizeRuntimeTest.php index 7cbe9ae413..4d40051845 100644 --- a/tests/Twig/CanonicalizeRuntimeTest.php +++ b/tests/Twig/CanonicalizeRuntimeTest.php @@ -64,7 +64,7 @@ public function testCanonicalizedLocaleForSelect2(?string $expected, string $ori /** * NEXT_MAJOR: Remove this function. * - * @return array + * @return iterable */ public function provideCanonicalizedLocaleForMomentCases(): iterable { @@ -186,7 +186,7 @@ public function provideCanonicalizedLocaleForMomentCases(): iterable } /** - * @return array + * @return iterable */ public function provideCanonicalizedLocaleForSelect2Cases(): iterable { diff --git a/tests/Twig/Extension/CanonicalizeExtensionTest.php b/tests/Twig/Extension/CanonicalizeExtensionTest.php index 554a1cb63f..70c94294a8 100644 --- a/tests/Twig/Extension/CanonicalizeExtensionTest.php +++ b/tests/Twig/Extension/CanonicalizeExtensionTest.php @@ -70,7 +70,7 @@ public function testCanonicalizedLocaleForSelect2(?string $expected, string $ori } /** - * @return array + * @return iterable */ public function provideCanonicalizedLocaleForMomentCases(): iterable { @@ -192,7 +192,7 @@ public function provideCanonicalizedLocaleForMomentCases(): iterable } /** - * @return array + * @return iterable */ public function provideCanonicalizedLocaleForSelect2Cases(): iterable { diff --git a/tests/Twig/Extension/RenderElementExtensionTest.php b/tests/Twig/Extension/RenderElementExtensionTest.php index 59e86ec9b6..b06fe3fa4f 100644 --- a/tests/Twig/Extension/RenderElementExtensionTest.php +++ b/tests/Twig/Extension/RenderElementExtensionTest.php @@ -523,7 +523,7 @@ public function testRenderRelationElementWithClosure(): void } /** - * @phpstan-return array}> + * @phpstan-return iterable}> */ public function provideRenderListElementCases(): iterable { @@ -1549,7 +1549,7 @@ class="x-editable" } /** - * @phpstan-return array}> + * @phpstan-return iterable}> */ public function provideRenderViewElementCases(): iterable { @@ -2067,7 +2067,7 @@ class="sonata-readmore" } /** - * @phpstan-return array, string|null}> + * @phpstan-return iterable, string|null}> */ public function provideRenderViewElementCompareCases(): iterable { diff --git a/tests/Twig/Extension/XEditableExtensionTest.php b/tests/Twig/Extension/XEditableExtensionTest.php index 2685df1ab6..64c3ae947d 100644 --- a/tests/Twig/Extension/XEditableExtensionTest.php +++ b/tests/Twig/Extension/XEditableExtensionTest.php @@ -53,7 +53,7 @@ public function testGetXEditableChoicesIsIdempotent(array $options, array $expec } /** - * @phpstan-return array, * array * }> diff --git a/tests/Twig/RenderElementRuntimeTest.php b/tests/Twig/RenderElementRuntimeTest.php index 9080bb3cfa..35dc634f11 100644 --- a/tests/Twig/RenderElementRuntimeTest.php +++ b/tests/Twig/RenderElementRuntimeTest.php @@ -488,7 +488,7 @@ public function testRenderRelationElementWithClosure(): void } /** - * @phpstan-return array}> + * @phpstan-return iterable}> */ public function provideRenderListElementCases(): iterable { @@ -1489,7 +1489,7 @@ class="x-editable" } /** - * @phpstan-return array}> + * @phpstan-return iterable}> */ public function provideRenderViewElementCases(): iterable { @@ -1991,7 +1991,7 @@ class="sonata-readmore" } /** - * @phpstan-return array, string|null}> + * @phpstan-return iterable, string|null}> */ public function provideRenderViewElementCompareCases(): iterable { diff --git a/tests/Twig/XEditableRuntimeTest.php b/tests/Twig/XEditableRuntimeTest.php index 1065743894..21562bf729 100644 --- a/tests/Twig/XEditableRuntimeTest.php +++ b/tests/Twig/XEditableRuntimeTest.php @@ -45,9 +45,9 @@ public function testGetXEditableChoicesIsIdempotent(array $options, array $expec } /** - * @phpstan-return array, - * array + * @phpstan-return iterable, + * array * }> */ public function provideGetXEditableChoicesIsIdempotentCases(): iterable