Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/Symfony/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

namespace PHPStan\Symfony;

/**
* @phpstan-type ParametersArray array{
* containerXmlPath?: string, container_xml_path?: string,
* constantHassers?: bool, constant_hassers?: bool,
* consoleApplicationLoader?: string, console_application_loader?: string,
* }
*/
final class Configuration
{

/** @var array<string, mixed> */
/** @var ParametersArray */
private $parameters;

/**
* @param array<string, mixed> $parameters
* @phpstan-param ParametersArray $parameters
*/
public function __construct(array $parameters)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Type/Symfony/ParameterDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private function generalizeTypeFromValue(Scope $scope, $value): Type
if ($hasOnlyStringKey) {
$keyTypes = [];
$valueTypes = [];
/** @var array<mixed>|bool|float|int|string $element */
foreach ($value as $key => $element) {
/** @var ConstantStringType $keyType */
$keyType = $scope->getTypeFromValue($key);
Expand All @@ -171,9 +172,11 @@ private function generalizeTypeFromValue(Scope $scope, $value): Type

return new ArrayType(
TypeCombinator::union(...array_map(function ($item) use ($scope): Type {
/** @var array<mixed>|bool|float|int|string $item */
return $this->generalizeTypeFromValue($scope, $item);
}, array_keys($value))),
TypeCombinator::union(...array_map(function ($item) use ($scope): Type {
/** @var array<mixed>|bool|float|int|string $item */
return $this->generalizeTypeFromValue($scope, $item);
}, array_values($value)))
);
Expand Down