diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php index 872345f986d..af0ce151531 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php @@ -155,7 +155,7 @@ private function processAddArrayReturnType( $node->returnType = new Identifier('array'); // add more precise array type if suitable - if ($returnType->isArray()->yes() && $this->shouldAddReturnArrayDocType($returnType)) { + if ($this->shouldAddReturnArrayDocType($returnType)) { $this->changeReturnType($node, $returnType); } @@ -174,7 +174,7 @@ private function shouldSkip(ClassMethod|Function_|Closure $node, Scope $scope): ); } - private function changeReturnType(ClassMethod|Function_|Closure $node, ArrayType|\PHPStan\Type\Constant\ConstantArrayType $arrayType): void + private function changeReturnType(ClassMethod|Function_|Closure $node, ArrayType|ConstantArrayType $arrayType): void { $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node); @@ -263,7 +263,7 @@ private function matchArrayAssignedVariable(array $stmts): array return $variables; } - private function shouldAddReturnArrayDocType(ArrayType|\PHPStan\Type\Constant\ConstantArrayType $arrayType): bool + private function shouldAddReturnArrayDocType(ArrayType|ConstantArrayType $arrayType): bool { if ($arrayType instanceof ConstantArrayType) { if ($arrayType->getItemType() instanceof NeverType) {