diff --git a/src/Rules/Functions/MissingFunctionReturnTypehintRule.php b/src/Rules/Functions/MissingFunctionReturnTypehintRule.php index de49bbccde2..0e7a64fee61 100644 --- a/src/Rules/Functions/MissingFunctionReturnTypehintRule.php +++ b/src/Rules/Functions/MissingFunctionReturnTypehintRule.php @@ -88,7 +88,7 @@ public function processNode(Node $node, Scope $scope): array /** * With the fixMissingReturnTypes feature toggle, the errors are fixed with the returned type. * - * @param list $errors + * @param list $errors * @return list */ private function createReturnTypeErrors(FunctionReturnStatementsNode $node, array $errors): array diff --git a/src/Rules/Methods/MissingImplementedMethodReturnTypehintRule.php b/src/Rules/Methods/MissingImplementedMethodReturnTypehintRule.php index cd09a81478c..1abb3bcbff6 100644 --- a/src/Rules/Methods/MissingImplementedMethodReturnTypehintRule.php +++ b/src/Rules/Methods/MissingImplementedMethodReturnTypehintRule.php @@ -94,7 +94,7 @@ public function processNode(Node $node, Scope&CollectedDataEmitter $scope): arra } /** - * @param list $errors + * @param list $errors * @return list */ private function processFixableErrors(MethodReturnStatementsNode $node, Scope&CollectedDataEmitter $scope, array $errors): array @@ -179,7 +179,7 @@ private function processFixableErrors(MethodReturnStatementsNode $node, Scope&Co } /** - * @param array{string, string, string|null} $error + * @param array{string, 'missingType.return'|'missingType.iterableValue', string|null} $error * @return RuleErrorBuilder */ private static function buildError(array $error): RuleErrorBuilder diff --git a/src/Rules/MissingReturnTypeCollector.php b/src/Rules/MissingReturnTypeCollector.php index db8aade6112..b2e8816c186 100644 --- a/src/Rules/MissingReturnTypeCollector.php +++ b/src/Rules/MissingReturnTypeCollector.php @@ -28,7 +28,7 @@ * * Not registered as a collector, the data is emitted by the rules for missing return types. * - * @implements Collector, overridable: bool, returnInfo: array{values: string, void: bool, returnsValue: bool}|null, parentReturnType: string|false|null, parentNativeReturnType: string|false|null, nativeReturnType: string|false|null, fixedNatively: bool, errors: list, file: string, fileDescription: string, line: int, startPos: int, endPos: int}> + * @implements Collector, overridable: bool, returnInfo: array{values: string, void: bool, returnsValue: bool}|null, parentReturnType: string|false|null, parentNativeReturnType: string|false|null, nativeReturnType: string|false|null, fixedNatively: bool, errors: list, file: string, fileDescription: string, line: int, startPos: int, endPos: int}> */ final class MissingReturnTypeCollector implements Collector { diff --git a/src/Rules/MissingReturnTypeFixRule.php b/src/Rules/MissingReturnTypeFixRule.php index 75542c8a81c..9b829ee52bb 100644 --- a/src/Rules/MissingReturnTypeFixRule.php +++ b/src/Rules/MissingReturnTypeFixRule.php @@ -28,7 +28,7 @@ * so that \$this is static. Its return type covers what it returns in all of them, they share one fix. * * @phpstan-import-type ReturnInfo from MissingReturnTypeFixer - * @phpstan-type Record array{key: string, traitMethod: string|null, class: string|null, overrides: list, overridable: bool, returnInfo: array{values: string, void: bool, returnsValue: bool}|null, parentReturnType: string|false|null, parentNativeReturnType: string|false|null, nativeReturnType: string|false|null, fixedNatively: bool, errors: list, file: string, fileDescription: string, line: int, startPos: int, endPos: int} + * @phpstan-type Record array{key: string, traitMethod: string|null, class: string|null, overrides: list, overridable: bool, returnInfo: array{values: string, void: bool, returnsValue: bool}|null, parentReturnType: string|false|null, parentNativeReturnType: string|false|null, nativeReturnType: string|false|null, fixedNatively: bool, errors: list, file: string, fileDescription: string, line: int, startPos: int, endPos: int} * @implements Rule */ #[RegisteredRule(level: 6)] diff --git a/src/Rules/TooWideTypehints/OverridableMemberHelper.php b/src/Rules/TooWideTypehints/OverridableMemberHelper.php index 716e8aa0b78..1c5b8f177e7 100644 --- a/src/Rules/TooWideTypehints/OverridableMemberHelper.php +++ b/src/Rules/TooWideTypehints/OverridableMemberHelper.php @@ -22,6 +22,7 @@ * of the type nobody uses. * * @phpstan-import-type Plan from TooWideReturnTypeFixer + * @phpstan-import-type MemberError from TooWideTypeCheck */ #[AutowiredService] final class OverridableMemberHelper @@ -123,7 +124,7 @@ public function findOverriddenPropertyHooks(ClassReflection $classReflection, st /** * @param self::KIND_* $kind * @param list $usedMembers the members of the type the member uses itself - * @param list $memberErrors message, identifier and tip for each member of the type + * @param list $memberErrors message, identifier and tip for each member of the type * @param string|null $usedMembersTip tip for the errors with %s for the used members, or void * @param list $memberDescriptions the members of the type in $usedMembersTip * @param bool $ownOnly whether only the members the member uses itself are not reported, in an open project @@ -174,7 +175,7 @@ public function emitDeclaration( * emitDeclaration() of the return type of a method, with the plan of its fix. * * @param list $usedMembers - * @param list $memberErrors + * @param list $memberErrors * @param array{plan: Plan, nativeUsed: list, startPos: int, endPos: int}|null $fix */ public function emitReturnTypeDeclaration( diff --git a/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php b/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php index e23b340d95c..fa492c769ac 100644 --- a/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php +++ b/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php @@ -14,6 +14,7 @@ use function sprintf; /** + * @phpstan-import-type MemberError from TooWideTypeCheck * @implements Rule */ #[RegisteredRule(level: 4)] @@ -135,7 +136,7 @@ public function processNode(Node $node, Scope&CollectedDataEmitter $scope): arra } /** - * @param array{list, list} $result + * @param array{list, list} $result */ private function emitDeclaration(MethodReturnStatementsNode $node, Scope&CollectedDataEmitter $scope, array $result, bool $ownOnly): void { diff --git a/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php b/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php index 6a3a5aaf614..3e73a6bcbc9 100644 --- a/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php +++ b/src/Rules/TooWideTypehints/TooWideParameterOutTypeCheck.php @@ -13,6 +13,9 @@ use function lcfirst; use function sprintf; +/** + * @phpstan-import-type MemberError from TooWideTypeCheck + */ #[AutowiredService] final class TooWideParameterOutTypeCheck { @@ -84,7 +87,7 @@ public function check( * @param list $executionEnds * @param list $returnStatements * @param list $parameters - * @return array, list}> + * @return array, list}> */ public function createOverridableErrors( array $executionEnds, diff --git a/src/Rules/TooWideTypehints/TooWideTypeCheck.php b/src/Rules/TooWideTypehints/TooWideTypeCheck.php index 51b66f65947..eb0d7dca56b 100644 --- a/src/Rules/TooWideTypehints/TooWideTypeCheck.php +++ b/src/Rules/TooWideTypehints/TooWideTypeCheck.php @@ -39,6 +39,7 @@ /** * @phpstan-import-type Plan from TooWideReturnTypeFixer + * @phpstan-type MemberError array{string, 'return.tooWideBool'|'return.unusedType'|'paramOut.tooWideBool'|'paramOut.unusedType'|'parameterByRef.tooWideBool'|'parameterByRef.unusedType'|'throws.unusedType', string|null} */ #[AutowiredService] final class TooWideTypeCheck @@ -376,7 +377,7 @@ private function createReturnTypeFix( * reports when neither the method nor the methods overriding it return them: the members the method returns * itself and the error for each member. Null when the method has nothing to report. * - * @return array{list, list}|null + * @return array{list, list}|null */ public function createOverridableReturnTypeErrors( MethodReturnStatementsNode $node, @@ -697,7 +698,7 @@ public function checkParameterOutType( * Like createOverridableReturnTypeErrors(), for the type of a parameter passed by reference after the call. * * @param 'paramOut'|'parameterByRef' $identifierPart - * @return array{list, list}|null + * @return array{list, list}|null */ public function createOverridableParameterOutTypeErrors( Type $parameterOutType, @@ -930,7 +931,7 @@ private function getUsedMembers(Type $declaredType, array $members, Type $actual * * @param list $members * @param 'return'|'paramOut'|'parameterByRef' $identifierPart - * @return list message, identifier, tip + * @return list */ private function createMemberErrors( Type $declaredType, diff --git a/src/Rules/TooWideTypehints/TooWideTypeInOverridableMemberCollector.php b/src/Rules/TooWideTypehints/TooWideTypeInOverridableMemberCollector.php index 446ebccc352..a73345290ff 100644 --- a/src/Rules/TooWideTypehints/TooWideTypeInOverridableMemberCollector.php +++ b/src/Rules/TooWideTypehints/TooWideTypeInOverridableMemberCollector.php @@ -9,10 +9,11 @@ /** * @phpstan-import-type Plan from TooWideReturnTypeFixer + * @phpstan-import-type MemberError from TooWideTypeCheck * * Not registered as a collector, the data is emitted with OverridableMemberHelper::emitDeclaration(). * - * @implements Collector, errors: list, usedMembersTip: string|null, memberDescriptions: list, ownOnly: bool, fix: array{plan: Plan, nativeUsed: list, startPos: int, endPos: int}|null}> + * @implements Collector, errors: list, usedMembersTip: string|null, memberDescriptions: list, ownOnly: bool, fix: array{plan: Plan, nativeUsed: list, startPos: int, endPos: int}|null}> */ final class TooWideTypeInOverridableMemberCollector implements Collector {