Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Mar 8, 2023
1 parent 58e64ff commit 2f36323
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Type/Symfony/ParameterDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use PHPStan\Type\BooleanType;
use PHPStan\Type\Constant\ConstantArrayType;
use PHPStan\Type\Constant\ConstantBooleanType;
use PHPStan\Type\Constant\ConstantStringType;
use PHPStan\Type\ConstantType;
use PHPStan\Type\DynamicMethodReturnTypeExtension;
use PHPStan\Type\FloatType;
Expand Down Expand Up @@ -160,9 +159,12 @@ private function generalizeTypeFromValue(Scope $scope, $value): Type
$keyTypes = [];
$valueTypes = [];
foreach ($value as $key => $element) {
/** @var ConstantStringType $keyType */
$keyType = $scope->getTypeFromValue($key);
$keyTypes[] = $keyType;
$keyStringTypes = $keyType->getConstantStrings();
if (count($keyStringTypes) !== 1) {
throw new ShouldNotHappenException();
}
$keyTypes[] = $keyStringTypes[0];
$valueTypes[] = $this->generalizeTypeFromValue($scope, $element);
}

Expand Down

0 comments on commit 2f36323

Please sign in to comment.