diff --git a/rector.php b/rector.php index adc0b834fb9..d8bdd5c82e5 100644 --- a/rector.php +++ b/rector.php @@ -13,6 +13,7 @@ codeQuality: true, codingStyle: true, typeDeclarations: true, + // typeDeclarationDocblocks: true, privatization: true, naming: true, instanceOf: true, diff --git a/rules-tests/CodingStyle/ClassNameImport/ShortNameResolver/ShortNameResolverTest.php b/rules-tests/CodingStyle/ClassNameImport/ShortNameResolver/ShortNameResolverTest.php index 7f74c6535e7..d1e105b9fe9 100644 --- a/rules-tests/CodingStyle/ClassNameImport/ShortNameResolver/ShortNameResolverTest.php +++ b/rules-tests/CodingStyle/ClassNameImport/ShortNameResolver/ShortNameResolverTest.php @@ -37,6 +37,9 @@ public function test(string $filePath, array $expectedShortNames): void $this->assertSame($expectedShortNames, $shortNames); } + /** + * @return Iterator, mixed>> + */ public static function provideData(): Iterator { yield [__DIR__ . '/Fixture/various_imports.php.inc', [ diff --git a/rules-tests/Naming/Naming/PropertyNamingTest.php b/rules-tests/Naming/Naming/PropertyNamingTest.php index c03028e3da8..0d0d1b92ec6 100644 --- a/rules-tests/Naming/Naming/PropertyNamingTest.php +++ b/rules-tests/Naming/Naming/PropertyNamingTest.php @@ -57,6 +57,9 @@ public function testPropertyName(string $objectName, string $expectedVariableNam $this->assertSame($expectedVariableName, $variableName); } + /** + * @return Iterator> + */ public static function provideDataPropertyName(): Iterator { yield ['SomeVariable', 'someVariable']; diff --git a/rules/Assert/Rector/ClassMethod/AddAssertArrayFromClassMethodDocblockRector.php b/rules/Assert/Rector/ClassMethod/AddAssertArrayFromClassMethodDocblockRector.php index 34d769278b4..2239c0bb3be 100644 --- a/rules/Assert/Rector/ClassMethod/AddAssertArrayFromClassMethodDocblockRector.php +++ b/rules/Assert/Rector/ClassMethod/AddAssertArrayFromClassMethodDocblockRector.php @@ -93,6 +93,9 @@ public function run(array $items) ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [ClassMethod::class]; diff --git a/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php b/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php index 3e4729ca744..c5da1a0998e 100644 --- a/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php +++ b/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php @@ -54,6 +54,7 @@ public function getRuleDefinition(): RuleDefinition /** * @innerForeachReturn array> + * @return array> */ public function getNodeTypes(): array { diff --git a/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php b/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php index 60fc781ca21..0f9714edbac 100644 --- a/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php +++ b/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php @@ -46,6 +46,9 @@ public function __construct( ) { } + /** + * @param array $configuration + */ public function configure(array $configuration): void { $this->onlyDirectAssign = $configuration[self::ONLY_DIRECT_ASSIGN] ?? false; diff --git a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php index 4d4081c1a64..656d159e88a 100644 --- a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php +++ b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php @@ -55,6 +55,9 @@ final class EncapsedStringsToSprintfRector extends AbstractRector implements Con */ private array $argumentVariables = []; + /** + * @param array $configuration + */ public function configure(array $configuration): void { $this->always = $configuration[self::ALWAYS] ?? false; diff --git a/rules/DeadCode/Rector/ClassLike/RemoveTypedPropertyNonMockDocblockRector.php b/rules/DeadCode/Rector/ClassLike/RemoveTypedPropertyNonMockDocblockRector.php index d9659ee557c..480597780bb 100644 --- a/rules/DeadCode/Rector/ClassLike/RemoveTypedPropertyNonMockDocblockRector.php +++ b/rules/DeadCode/Rector/ClassLike/RemoveTypedPropertyNonMockDocblockRector.php @@ -68,6 +68,9 @@ final class SomeTest extends TestCase ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [Class_::class]; diff --git a/rules/DeadCode/Rector/FuncCall/RemoveFilterVarOnExactTypeRector.php b/rules/DeadCode/Rector/FuncCall/RemoveFilterVarOnExactTypeRector.php index e646656e6e8..1032bb752d1 100644 --- a/rules/DeadCode/Rector/FuncCall/RemoveFilterVarOnExactTypeRector.php +++ b/rules/DeadCode/Rector/FuncCall/RemoveFilterVarOnExactTypeRector.php @@ -38,6 +38,9 @@ function (int $value) { ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [FuncCall::class]; diff --git a/rules/NetteUtils/Rector/StaticCall/UtilsJsonStaticCallNamedArgRector.php b/rules/NetteUtils/Rector/StaticCall/UtilsJsonStaticCallNamedArgRector.php index ef5aade25d6..43d56a49d82 100644 --- a/rules/NetteUtils/Rector/StaticCall/UtilsJsonStaticCallNamedArgRector.php +++ b/rules/NetteUtils/Rector/StaticCall/UtilsJsonStaticCallNamedArgRector.php @@ -40,6 +40,9 @@ public function getRuleDefinition(): RuleDefinition ]); } + /** + * @return array> + */ public function getNodeTypes(): array { return [StaticCall::class]; diff --git a/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php b/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php index 89cf185b7dd..cb68fc734b6 100644 --- a/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php +++ b/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php @@ -137,6 +137,9 @@ public function __construct( ); } + /** + * @param array $configuration + */ public function configure(array $configuration): void { $this->inlinePublic = $configuration[self::INLINE_PUBLIC] ?? false; diff --git a/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php b/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php index c12253ce959..8730806fb8b 100644 --- a/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php +++ b/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php @@ -42,6 +42,9 @@ public function getRuleDefinition(): RuleDefinition ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [New_::class]; diff --git a/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php b/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php index fd39705fbdb..cc789c8b237 100644 --- a/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php +++ b/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php @@ -44,6 +44,9 @@ public function configure(array $configuration): void $this->sensitiveParameters = (array) ($configuration[self::SENSITIVE_PARAMETERS] ?? []); } + /** + * @return array> + */ public function getNodeTypes(): array { return [Param::class]; diff --git a/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php b/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php index e6ada69f31f..7db0bbc4c7e 100644 --- a/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php +++ b/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php @@ -63,6 +63,9 @@ final class SomeClass ]); } + /** + * @return array> + */ public function getNodeTypes(): array { return [Class_::class]; diff --git a/rules/Php83/Rector/FuncCall/DynamicClassConstFetchRector.php b/rules/Php83/Rector/FuncCall/DynamicClassConstFetchRector.php index d21960dde7b..765e590a7d8 100644 --- a/rules/Php83/Rector/FuncCall/DynamicClassConstFetchRector.php +++ b/rules/Php83/Rector/FuncCall/DynamicClassConstFetchRector.php @@ -41,6 +41,9 @@ public function getRuleDefinition(): RuleDefinition ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [FuncCall::class]; diff --git a/rules/Php84/Rector/FuncCall/RoundingModeEnumRector.php b/rules/Php84/Rector/FuncCall/RoundingModeEnumRector.php index 40df90da2e6..c0e32e79748 100644 --- a/rules/Php84/Rector/FuncCall/RoundingModeEnumRector.php +++ b/rules/Php84/Rector/FuncCall/RoundingModeEnumRector.php @@ -36,6 +36,9 @@ public function getRuleDefinition(): RuleDefinition ]); } + /** + * @return array> + */ public function getNodeTypes(): array { return [FuncCall::class]; diff --git a/rules/Php84/Rector/Param/ExplicitNullableParamTypeRector.php b/rules/Php84/Rector/Param/ExplicitNullableParamTypeRector.php index f85b909e68b..cda773e50c6 100644 --- a/rules/Php84/Rector/Param/ExplicitNullableParamTypeRector.php +++ b/rules/Php84/Rector/Param/ExplicitNullableParamTypeRector.php @@ -50,6 +50,9 @@ function foo(?string $param = null) {} ]); } + /** + * @return array> + */ public function getNodeTypes(): array { return [Param::class]; diff --git a/rules/Php85/Rector/Const_/DeprecatedAnnotationToDeprecatedAttributeRector.php b/rules/Php85/Rector/Const_/DeprecatedAnnotationToDeprecatedAttributeRector.php index 153aced3225..5f1c0034b40 100644 --- a/rules/Php85/Rector/Const_/DeprecatedAnnotationToDeprecatedAttributeRector.php +++ b/rules/Php85/Rector/Const_/DeprecatedAnnotationToDeprecatedAttributeRector.php @@ -42,6 +42,9 @@ public function getRuleDefinition(): RuleDefinition ]); } + /** + * @return array> + */ public function getNodeTypes(): array { return [Const_::class]; diff --git a/rules/Php85/Rector/FuncCall/ArrayKeyExistsNullToEmptyStringRector.php b/rules/Php85/Rector/FuncCall/ArrayKeyExistsNullToEmptyStringRector.php index 9618aa6afed..ecacd704877 100644 --- a/rules/Php85/Rector/FuncCall/ArrayKeyExistsNullToEmptyStringRector.php +++ b/rules/Php85/Rector/FuncCall/ArrayKeyExistsNullToEmptyStringRector.php @@ -51,6 +51,9 @@ public function getRuleDefinition(): RuleDefinition ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [FuncCall::class]; diff --git a/rules/Php85/Rector/FuncCall/ChrArgModuloRector.php b/rules/Php85/Rector/FuncCall/ChrArgModuloRector.php index 73af63c27ab..6b2838dc08b 100644 --- a/rules/Php85/Rector/FuncCall/ChrArgModuloRector.php +++ b/rules/Php85/Rector/FuncCall/ChrArgModuloRector.php @@ -45,6 +45,9 @@ public function getRuleDefinition(): RuleDefinition ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [FuncCall::class]; diff --git a/rules/Php85/Rector/FuncCall/OrdSingleByteRector.php b/rules/Php85/Rector/FuncCall/OrdSingleByteRector.php index d1219b039b6..b10d6fc7e3e 100644 --- a/rules/Php85/Rector/FuncCall/OrdSingleByteRector.php +++ b/rules/Php85/Rector/FuncCall/OrdSingleByteRector.php @@ -46,6 +46,9 @@ public function getRuleDefinition(): RuleDefinition ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [FuncCall::class]; diff --git a/rules/Php85/Rector/Switch_/ColonAfterSwitchCaseRector.php b/rules/Php85/Rector/Switch_/ColonAfterSwitchCaseRector.php index 910f961640e..ad748673508 100644 --- a/rules/Php85/Rector/Switch_/ColonAfterSwitchCaseRector.php +++ b/rules/Php85/Rector/Switch_/ColonAfterSwitchCaseRector.php @@ -39,6 +39,9 @@ public function getRuleDefinition(): RuleDefinition ]); } + /** + * @return array> + */ public function getNodeTypes(): array { return [Switch_::class]; diff --git a/rules/Transform/Rector/ConstFetch/ConstFetchToClassConstFetchRector.php b/rules/Transform/Rector/ConstFetch/ConstFetchToClassConstFetchRector.php index 7a6f3ab1e2e..f237aa27276 100644 --- a/rules/Transform/Rector/ConstFetch/ConstFetchToClassConstFetchRector.php +++ b/rules/Transform/Rector/ConstFetch/ConstFetchToClassConstFetchRector.php @@ -33,6 +33,9 @@ public function getRuleDefinition(): RuleDefinition ]); } + /** + * @return array> + */ public function getNodeTypes(): array { return [ConstFetch::class]; diff --git a/rules/Transform/Rector/MethodCall/MethodCallToNewRector.php b/rules/Transform/Rector/MethodCall/MethodCallToNewRector.php index f5d90809dfc..db3439f35a0 100644 --- a/rules/Transform/Rector/MethodCall/MethodCallToNewRector.php +++ b/rules/Transform/Rector/MethodCall/MethodCallToNewRector.php @@ -53,6 +53,9 @@ public function getRuleDefinition(): RuleDefinition ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [MethodCall::class]; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromMockObjectRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromMockObjectRector.php index 5bcfa0f3f0d..e2a66e48f7c 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromMockObjectRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromMockObjectRector.php @@ -66,6 +66,9 @@ public function createSomeMock(): \PHPUnit\Framework\MockObject\MockObject ]); } + /** + * @return array> + */ public function getNodeTypes(): array { return [ClassMethod::class]; diff --git a/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromCreateMockAssignRector.php b/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromCreateMockAssignRector.php index ff03419ece2..706f27e9eca 100644 --- a/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromCreateMockAssignRector.php +++ b/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromCreateMockAssignRector.php @@ -74,6 +74,9 @@ protected function setUp(): void ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [Class_::class]; diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php index eb36169dd42..021a038a820 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php @@ -59,6 +59,9 @@ public function getRuleDefinition(): RuleDefinition ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [FuncCall::class]; diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayReduceRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayReduceRector.php index 79618dc920e..ae1855ed346 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayReduceRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayReduceRector.php @@ -58,6 +58,9 @@ public function getRuleDefinition(): RuleDefinition ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [FuncCall::class]; diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromIterableMethodCallRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromIterableMethodCallRector.php index 6f54f3fe03d..f6d76ad2192 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromIterableMethodCallRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromIterableMethodCallRector.php @@ -80,6 +80,9 @@ public function run(Collection $collection) ); } + /** + * @return array> + */ public function getNodeTypes(): array { return [MethodCall::class]; diff --git a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php index 2f27b7e950e..7d670e0c6a1 100644 --- a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php +++ b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php @@ -68,6 +68,9 @@ public function __construct( ) { } + /** + * @param array $configuration + */ public function configure(array $configuration): void { $this->inlinePublic = $configuration[self::INLINE_PUBLIC] ?? (bool) current($configuration); diff --git a/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php b/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php index 2dd904e0477..23a79200535 100644 --- a/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php +++ b/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php @@ -121,6 +121,9 @@ public function refactor(Node $node): ?Node return null; } + /** + * @param array $configuration + */ public function configure(array $configuration): void { Assert::keyExists($configuration, self::LIMIT); diff --git a/rules/TypeDeclarationDocblocks/Rector/ClassMethod/DocblockGetterReturnArrayFromPropertyDocblockVarRector.php b/rules/TypeDeclarationDocblocks/Rector/ClassMethod/DocblockGetterReturnArrayFromPropertyDocblockVarRector.php index 753aca29bab..d7da0b4b712 100644 --- a/rules/TypeDeclarationDocblocks/Rector/ClassMethod/DocblockGetterReturnArrayFromPropertyDocblockVarRector.php +++ b/rules/TypeDeclarationDocblocks/Rector/ClassMethod/DocblockGetterReturnArrayFromPropertyDocblockVarRector.php @@ -32,6 +32,9 @@ public function __construct( ) { } + /** + * @return array> + */ public function getNodeTypes(): array { return [ClassMethod::class]; diff --git a/rules/TypeDeclarationDocblocks/Rector/Class_/AddReturnDocblockDataProviderRector.php b/rules/TypeDeclarationDocblocks/Rector/Class_/AddReturnDocblockDataProviderRector.php index 72672677702..1791ef437b8 100644 --- a/rules/TypeDeclarationDocblocks/Rector/Class_/AddReturnDocblockDataProviderRector.php +++ b/rules/TypeDeclarationDocblocks/Rector/Class_/AddReturnDocblockDataProviderRector.php @@ -37,6 +37,9 @@ public function __construct( ) { } + /** + * @return array> + */ public function getNodeTypes(): array { return [Class_::class]; diff --git a/rules/TypeDeclarationDocblocks/Rector/Class_/ClassMethodArrayDocblockParamFromLocalCallsRector.php b/rules/TypeDeclarationDocblocks/Rector/Class_/ClassMethodArrayDocblockParamFromLocalCallsRector.php index 36408389a68..9a6117df1c9 100644 --- a/rules/TypeDeclarationDocblocks/Rector/Class_/ClassMethodArrayDocblockParamFromLocalCallsRector.php +++ b/rules/TypeDeclarationDocblocks/Rector/Class_/ClassMethodArrayDocblockParamFromLocalCallsRector.php @@ -33,6 +33,9 @@ public function __construct( ) { } + /** + * @return array> + */ public function getNodeTypes(): array { return [Class_::class]; diff --git a/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromGetterReturnRector.php b/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromGetterReturnRector.php index ccad236cbbb..3d47d0c18e7 100644 --- a/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromGetterReturnRector.php +++ b/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromGetterReturnRector.php @@ -29,6 +29,9 @@ public function __construct( ) { } + /** + * @return array> + */ public function getNodeTypes(): array { return [Class_::class]; diff --git a/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromPropertyDefaultsRector.php b/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromPropertyDefaultsRector.php index aecb4d1d20b..fd98a05003b 100644 --- a/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromPropertyDefaultsRector.php +++ b/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromPropertyDefaultsRector.php @@ -26,6 +26,9 @@ public function __construct( ) { } + /** + * @return array> + */ public function getNodeTypes(): array { return [Class_::class]; diff --git a/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarFromParamDocblockInConstructorRector.php b/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarFromParamDocblockInConstructorRector.php index 2ca43d1c4c6..f59e87dcb4d 100644 --- a/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarFromParamDocblockInConstructorRector.php +++ b/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarFromParamDocblockInConstructorRector.php @@ -30,6 +30,9 @@ public function __construct( ) { } + /** + * @return array> + */ public function getNodeTypes(): array { return [Class_::class]; diff --git a/src/Util/RectorClassesSorter.php b/src/Util/RectorClassesSorter.php index 2c995360f8c..badf9835a43 100644 --- a/src/Util/RectorClassesSorter.php +++ b/src/Util/RectorClassesSorter.php @@ -14,7 +14,7 @@ final class RectorClassesSorter { /** * @param array> $rectorClasses - * @return array> + * @return array> */ public static function sortAndFilterOutPostRectors(array $rectorClasses): array { diff --git a/tests/BetterPhpDocParser/PhpDocInfo/PhpDocInfoPrinter/DoctrineTest.php b/tests/BetterPhpDocParser/PhpDocInfo/PhpDocInfoPrinter/DoctrineTest.php index ec6a6a2551f..aacecb90d2a 100644 --- a/tests/BetterPhpDocParser/PhpDocInfo/PhpDocInfoPrinter/DoctrineTest.php +++ b/tests/BetterPhpDocParser/PhpDocInfo/PhpDocInfoPrinter/DoctrineTest.php @@ -26,6 +26,9 @@ public function testClass(string $docFilePath, string $className): void $this->assertSame($docComment, $printedPhpDocInfo); } + /** + * @return Iterator, mixed>> + */ public static function provideDataClass(): Iterator { yield [__DIR__ . '/Source/Doctrine/index_in_table.txt', IndexInTable::class]; diff --git a/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParserTest.php b/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParserTest.php index 21b82e50c8a..bb3cbe47a77 100644 --- a/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParserTest.php +++ b/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParserTest.php @@ -41,6 +41,9 @@ public function test(string $docContent, array $expectedArrayItemNodes): void $this->assertEquals($expectedArrayItemNodes, $arrayItemNodes); } + /** + * @return Iterator|string)>> + */ public static function provideData(): Iterator { yield ['{key: "value"}', [new ArrayItemNode(new StringNode('value'), 'key')]]; diff --git a/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/StaticDoctrineAnnotationParserTest.php b/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/StaticDoctrineAnnotationParserTest.php index a0772f6f583..fd7c40b3f7c 100644 --- a/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/StaticDoctrineAnnotationParserTest.php +++ b/tests/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/StaticDoctrineAnnotationParserTest.php @@ -43,6 +43,9 @@ public function test(string $docContent, CurlyListNode | array $expectedValue): $this->assertEquals($expectedValue, $value); } + /** + * @return Iterator, mixed>> + */ public static function provideData(): Iterator { $curlyListNode = new CurlyListNode([ diff --git a/tests/FileSystem/FilePathHelperTest.php b/tests/FileSystem/FilePathHelperTest.php index 6b519429f3c..1fc3431a7de 100644 --- a/tests/FileSystem/FilePathHelperTest.php +++ b/tests/FileSystem/FilePathHelperTest.php @@ -26,6 +26,9 @@ public function test(string $inputPath, string $expectedNormalizedPath): void $this->assertSame($expectedNormalizedPath, $normalizedPath); } + /** + * @return Iterator> + */ public static function provideData(): Iterator { // based on Linux diff --git a/tests/Naming/ExpectedNameResolver/InflectorSingularResolverTest.php b/tests/Naming/ExpectedNameResolver/InflectorSingularResolverTest.php index 8326dfabed2..b3410dff31e 100644 --- a/tests/Naming/ExpectedNameResolver/InflectorSingularResolverTest.php +++ b/tests/Naming/ExpectedNameResolver/InflectorSingularResolverTest.php @@ -27,6 +27,9 @@ public function testResolveForForeach(string $currentName, string $expectedSingu $this->assertSame($expectedSingularName, $singularValue); } + /** + * @return Iterator> + */ public static function provideData(): Iterator { yield ['psr4NamespacesToPaths', 'psr4NamespaceToPath']; diff --git a/tests/NodeTypeResolver/PerNodeTypeResolver/ParamTypeResolver/ParamTypeResolverTest.php b/tests/NodeTypeResolver/PerNodeTypeResolver/ParamTypeResolver/ParamTypeResolverTest.php index 66cef73a2b8..7eb73a23fbe 100644 --- a/tests/NodeTypeResolver/PerNodeTypeResolver/ParamTypeResolver/ParamTypeResolverTest.php +++ b/tests/NodeTypeResolver/PerNodeTypeResolver/ParamTypeResolver/ParamTypeResolverTest.php @@ -25,6 +25,9 @@ public function test(string $file, int $nodePosition, string $expectedType): voi $this->assertSame($resolvedType::class, $expectedType); } + /** + * @return Iterator, mixed>> + */ public static function provideData(): Iterator { yield [__DIR__ . '/Source/MethodParamTypeHint.php', 0, FullyQualifiedObjectType::class]; diff --git a/tests/NodeTypeResolver/PerNodeTypeResolver/PropertyTypeResolver/PropertyTypeResolverTest.php b/tests/NodeTypeResolver/PerNodeTypeResolver/PropertyTypeResolver/PropertyTypeResolverTest.php index 607e93889cf..55a3072d36c 100644 --- a/tests/NodeTypeResolver/PerNodeTypeResolver/PropertyTypeResolver/PropertyTypeResolverTest.php +++ b/tests/NodeTypeResolver/PerNodeTypeResolver/PropertyTypeResolver/PropertyTypeResolverTest.php @@ -41,6 +41,9 @@ public function test(string $file, int $nodePosition, Type $expectedType): void $this->assertSame($expectedTypeAsString, $resolvedTypeAsString); } + /** + * @return Iterator> + */ public static function provideData(): Iterator { yield [__DIR__ . '/Source/MethodParamDocBlock.php', 0, new ObjectType(Html::class)]; diff --git a/tests/NodeTypeResolver/PerNodeTypeResolver/VariableTypeResolver/VariableTypeResolverTest.php b/tests/NodeTypeResolver/PerNodeTypeResolver/VariableTypeResolver/VariableTypeResolverTest.php index b2b24215b7b..1d9e6ff5356 100644 --- a/tests/NodeTypeResolver/PerNodeTypeResolver/VariableTypeResolver/VariableTypeResolverTest.php +++ b/tests/NodeTypeResolver/PerNodeTypeResolver/VariableTypeResolver/VariableTypeResolverTest.php @@ -29,6 +29,9 @@ public function test(string $file, int $nodePosition, TypeWithClassName $expecte $this->assertSame($expectedTypeWithClassName->getClassName(), $resolvedType->getClassName()); } + /** + * @return Iterator> + */ public static function provideData(): Iterator { $anotherTypeObjectType = new ObjectType(AnotherType::class); diff --git a/tests/NodeTypeResolver/StaticTypeMapper/StaticTypeMapperTest.php b/tests/NodeTypeResolver/StaticTypeMapper/StaticTypeMapperTest.php index f42e35b53af..9b48149da29 100644 --- a/tests/NodeTypeResolver/StaticTypeMapper/StaticTypeMapperTest.php +++ b/tests/NodeTypeResolver/StaticTypeMapper/StaticTypeMapperTest.php @@ -44,6 +44,9 @@ public function testMapPHPStanPhpDocTypeNodeToPHPStanType(TypeNode $typeNode, st $this->assertInstanceOf($expectedType, $phpStanType); } + /** + * @return Iterator, mixed>> + */ public static function provideData(): Iterator { $genericTypeNode = new GenericTypeNode(new IdentifierTypeNode('Traversable'), []); @@ -85,6 +88,9 @@ public function testMapPhpParserNodePHPStanType(Node $node, string $expectedType $this->assertInstanceOf($expectedType, $phpStanType); } + /** + * @return Iterator|Identifier)>> + */ public static function provideDataForMapPhpParserNodePHPStanType(): Iterator { yield [new Identifier('iterable'), IterableType::class]; diff --git a/tests/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapperTest.php b/tests/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapperTest.php index 7273088aa2e..32226689504 100644 --- a/tests/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapperTest.php +++ b/tests/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapperTest.php @@ -53,6 +53,9 @@ public static function provideDataWithoutKeys(): Iterator yield [$arrayType, 'string[]']; } + /** + * @return Iterator> + */ public static function provideDataUnionedWithoutKeys(): Iterator { $stringAndIntegerUnionType = new UnionType([new StringType(), new IntegerType()]); @@ -66,6 +69,9 @@ public static function provideDataUnionedWithoutKeys(): Iterator yield [$evenMoreNestedUnionArrayType, 'string[][][]|int[][][]']; } + /** + * @return Iterator> + */ public static function provideDataWithKeys(): Iterator { $arrayMixedToStringType = new ArrayType(new MixedType(), new StringType()); diff --git a/tests/PhpAttribute/AnnotationToAttributeMapper/AnnotationToAttributeMapperTest.php b/tests/PhpAttribute/AnnotationToAttributeMapper/AnnotationToAttributeMapperTest.php index fdd202455e0..387002ee8fc 100644 --- a/tests/PhpAttribute/AnnotationToAttributeMapper/AnnotationToAttributeMapperTest.php +++ b/tests/PhpAttribute/AnnotationToAttributeMapper/AnnotationToAttributeMapperTest.php @@ -42,6 +42,9 @@ public function test(mixed $input, string $expectedTypeClass): void } } + /** + * @return Iterator, mixed>> + */ public static function provideData(): Iterator { yield [false, ConstFetch::class]; diff --git a/tests/PhpAttribute/UseAliasNameMatcherTest.php b/tests/PhpAttribute/UseAliasNameMatcherTest.php index d503e83ad2b..cdf15e3f348 100644 --- a/tests/PhpAttribute/UseAliasNameMatcherTest.php +++ b/tests/PhpAttribute/UseAliasNameMatcherTest.php @@ -56,6 +56,9 @@ public function test( $this->assertSame($expectedAttributeUseImportName, $useAliasMetadata->getUseImportName()); } + /** + * @return Iterator> + */ public static function provideData(): Iterator { yield [ diff --git a/tests/PhpParser/Printer/BetterStandardPrinterTest.php b/tests/PhpParser/Printer/BetterStandardPrinterTest.php index 23f77522932..4a75bc516a3 100644 --- a/tests/PhpParser/Printer/BetterStandardPrinterTest.php +++ b/tests/PhpParser/Printer/BetterStandardPrinterTest.php @@ -80,6 +80,9 @@ public function testYield(Node $node, string $expectedPrintedNode): void $this->assertSame($expectedPrintedNode, $printedNode); } + /** + * @return Iterator> + */ public static function provideDataForYield(): Iterator { $yield = new Yield_(new String_('value')); diff --git a/tests/Set/SetManager/SetManagerTest.php b/tests/Set/SetManager/SetManagerTest.php index 41b557e5426..f396b282c0d 100644 --- a/tests/Set/SetManager/SetManagerTest.php +++ b/tests/Set/SetManager/SetManagerTest.php @@ -37,6 +37,9 @@ public function testByVersion(string $projectDirectory, array $expectedSets): vo $this->assertSame($expectedSets, $composerTriggeredSets); } + /** + * @return Iterator<(array>|array>|array>|array)> + */ public static function provideInstalledTwigData(): Iterator { // here we cannot used features coming up in 2.4, as we only have 2.0 diff --git a/tests/Skipper/FileSystem/FnMatchPathNormalizerTest.php b/tests/Skipper/FileSystem/FnMatchPathNormalizerTest.php index 93333115772..1e176a58ae2 100644 --- a/tests/Skipper/FileSystem/FnMatchPathNormalizerTest.php +++ b/tests/Skipper/FileSystem/FnMatchPathNormalizerTest.php @@ -28,6 +28,9 @@ public function testPaths(string $path, string $expectedNormalizedPath): void $this->assertSame($expectedNormalizedPath, $normalizedPath); } + /** + * @return Iterator> + */ public static function providePaths(): Iterator { yield ['path/with/no/asterisk', 'path/with/no/asterisk']; diff --git a/tests/Skipper/Skipper/SkipperTest.php b/tests/Skipper/Skipper/SkipperTest.php index fb532352058..33dda0fd5a8 100644 --- a/tests/Skipper/Skipper/SkipperTest.php +++ b/tests/Skipper/Skipper/SkipperTest.php @@ -86,6 +86,9 @@ public function testSkipElementAndFilePath(string $element, string $filePath, bo $this->assertSame($expectedSkip, $resolvedSkip); } + /** + * @return Iterator, mixed>> + */ public static function provideCheckerAndFile(): Iterator { yield [FifthElement::class, __DIR__ . '/Fixture', true]; @@ -97,6 +100,9 @@ public static function provideCheckerAndFile(): Iterator yield [NotSkippedClass::class, __DIR__ . '/Fixture/someOtherFile', false]; } + /** + * @return Iterator, mixed>> + */ public static function provideDataShouldSkipElement(): Iterator { yield [ThreeMan::class, false]; diff --git a/tests/Util/Reflection/PrivatesAccessorTest.php b/tests/Util/Reflection/PrivatesAccessorTest.php index 4057b453edc..418fa7fbb04 100644 --- a/tests/Util/Reflection/PrivatesAccessorTest.php +++ b/tests/Util/Reflection/PrivatesAccessorTest.php @@ -36,6 +36,9 @@ public function test( $this->assertSame($expectedResult, $result); } + /** + * @return Iterator, mixed>> + */ public static function provideData(): Iterator { yield [SomeClassWithPrivateMethods::class, 'getNumber', [], 5]; diff --git a/tests/Validation/RectorAssertTest.php b/tests/Validation/RectorAssertTest.php index f36987c2c6a..78272b4e867 100644 --- a/tests/Validation/RectorAssertTest.php +++ b/tests/Validation/RectorAssertTest.php @@ -89,6 +89,9 @@ public function testInvalidFunctionName(string $functionName): void RectorAssert::functionName($functionName); } + /** + * @return Iterator> + */ public static function provideDataInvalidFunctionNames(): Iterator { yield ['35']; diff --git a/utils/Rector/MoveAbstractRectorToChildrenRector.php b/utils/Rector/MoveAbstractRectorToChildrenRector.php index afab8824573..99c69671c38 100644 --- a/utils/Rector/MoveAbstractRectorToChildrenRector.php +++ b/utils/Rector/MoveAbstractRectorToChildrenRector.php @@ -41,6 +41,9 @@ public function getRuleDefinition(): RuleDefinition return new RuleDefinition('Move parent class autowired dependency to constructor of children', []); } + /** + * @return array> + */ public function getNodeTypes(): array { return [Class_::class];