Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2f36323

Browse files
Fix build
1 parent 58e64ff commit 2f36323

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎src/Type/Symfony/ParameterDynamicReturnTypeExtension.php‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use PHPStan\Type\BooleanType;
1515
use PHPStan\Type\Constant\ConstantArrayType;
1616
use PHPStan\Type\Constant\ConstantBooleanType;
17-
use PHPStan\Type\Constant\ConstantStringType;
1817
use PHPStan\Type\ConstantType;
1918
use PHPStan\Type\DynamicMethodReturnTypeExtension;
2019
use PHPStan\Type\FloatType;
@@ -160,9 +159,12 @@ private function generalizeTypeFromValue(Scope $scope, $value): Type
160159
$keyTypes = [];
161160
$valueTypes = [];
162161
foreach ($value as $key => $element) {
163-
/** @var ConstantStringType $keyType */
164162
$keyType = $scope->getTypeFromValue($key);
165-
$keyTypes[] = $keyType;
163+
$keyStringTypes = $keyType->getConstantStrings();
164+
if (count($keyStringTypes) !== 1) {
165+
throw new ShouldNotHappenException();
166+
}
167+
$keyTypes[] = $keyStringTypes[0];
166168
$valueTypes[] = $this->generalizeTypeFromValue($scope, $element);
167169
}
168170

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /