File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
rules-tests/TypeDeclarationDocblocks/Rector/Class_/ClassMethodArrayDocblockParamFromLocalCallsRector/Fixture
rules/TypeDeclaration/NodeAnalyzer Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Rector \Tests \TypeDeclarationDocblocks \Rector \Class_ \ClassMethodArrayDocblockParamFromLocalCallsRector \Fixture ;
4+
5+ final class SkipMixedFromEmptyArray
6+ {
7+ public function execute (array $ data )
8+ {
9+ $ data = [];
10+ $ this ->run ($ data );
11+ }
12+
13+ private function run (array $ data )
14+ {
15+ }
16+ }
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 ;
@@ -222,14 +224,14 @@ private function isEmptyArray(Expr $expr): bool
222224
223225 private function isArrayMixedMixedType (Type $ type ): bool
224226 {
225- if (! $ type instanceof ArrayType) {
227+ if (! $ type instanceof ArrayType && ! $ type instanceof ConstantArrayType ) {
226228 return false ;
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