Skip to content

Commit c265a6a

Browse files
uekannuekann
authored andcommitted
Refactor
1 parent 4ed58ef commit c265a6a

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/Type/Php/ArrayAllFunctionTypeSpecifyingExtension.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace PHPStan\Type\Php;
44

5-
use PhpParser\Node\Param;
65
use PhpParser\Node\Expr;
76
use PhpParser\Node\Expr\FuncCall;
87
use PhpParser\Node\Expr\Variable;
8+
use PhpParser\Node\Param;
99
use PHPStan\Analyser\Scope;
1010
use PHPStan\Analyser\SpecifiedTypes;
1111
use PHPStan\Analyser\TypeSpecifier;
@@ -52,23 +52,23 @@ public function specifyTypes(FunctionReflection $functionReflection, FuncCall $n
5252

5353
if ($callable instanceof Expr\ArrowFunction) {
5454

55-
$callableParms = $callable->params;
55+
$callableParams = $callable->params;
5656
$specifiedTypesInFuncCall = $this->typeSpecifier->specifyTypesInCondition($scope, $callable->expr, $context)->getSureTypes();
5757

5858
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)
6262
) {
63-
$valueType = $this->fetchTypeByVariable($specifiedTypesInFuncCall, $callableParms[0]->var->name);
63+
$valueType = $this->fetchTypeByVariable($specifiedTypesInFuncCall, $callableParams[0]->var->name);
6464
}
6565

6666
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)
7070
) {
71-
$keyType = $this->fetchTypeByVariable($specifiedTypesInFuncCall, $callableParms[1]->var->name);
71+
$keyType = $this->fetchTypeByVariable($specifiedTypesInFuncCall, $callableParams[1]->var->name);
7272
}
7373

7474
if (isset($keyType) || isset($valueType)) {

tests/PHPStan/Analyser/TypeSpecifierTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace PHPStan\Analyser;
44

5-
use Bug4820\Param;
65
use Override;
76
use PhpParser\Node\Arg;
87
use PhpParser\Node\Expr;

0 commit comments

Comments
 (0)