File tree Expand file tree Collapse file tree
rules/TypeDeclaration/Rector/ClassMethod Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,32 +108,34 @@ public function refactor(Node $node): ?Node
108108 continue ;
109109 }
110110
111+ $ paramTypeNode = null ;
112+
111113 foreach ($ dimFetches as $ dimFetch ) {
112114 $ dimFetchType = $ this ->getType ($ dimFetch ->var );
113115
114116 if (! $ dimFetchType instanceof ArrayType && ! $ dimFetchType instanceof ConstantArrayType) {
115- continue ;
117+ continue 2 ;
116118 }
117119
118120 if ($ dimFetch ->dim instanceof Variable) {
119121 $ type = $ this ->nodeTypeResolver ->getType ($ dimFetch ->dim );
120122 if ($ type instanceof UnionType) {
121- continue ;
123+ continue 2 ;
122124 }
123125 }
126+ }
124127
125- $ paramTypeNode = $ this ->staticTypeMapper ->mapPHPStanTypeToPhpParserNode (
126- $ dimFetchType ->getKeyType (),
127- TypeKind::PARAM
128- );
129-
130- if (! $ paramTypeNode instanceof Node) {
131- continue ;
132- }
128+ $ paramTypeNode = $ this ->staticTypeMapper ->mapPHPStanTypeToPhpParserNode (
129+ $ dimFetchType ->getKeyType (),
130+ TypeKind::PARAM
131+ );
133132
134- $ param -> type = $ paramTypeNode ;
135- $ hasChanged = true ;
133+ if (! $ paramTypeNode instanceof Node) {
134+ continue ;
136135 }
136+
137+ $ param ->type = $ paramTypeNode ;
138+ $ hasChanged = true ;
137139 }
138140 }
139141
You can’t perform that action at this time.
0 commit comments