|
2 | 2 |
|
3 | 3 | namespace PHPStan\Type\Php; |
4 | 4 |
|
5 | | -use PhpParser\Node\Param; |
6 | 5 | use PhpParser\Node\Expr; |
7 | 6 | use PhpParser\Node\Expr\FuncCall; |
8 | 7 | use PhpParser\Node\Expr\Variable; |
| 8 | +use PhpParser\Node\Param; |
9 | 9 | use PHPStan\Analyser\Scope; |
10 | 10 | use PHPStan\Analyser\SpecifiedTypes; |
11 | 11 | use PHPStan\Analyser\TypeSpecifier; |
@@ -52,23 +52,23 @@ public function specifyTypes(FunctionReflection $functionReflection, FuncCall $n |
52 | 52 |
|
53 | 53 | if ($callable instanceof Expr\ArrowFunction) { |
54 | 54 |
|
55 | | - $callableParms = $callable->params; |
| 55 | + $callableParams = $callable->params; |
56 | 56 | $specifiedTypesInFuncCall = $this->typeSpecifier->specifyTypesInCondition($scope, $callable->expr, $context)->getSureTypes(); |
57 | 57 |
|
58 | 58 | if ( |
59 | | - isset($callableParms[0]) && |
60 | | - $callableParms[0] instanceof Param && |
61 | | - $callableParms[0]->var instanceof Variable |
| 59 | + isset($callableParams[0]) && |
| 60 | + $callableParams[0]->var instanceof Variable && |
| 61 | + is_string($callableParams[0]->var->name) |
62 | 62 | ) { |
63 | | - $valueType = $this->fetchTypeByVariable($specifiedTypesInFuncCall, $callableParms[0]->var->name); |
| 63 | + $valueType = $this->fetchTypeByVariable($specifiedTypesInFuncCall, $callableParams[0]->var->name); |
64 | 64 | } |
65 | 65 |
|
66 | 66 | if ( |
67 | | - isset($callableParms[1]) && |
68 | | - $callableParms[1] instanceof Param && |
69 | | - $callableParms[1]->var instanceof Variable |
| 67 | + isset($callableParams[1]) && |
| 68 | + $callableParams[1]->var instanceof Variable && |
| 69 | + is_string($callableParams[1]->var->name) |
70 | 70 | ) { |
71 | | - $keyType = $this->fetchTypeByVariable($specifiedTypesInFuncCall, $callableParms[1]->var->name); |
| 71 | + $keyType = $this->fetchTypeByVariable($specifiedTypesInFuncCall, $callableParams[1]->var->name); |
72 | 72 | } |
73 | 73 |
|
74 | 74 | if (isset($keyType) || isset($valueType)) { |
|
0 commit comments