InvalidBehaviorDefinition
API reference › PHPStan › rules › InvalidBehaviorDefinition
Represents a behavior definition that Component can’t attach, as found by BehaviorDefinitionResolver.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$definedClass readonly constructor | string| | Class or container ID that the definition names, or null for a configuration array without a class. | InvalidBehaviorDefinition |
$line readonly constructor | int | Line to report: the list item, the definition argument or the return statement. | InvalidBehaviorDefinition |
$method readonly constructor | string | Method that supplies the definition: behaviors, attachBehavior or attachBehaviors. | InvalidBehaviorDefinition |
$name readonly constructor | int| | Behavior name: a string for a named behavior, an int for an anonymous one, or null when the name isn’t a single constant. | InvalidBehaviorDefinition |
$owner readonly constructor | string | Class whose behaviors() returns the definition, or receiver type of the attach call, as PHPStan displays it. | InvalidBehaviorDefinition |
$resolvedClass readonly constructor | string| | Class that the container resolves the defined class to, or null when the definition has no class. | InvalidBehaviorDefinition |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Stores an unattachable behavior definition and its diagnostic location. | InvalidBehaviorDefinition |
message() | Returns the diagnostic message, naming the behavior, its owner and method, and the defined and resolved classes. | InvalidBehaviorDefinition |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(string $owner, string $method, int|string|null $name, int $line, string|null $definedClass, string|null $resolvedClass)Stores an unattachable behavior definition and its diagnostic location.
Parameters
| Parameter | Type | Description |
|---|---|---|
$owner | string | Class whose behaviors() returns the definition, or receiver type of the attach call, as PHPStan displays it. |
$method | string | Method that supplies the definition: behaviors, attachBehavior or attachBehaviors. |
$name | int| | Behavior name: a string for a named behavior, an int for an anonymous one, or null when the name isn’t a single constant. |
$line | int | Line to report: the list item, the definition argument or the return statement. |
$definedClass | string| | Class or container ID that the definition names, or null for a configuration array without a class. |
$resolvedClass | string| | Class that the container resolves the defined class to, or null when the definition has no class. |
message()
Section titled “message() ”public function message(): stringReturns the diagnostic message, naming the behavior, its owner and method, and the defined and resolved classes.
Returns
string