# Message

> Defines PHPStan extension exception message templates.

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

| enum | `yii2\extensions\phpstan\exception\Message` |
| --- | --- |
| Backed by | `string` |
| Source | [`src/exception/Message.php`](https://github.com/yii2-extensions/phpstan/blob/main/src/exception/Message.php#L14) |

Defines PHPStan extension exception message templates.

Use [`Message::getMessage()`](/docs/extensions/phpstan/reference/exception/message/index.md#method-getMessage) to format the template with `sprintf()` arguments.

## Cases

| Case | Value | Description |
| --- | --- | --- |
| <span id="case-BEHAVIOR_DEFINITION_NOT_ARRAY"></span>`BEHAVIOR_DEFINITION_NOT_ARRAY` | `"Behavior definition for '%s' must be an array."` | Error when a behavior definition is not an array. |
| <span id="case-BEHAVIOR_METHOD_NOT_FOUND"></span>`BEHAVIOR_METHOD_NOT_FOUND` | `'Method %s::%s() is not provided by any behavior attached to the class.'` | Error when no attached behavior provides the requested method. |
| <span id="case-BEHAVIOR_PROPERTY_NOT_FOUND"></span>`BEHAVIOR_PROPERTY_NOT_FOUND` | `'Property %s::$%s is not provided by any behavior attached to the class.'` | Error when no attached behavior provides the requested property. |
| <span id="case-CONFIG_FILE_NOT_ARRAY"></span>`CONFIG_FILE_NOT_ARRAY` | `"Configuration file '%s' must return an array."` | Error when the configuration file does not return an array. |
| <span id="case-CONFIG_PATH_NOT_READABLE"></span>`CONFIG_PATH_NOT_READABLE` | `"Provided config path '%s' must be a readable PHP file."` | Error when the provided configuration path is not a readable PHP file. |
| <span id="case-CONFIG_SECTION_NOT_ARRAY"></span>`CONFIG_SECTION_NOT_ARRAY` | `"Configuration file '%s' must contain a valid '%s' 'array'."` | Error when a configuration file section is not an array. |
| <span id="case-PROPERTY_NOT_RESOLVED"></span>`PROPERTY_NOT_RESOLVED` | `'Property %s::$%s is neither native, a component, nor annotation-based.'` | Error when an application property is neither native, a component, nor annotation-based. |
| <span id="case-SHAPE_KEY_WITHOUT_VALUE_TYPE"></span>`SHAPE_KEY_WITHOUT_VALUE_TYPE` | `'Shape key without a value type.'` | Error when a constant array shape key has no matching value type. |
| <span id="case-UNSUPPORTED_DEFINITION"></span>`UNSUPPORTED_DEFINITION` | `"Unsupported definition for '%s'."` | Error when a service or component definition is unsupported. |
| <span id="case-VALUE_NOT_STRING"></span>`VALUE_NOT_STRING` | `"'%s': '%s' must be a 'string', got '%s'."` | Error when a configuration value or identifier is not a string. |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`getMessage()`](#method-getMessage) | Returns the formatted message string for the error case. | `Message` |

## Method details

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

```php
public function getMessage(int|string ...$argument): string
```

Returns the formatted message string for the error case.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `...$argument` | `int\|string` | Values to insert into the message template. |

**Returns**

`string`: Formatted error message with interpolated arguments.