Skip to content

Commit c183f3c

Browse files
committed
import
1 parent dcdca6c commit c183f3c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private function processAddArrayReturnType(
155155
$node->returnType = new Identifier('array');
156156

157157
// add more precise array type if suitable
158-
if ($returnType->isArray()->yes() && $this->shouldAddReturnArrayDocType($returnType)) {
158+
if ($this->shouldAddReturnArrayDocType($returnType)) {
159159
$this->changeReturnType($node, $returnType);
160160
}
161161

@@ -174,7 +174,7 @@ private function shouldSkip(ClassMethod|Function_|Closure $node, Scope $scope):
174174
);
175175
}
176176

177-
private function changeReturnType(ClassMethod|Function_|Closure $node, ArrayType|\PHPStan\Type\Constant\ConstantArrayType $arrayType): void
177+
private function changeReturnType(ClassMethod|Function_|Closure $node, ArrayType|ConstantArrayType $arrayType): void
178178
{
179179
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
180180

@@ -263,7 +263,7 @@ private function matchArrayAssignedVariable(array $stmts): array
263263
return $variables;
264264
}
265265

266-
private function shouldAddReturnArrayDocType(ArrayType|\PHPStan\Type\Constant\ConstantArrayType $arrayType): bool
266+
private function shouldAddReturnArrayDocType(ArrayType|ConstantArrayType $arrayType): bool
267267
{
268268
if ($arrayType instanceof ConstantArrayType) {
269269
if ($arrayType->getItemType() instanceof NeverType) {

0 commit comments

Comments
 (0)