# ComponentPropertyReflection

> Wraps a fallback PHPStan\Reflection\PropertyReflection to expose the resolved component type for dynamic Yii application components in PHPStan analysis.

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

| final class | `yii2\extensions\phpstan\reflection\ComponentPropertyReflection` |
| --- | --- |
| Implements | [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) |
| Source | [`src/reflection/ComponentPropertyReflection.php`](https://github.com/yii2-extensions/phpstan/blob/main/src/reflection/ComponentPropertyReflection.php#L22) |

Wraps a fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) to expose the resolved component type for dynamic Yii application
components in PHPStan analysis.

Delegates visibility and mutability checks to the fallback instance while overriding the type to reflect the actual
component type as determined by the service map or dependency injection.

[`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) for property reflection contract.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a new instance of the [`ComponentPropertyReflection`](/docs/extensions/phpstan/reference/reflection/componentpropertyreflection/index.md) class. | `ComponentPropertyReflection` |
| [`canChangeTypeAfterAssignment()`](#method-canChangeTypeAfterAssignment) | Determines whether the type of the dynamic Yii application component property can change after assignment. | `ComponentPropertyReflection` |
| [`getDeclaringClass()`](#method-getDeclaringClass) | Retrieves the declaring class reflection for the dynamic Yii application component property. | `ComponentPropertyReflection` |
| [`getDeprecatedDescription()`](#method-getDeprecatedDescription) | Retrieves the deprecation description for the dynamic Yii application component property, if available. | `ComponentPropertyReflection` |
| [`getDocComment()`](#method-getDocComment) | Retrieves the PHPDoc comment for the dynamic Yii application component property, if available. | `ComponentPropertyReflection` |
| [`getReadableType()`](#method-getReadableType) | Retrieves the readable type for the dynamic Yii application component property. | `ComponentPropertyReflection` |
| [`getWritableType()`](#method-getWritableType) | Retrieves the writable type for the dynamic Yii application component property. | `ComponentPropertyReflection` |
| [`isDeprecated()`](#method-isDeprecated) | Determines whether the dynamic Yii application component property is deprecated. | `ComponentPropertyReflection` |
| [`isInternal()`](#method-isInternal) | Determines whether the dynamic Yii application component property is internal to the library or framework. | `ComponentPropertyReflection` |
| [`isPrivate()`](#method-isPrivate) | Determines whether the dynamic Yii application component property is private. | `ComponentPropertyReflection` |
| [`isPublic()`](#method-isPublic) | Determines whether the dynamic Yii application component property is public. | `ComponentPropertyReflection` |
| [`isReadable()`](#method-isReadable) | Determines whether the dynamic Yii application component property is readable. | `ComponentPropertyReflection` |
| [`isStatic()`](#method-isStatic) | Determines whether the dynamic Yii application component property is static. | `ComponentPropertyReflection` |
| [`isWritable()`](#method-isWritable) | Determines whether the dynamic Yii application component property is writable. | `ComponentPropertyReflection` |

## Method details

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

```php
public function __construct(PHPStan\Reflection\PropertyReflection $fallbackProperty, PHPStan\Type\Type $type, PHPStan\Reflection\ClassReflection $declaringClass)
```

Creates a new instance of the [`ComponentPropertyReflection`](/docs/extensions/phpstan/reference/reflection/componentpropertyreflection/index.md) class.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$fallbackProperty` | [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) | Fallback property reflection instance for delegation. |
| `$type` | `PHPStan\Type\Type` | Type of the dynamic component as resolved by the service map or dependency injection. |
| `$declaringClass` | `PHPStan\Reflection\ClassReflection` | Class reflection of the class declaring the dynamic property. |

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

```php
public function canChangeTypeAfterAssignment(): bool
```

Determines whether the type of the dynamic Yii application component property can change after assignment.

Delegates the mutability checks to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance, ensuring that type change
semantics are preserved according to the original property definition.

**Returns**

`bool`: `true` if the property type can change after assignment; `false` otherwise.

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

```php
public function getDeclaringClass(): PHPStan\Reflection\ClassReflection
```

Retrieves the declaring class reflection for the dynamic Yii application component property.

Delegates to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance to determine the class in which the property is
declared.

**Returns**

`PHPStan\Reflection\ClassReflection`: Declaring class reflection instance for the property.

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

```php
public function getDeprecatedDescription(): string|null
```

Retrieves the deprecation description for the dynamic Yii application component property, if available.

Delegates the retrieval of the deprecation description to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance,
ensuring that any deprecation metadata or rationale is preserved according to the original property definition.

**Returns**

`string|null`: Deprecation description if available, or `null` if not deprecated or no description is set.

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

```php
public function getDocComment(): string
```

Retrieves the PHPDoc comment for the dynamic Yii application component property, if available.

Delegates the retrieval of the PHPDoc comment to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance, ensuring that
documentation metadata is preserved according to the original property definition.

**Returns**

`string`: PHPDoc comment string for the property, or an empty string if no comment is set.

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

```php
public function getReadableType(): PHPStan\Type\Type
```

Retrieves the readable type for the dynamic Yii application component property.

Delegates the readable type resolution to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance ensuring that the type
exposed for reading is consistent with the original property definition.

**Returns**

`PHPStan\Type\Type`: Type that can be read from the property for static analysis.

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

```php
public function getWritableType(): PHPStan\Type\Type
```

Retrieves the writable type for the dynamic Yii application component property.

Delegates the writable type resolution to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance ensuring that the type
exposed for writing is consistent with the original property definition.

**Returns**

`PHPStan\Type\Type`: Type that can be written to the property for static analysis.

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

```php
public function isDeprecated(): PHPStan\TrinaryLogic
```

Determines whether the dynamic Yii application component property is deprecated.

Delegates the deprecation status check to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance, ensuring that
deprecation metadata is preserved according to the original property definition.

**Returns**

[`TrinaryLogic`](https://apiref.phpstan.org/2.3.x/PHPStan.TrinaryLogic.html): Deprecation status of the property as a [`TrinaryLogic`](https://apiref.phpstan.org/2.3.x/PHPStan.TrinaryLogic.html) value.

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

```php
public function isInternal(): PHPStan\TrinaryLogic
```

Determines whether the dynamic Yii application component property is internal to the library or framework.

Delegates the internal status check to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance, ensuring that internal
metadata is preserved according to the original property definition.

**Returns**

[`TrinaryLogic`](https://apiref.phpstan.org/2.3.x/PHPStan.TrinaryLogic.html): Internal status of the property as a [`TrinaryLogic`](https://apiref.phpstan.org/2.3.x/PHPStan.TrinaryLogic.html) value.

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

```php
public function isPrivate(): bool
```

Determines whether the dynamic Yii application component property is private.

Delegates the privacy check to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance ensuring that property visibility
is preserved according to the original property definition.

**Returns**

`bool`: `true` if the property is private; `false` otherwise.

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

```php
public function isPublic(): bool
```

Determines whether the dynamic Yii application component property is public.

Delegates the public visibility check to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance, ensuring that property
visibility is preserved according to the original property definition.

**Returns**

`bool`: `true` if the property is public; `false` otherwise.

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

```php
public function isReadable(): bool
```

Determines whether the dynamic Yii application component property is readable.

Delegates the readability checks to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance ensuring that visibility and
access rules are respected according to the original property definition.

**Returns**

`bool`: `true` if the property is readable; `false` otherwise.

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

```php
public function isStatic(): bool
```

Determines whether the dynamic Yii application component property is static.

Delegates the static check to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance, ensuring that static property
semantics are preserved according to the original property definition.

**Returns**

`bool`: `true` if the property is static; `false` otherwise.

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

```php
public function isWritable(): bool
```

Determines whether the dynamic Yii application component property is writable.

Delegates the writability check to the fallback [`PropertyReflection`](https://apiref.phpstan.org/2.3.x/PHPStan.Reflection.PropertyReflection.html) instance, ensuring that mutability and
access rules are respected according to the original property definition.

**Returns**

`bool`: `true` if the property is writable; `false` otherwise.