File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
rules-tests/TypeDeclarationDocblocks/Rector/Class_/ClassMethodArrayDocblockParamFromLocalCallsRector/Fixture
rules/TypeDeclaration/NodeAnalyzer Expand file tree Collapse file tree 2 files changed +27
-0
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 SkipMixedArrayFromGetter
6+ {
7+ public function getter (): ?array
8+ {
9+ }
10+
11+ public function fromGetter ()
12+ {
13+ $ this ->run ($ this ->getter ());
14+ }
15+
16+ private function run (array $ p )
17+ {
18+ }
19+ }
Original file line number Diff line number Diff line change @@ -228,6 +228,14 @@ private function isEmptyArray(Expr $expr): bool
228228 private function isArrayMixedMixedType (Type $ type ): bool
229229 {
230230 if (! $ type instanceof ArrayType) {
231+ if ($ type instanceof UnionType) {
232+ foreach ($ type ->getTypes () as $ subType ) {
233+ if ($ subType instanceof ArrayType && $ this ->isArrayMixedMixedType ($ subType )) {
234+ return true ;
235+ }
236+ }
237+ }
238+
231239 return false ;
232240 }
233241
You can’t perform that action at this time.
0 commit comments