File tree Expand file tree Collapse file tree
rules/TypeDeclaration/NodeAnalyzer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313use PhpParser \Node \VariadicPlaceholder ;
1414use PHPStan \Reflection \ReflectionProvider ;
1515use PHPStan \Type \ArrayType ;
16+ use PHPStan \Type \Constant \ConstantArrayType ;
1617use PHPStan \Type \MixedType ;
18+ use PHPStan \Type \NeverType ;
1719use PHPStan \Type \ObjectType ;
1820use PHPStan \Type \ThisType ;
1921use 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}
You can’t perform that action at this time.
0 commit comments