1212use PhpParser \Node \Name ;
1313use PhpParser \Node \Name \FullyQualified ;
1414use PhpParser \Node \Stmt ;
15- use PhpParser \Node \Stmt \Use_ ;
1615use PhpParser \NodeAbstract ;
1716use PhpParser \NodeVisitorAbstract ;
1817use PHPStan \PhpDocParser \Ast \PhpDoc \PhpDocNode ;
@@ -91,7 +90,7 @@ public function enterNode(Node $node)
9190 {
9291 if ($ node instanceof Stmt \Namespace_) {
9392 $ this ->nameContext ->startNamespace ($ node ->name );
94- } elseif ($ node instanceof Use_) {
93+ } elseif ($ node instanceof Stmt \ Use_) {
9594 foreach ($ node ->uses as $ use ) {
9695 $ this ->addAlias ($ use , $ node ->type , null );
9796 }
@@ -161,14 +160,14 @@ public function enterNode(Node $node)
161160 }
162161
163162 if (null !== $ arrayItemType ) {
164- $ node ->type = $ this ->resolveName (new Name ($ arrayItemType ), Use_::TYPE_NORMAL );
163+ $ node ->type = $ this ->resolveName (new Name ($ arrayItemType ), Stmt \ Use_::TYPE_NORMAL );
165164
166165 return ;
167166 }
168167 }
169168
170169 foreach ($ phpDocNode ->getVarTagValues () as $ tagValue ) {
171- $ type = $ this ->resolveName (new Name ((string ) $ tagValue ->type ), Use_::TYPE_NORMAL );
170+ $ type = $ this ->resolveName (new Name ((string ) $ tagValue ->type ), Stmt \ Use_::TYPE_NORMAL );
172171 $ node ->type = $ type ;
173172 break ;
174173 }
@@ -177,7 +176,7 @@ public function enterNode(Node $node)
177176 foreach ($ phpDocNode ->getTags () as $ tagValue ) {
178177 if ('@ ' === $ tagValue ->name [0 ] && !str_contains ($ tagValue ->name , '@var ' )) {
179178 $ customTag = str_replace ('@ ' , '' , $ tagValue ->name );
180- $ type = $ this ->resolveName (new Name ($ customTag ), Use_::TYPE_NORMAL );
179+ $ type = $ this ->resolveName (new Name ($ customTag ), Stmt \ Use_::TYPE_NORMAL );
181180 $ node ->type = $ type ;
182181
183182 break ;
@@ -207,10 +206,10 @@ public function enterNode(Node $node)
207206 }
208207 } elseif ($ node instanceof Expr \FuncCall) {
209208 if ($ node ->name instanceof Name) {
210- $ node ->name = $ this ->resolveName ($ node ->name , Use_::TYPE_FUNCTION );
209+ $ node ->name = $ this ->resolveName ($ node ->name , Stmt \ Use_::TYPE_FUNCTION );
211210 }
212211 } elseif ($ node instanceof Expr \ConstFetch) {
213- $ node ->name = $ this ->resolveName ($ node ->name , Use_::TYPE_CONSTANT );
212+ $ node ->name = $ this ->resolveName ($ node ->name , Stmt \ Use_::TYPE_CONSTANT );
214213 } elseif ($ node instanceof Stmt \TraitUse) {
215214 foreach ($ node ->traits as &$ trait ) {
216215 $ trait = $ this ->resolveClassName ($ trait );
@@ -282,7 +281,7 @@ protected function resolveName(Name $name, int $type): Name
282281
283282 protected function resolveClassName (Name $ name ): Name
284283 {
285- return $ this ->resolveName ($ name , Use_::TYPE_NORMAL );
284+ return $ this ->resolveName ($ name , Stmt \ Use_::TYPE_NORMAL );
286285 }
287286
288287 /**
@@ -339,7 +338,7 @@ private function resolveSignature($node): void
339338 $ arrayItemType = $ this ->getArrayItemType ($ phpDocParam ->type );
340339
341340 if (null !== $ arrayItemType ) {
342- $ param ->type = $ this ->resolveName (new Name ($ arrayItemType ), Use_::TYPE_NORMAL );
341+ $ param ->type = $ this ->resolveName (new Name ($ arrayItemType ), Stmt \ Use_::TYPE_NORMAL );
343342 }
344343 }
345344 }
@@ -356,7 +355,7 @@ private function resolveSignature($node): void
356355 }
357356
358357 if (null !== $ arrayItemType ) {
359- $ node ->returnType = $ this ->resolveName (new Name ($ arrayItemType ), Use_::TYPE_NORMAL );
358+ $ node ->returnType = $ this ->resolveName (new Name ($ arrayItemType ), Stmt \ Use_::TYPE_NORMAL );
360359 }
361360 }
362361 }
0 commit comments