# NewObjectConfiguration

> Represents the configuration of a direct new construction 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) › NewObjectConfiguration

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

Represents the configuration of a direct `new` construction whose class and assignment path are proven.

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

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-classReflection"></span>`$classReflection` readonly constructor | `PHPStan\Reflection\ClassReflection` | Class that `new` constructs and configures. | `NewObjectConfiguration` |
| <span id="property-options"></span>`$options` readonly constructor | `list<array{string, int, PhpParser\Node\Expr\|PHPStan\Type\Type}>` | Name, reported line and effective value of each distinct option, in first-occurrence order, as [`ObjectConfigurationReader::options()`](/docs/extensions/phpstan/reference/rules/objectconfigurationreader/index.md#method-options) reads them. Every key is assigned, `class`, `__class` and `__construct()` included. | `NewObjectConfiguration` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Stores the constructed class and effective configuration options. | `NewObjectConfiguration` |

## Method details

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

```php
public function __construct(PHPStan\Reflection\ClassReflection $classReflection, list<array{string, int, PhpParser\Node\Expr|PHPStan\Type\Type}> $options)
```

Stores the constructed class and effective configuration options.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$classReflection` | `PHPStan\Reflection\ClassReflection` | Class that `new` constructs and configures. |
| `$options` | `list<array{string, int, PhpParser\Node\Expr\|PHPStan\Type\Type}>` | Name, reported line and effective value of each distinct option, in first-occurrence order, as [`ObjectConfigurationReader::options()`](/docs/extensions/phpstan/reference/rules/objectconfigurationreader/index.md#method-options) reads them. Every key is assigned, `class`, `__class` and `__construct()` included. |