Skip to content

Commit 30d9791

Browse files
committed
Fix
1 parent 70934be commit 30d9791

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
use PhpParser\Node\VariadicPlaceholder;
1414
use PHPStan\Reflection\ReflectionProvider;
1515
use PHPStan\Type\ArrayType;
16+
use PHPStan\Type\Constant\ConstantArrayType;
1617
use PHPStan\Type\MixedType;
18+
use PHPStan\Type\NeverType;
1719
use PHPStan\Type\ObjectType;
1820
use PHPStan\Type\ThisType;
1921
use PHPStan\Type\Type;
@@ -223,13 +225,13 @@ private function isEmptyArray(Expr $expr): bool
223225
private function isArrayMixedMixedType(Type $type): bool
224226
{
225227
if (! $type instanceof ArrayType) {
226-
return false;
228+
return $type instanceof ConstantArrayType && $type->getIterableKeyType() instanceof NeverType;
227229
}
228230

229-
if (! $type->getItemType() instanceof MixedType) {
231+
if (! $type->getItemType() instanceof MixedType && ! $type->getItemType() instanceof NeverType) {
230232
return false;
231233
}
232234

233-
return $type->getKeyType() instanceof MixedType;
235+
return $type->getKeyType() instanceof MixedType || $type->getKeyType() instanceof NeverType;
234236
}
235237
}

0 commit comments

Comments
 (0)