|
11 | 11 | use PHPStan\Analyser\TypeSpecifierContext; |
12 | 12 | use PHPStan\DependencyInjection\AutowiredService; |
13 | 13 | use PHPStan\Reflection\FunctionReflection; |
14 | | -use PHPStan\Type\Constant\ConstantStringType; |
15 | 14 | use PHPStan\Type\FunctionTypeSpecifyingExtension; |
16 | 15 | use function count; |
17 | 16 |
|
@@ -45,23 +44,21 @@ public function specifyTypes( |
45 | 44 | ): SpecifiedTypes |
46 | 45 | { |
47 | 46 | $args = $node->getArgs(); |
48 | | - $constantName = $scope->getType($args[0]->value); |
49 | | - if ( |
50 | | - !$constantName instanceof ConstantStringType |
51 | | - || $constantName->getValue() === '' |
52 | | - ) { |
| 47 | + $constantNames = $scope->getType($args[0]->value)->getConstantStrings(); |
| 48 | + |
| 49 | + if (count($constantNames) !== 1 || $constantNames[0]->getValue() === '') { |
53 | 50 | return new SpecifiedTypes([], []); |
54 | 51 | } |
55 | 52 |
|
56 | 53 | $valueType = $scope->getType($args[1]->value); |
57 | 54 | $finalType = $scope->getConstantExplicitTypeFromConfig( |
58 | | - $constantName->getValue(), |
| 55 | + $constantNames[0]->getValue(), |
59 | 56 | $valueType, |
60 | 57 | ); |
61 | 58 |
|
62 | 59 | return $this->typeSpecifier->create( |
63 | 60 | new Node\Expr\ConstFetch( |
64 | | - new Node\Name\FullyQualified($constantName->getValue()), |
| 61 | + new Node\Name\FullyQualified($constantNames[0]->getValue()), |
65 | 62 | ), |
66 | 63 | $finalType, |
67 | 64 | TypeSpecifierContext::createTruthy(), |
|
0 commit comments