# ValidatorConfiguration

> Represents the configuration of a Model::rules() entry whose created yii\validators\Validator and assignment path are proven.

[API reference](/docs/api/index.md) › [PHPStan](/docs/extensions/phpstan/reference/index.md) › [rules](/docs/extensions/phpstan/reference/rules/index.md) › ValidatorConfiguration

| final readonly class | `yii2\extensions\phpstan\rules\ValidatorConfiguration` |
| --- | --- |
| Source | [`src/rules/ValidatorConfiguration.php`](https://github.com/yii2-extensions/phpstan/blob/main/src/rules/ValidatorConfiguration.php#L15) |

Represents the configuration of a `Model::rules()` entry whose created [`Validator`](/docs/api/yii/validators/validator/index.md) and assignment path are
proven.

[`ValidatorConfigurationResolver`](/docs/extensions/phpstan/reference/rules/validatorconfigurationresolver/index.md) for the conditions under which a configuration is resolved.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-configuration"></span>`$configuration` readonly constructor | [`CreateObjectConfiguration`](/docs/extensions/phpstan/reference/rules/createobjectconfiguration/index.md) | Validator class Yii creates and the options of the call that it assigns: alias defaults, written options and the options [`Validator::createValidator()`](/docs/api/yii/validators/validator/index.md#method-createValidator) sets. | `ValidatorConfiguration` |
| <span id="property-id"></span>`$id` readonly constructor | `string` | Container ID or class name that `Yii::createObject()` receives as the class of the validator. | `ValidatorConfiguration` |
| <span id="property-writtenOptions"></span>`$writtenOptions` readonly constructor | `list<string>` | Names of the options written in the rule after position `1`, in rule order. | `ValidatorConfiguration` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Stores the selected class ID, the resolved configuration and the options the rule writes. | `ValidatorConfiguration` |

## Method details

### __construct() <span id="method-__construct"></span>

```php
public function __construct(string $id, yii2\extensions\phpstan\rules\CreateObjectConfiguration $configuration, list<string> $writtenOptions)
```

Stores the selected class ID, the resolved configuration and the options the rule writes.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$id` | `string` | Container ID or class name that `Yii::createObject()` receives as the class of the validator. |
| `$configuration` | [`CreateObjectConfiguration`](/docs/extensions/phpstan/reference/rules/createobjectconfiguration/index.md) | Validator class Yii creates and the options of the call that it assigns: alias defaults, written options and the options [`Validator::createValidator()`](/docs/api/yii/validators/validator/index.md#method-createValidator) sets. |
| `$writtenOptions` | `list<string>` | Names of the options written in the rule after position `1`, in rule order. |