ParamsTypeBuilder
API reference › PHPStan › ParamsTypeBuilder
Builds the PHPStan array shape type of Yii application params from their configured values.
Scalars are generalized to string, int, float and bool, null stays null, nested arrays become nested
shapes (lists become positional shapes), empty arrays become array<mixed, mixed>, and any other value becomes
explicit mixed, matching what the same shape written as a PHPDoc type resolves to. Shapes are never degraded to
general arrays, regardless of the number of keys, which is also how PHPStan resolves a PHPDoc array shape.
ServiceMap::getParams() for the configured params.
ApplicationTypeNodeResolverExtension for the Module::$params type resolved from this shape.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
build() static | Builds the array shape type for the given params. | ParamsTypeBuilder |
Method details
Section titled “Method details”build()
Section titled “build() ”public static function build(array<array-key, mixed> $params): PHPStan\Type\TypeBuilds the array shape type for the given params.
Parameters
| Parameter | Type | Description |
|---|---|---|
$params | array<array-key, | Configured params, as returned by ServiceMap::getParams(). |
Returns
PHPStan\Type\Type: Array shape type, or array<mixed, mixed> for an empty array.