UnknownBehaviorOption
API reference › PHPStan › rules › UnknownBehaviorOption
Represents an option of a behavior configuration that the created Behavior can’t assign, as found by
BehaviorDefinitionResolver.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$behaviorClass readonly constructor | string | Behavior class that Yii creates, as PHPStan displays it. | UnknownBehaviorOption |
$calledClass readonly constructor | string| | Class through which createObject() is called, for an as option, or null. Default: null. | UnknownBehaviorOption |
$line readonly constructor | int | Line to report: the option key, else the list item, the definition argument, the as option, the return statement or the call. | UnknownBehaviorOption |
$method readonly constructor | string | Method that supplies the configuration: behaviors, attachBehavior, attachBehaviors or createObject. | UnknownBehaviorOption |
$name readonly constructor | int| | Behavior name: a string for a named behavior, an int for an anonymous one, null when the name isn’t a single constant, or the as option name as written for createObject. | UnknownBehaviorOption |
$option readonly constructor | string | Name of the option that the behavior class can’t assign. | UnknownBehaviorOption |
$owner readonly constructor | string | Class whose behaviors() returns the configuration, receiver type of the attach call, or component created by createObject(), as PHPStan displays it. | UnknownBehaviorOption |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Stores an unassignable behavior option and its diagnostic location. | UnknownBehaviorOption |
message() | Returns the diagnostic message, naming the behavior, its owner and source, the behavior class and the option. | UnknownBehaviorOption |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(string $owner, string $method, int|string|null $name, int $line, string $behaviorClass, string $option, string|null $calledClass = null)Stores an unassignable behavior option and its diagnostic location.
Parameters
| Parameter | Type | Description |
|---|---|---|
$owner | string | Class whose behaviors() returns the configuration, receiver type of the attach call, or component created by createObject(), as PHPStan displays it. |
$method | string | Method that supplies the configuration: behaviors, attachBehavior, attachBehaviors or createObject. |
$name | int| | Behavior name: a string for a named behavior, an int for an anonymous one, null when the name isn’t a single constant, or the as option name as written for createObject. |
$line | int | Line to report: the option key, else the list item, the definition argument, the as option, the return statement or the call. |
$behaviorClass | string | Behavior class that Yii creates, as PHPStan displays it. |
$option | string | Name of the option that the behavior class can’t assign. |
$calledClass | string| | Class through which createObject() is called, for an as option, or null. |
message()
Section titled “message() ”public function message(): stringReturns the diagnostic message, naming the behavior, its owner and source, the behavior class and the option.
Returns
string