# WidgetConfiguration

> Represents the configuration of a yii\base\Widget::widget() or yii\base\Widget::begin() call whose class 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) › WidgetConfiguration

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

Represents the configuration of a [`Widget::widget()`](/docs/api/yii/base/widget/index.md#method-widget) or [`Widget::begin()`](/docs/api/yii/base/widget/index.md#method-begin) call whose class and assignment
path are proven.

[`WidgetConfigurationResolver`](/docs/extensions/phpstan/reference/rules/widgetconfigurationresolver/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) | Configuration that `Yii::createObject()` receives from the method: the called class as PHPStan displays it, the widget class Yii creates and the options it assigns. | `WidgetConfiguration` |
| <span id="property-method"></span>`$method` readonly constructor | `string` | Name of the called method as [`Widget`](/docs/api/yii/base/widget/index.md) declares it: `widget` or `begin`. | `WidgetConfiguration` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Stores the widget creation method and its resolved configuration. | `WidgetConfiguration` |

## Method details

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

```php
public function __construct(string $method, yii2\extensions\phpstan\rules\CreateObjectConfiguration $configuration)
```

Stores the widget creation method and its resolved configuration.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$method` | `string` | Name of the called method as [`Widget`](/docs/api/yii/base/widget/index.md) declares it: `widget` or `begin`. |
| `$configuration` | [`CreateObjectConfiguration`](/docs/extensions/phpstan/reference/rules/createobjectconfiguration/index.md) | Configuration that `Yii::createObject()` receives from the method: the called class as PHPStan displays it, the widget class Yii creates and the options it assigns. |