|
7 | 7 | use PhpParser\Node\Expr\Closure;
|
8 | 8 | use PhpParser\Node\Name;
|
9 | 9 | use PhpParser\Node\Stmt\Foreach_;
|
10 |
| -use PhpParser\Node\Stmt\Function_; |
11 | 10 | use PHPStan\Analyser\Scope;
|
12 | 11 | use PHPStan\File\FileHelper;
|
13 | 12 | use PHPStan\Node\InClassMethodNode;
|
| 13 | +use PHPStan\Node\InFunctionNode; |
14 | 14 | use PHPStan\Reflection\ParametersAcceptorSelector;
|
15 | 15 | use PHPStan\Reflection\ParametersAcceptorWithPhpDocs;
|
16 | 16 | use PHPStan\Reflection\ReflectionProvider;
|
@@ -61,15 +61,9 @@ public function resolveDependencies(\PhpParser\Node $node, Scope $scope): NodeDe
|
61 | 61 | $this->extractFromParametersAcceptor($parametersAcceptor, $dependenciesReflections);
|
62 | 62 | }
|
63 | 63 | }
|
64 |
| - } elseif ($node instanceof Function_) { |
65 |
| - $functionName = $node->name->name; |
66 |
| - if (isset($node->namespacedName)) { |
67 |
| - $functionName = (string) $node->namespacedName; |
68 |
| - } |
69 |
| - $functionNameName = new Name($functionName); |
70 |
| - if ($this->reflectionProvider->hasFunction($functionNameName, null)) { |
71 |
| - $functionReflection = $this->reflectionProvider->getFunction($functionNameName, null); |
72 |
| - |
| 64 | + } elseif ($node instanceof InFunctionNode) { |
| 65 | + $functionReflection = $scope->getFunction(); |
| 66 | + if ($functionReflection !== null) { |
73 | 67 | $parametersAcceptor = ParametersAcceptorSelector::selectSingle($functionReflection->getVariants());
|
74 | 68 |
|
75 | 69 | if ($parametersAcceptor instanceof ParametersAcceptorWithPhpDocs) {
|
|
0 commit comments