Skip to content
PHP Ecosystem
Explore

InvalidBehaviorOptionType

API reference › PHPStan › rules › InvalidBehaviorOptionType

final readonly classyii2\extensions\phpstan\rules\InvalidBehaviorOptionType
Sourcesrc/rules/InvalidBehaviorOptionType.php

Represents an option of a behavior configuration whose value the created Behavior never accepts, as found by BehaviorDefinitionResolver.

PropertyTypeDescriptionDefined by
$actualType readonly constructorstringNative type of the value, as PHPStan describes it precisely.InvalidBehaviorOptionType
$behaviorClass readonly constructorstringBehavior class that Yii creates, as PHPStan displays it.InvalidBehaviorOptionType
$calledClass readonly constructorstring|nullClass through which createObject() is called, for an as option, or null. Default: null.InvalidBehaviorOptionType
$expectedType readonly constructorstringNative type of that property or of the first setter parameter.InvalidBehaviorOptionType
$line readonly constructorintLine to report: the option key, else the list item, the definition argument, the as option, the return statement or the call.InvalidBehaviorOptionType
$member readonly constructorstringProperty or setter that Yii assigns the value to.InvalidBehaviorOptionType
$method readonly constructorstringMethod that supplies the configuration: behaviors, attachBehavior, attachBehaviors or createObject.InvalidBehaviorOptionType
$name readonly constructorint|string|nullBehavior 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.InvalidBehaviorOptionType
$option readonly constructorstringName of the option whose value the behavior class never accepts.InvalidBehaviorOptionType
$owner readonly constructorstringClass whose behaviors() returns the configuration, receiver type of the attach call, or component created by createObject(), as PHPStan displays it.InvalidBehaviorOptionType
MethodDescriptionDefined by
__construct()Stores a rejected behavior option, its actual and expected types and diagnostic location.InvalidBehaviorOptionType
message()Returns the diagnostic message, naming the behavior, its owner and source, the behavior class, the option, the value type and the type that the property or setter accepts.InvalidBehaviorOptionType
public function __construct(string $owner, string $method, int|string|null $name, int $line, string $behaviorClass, string $option, string $actualType, string $member, string $expectedType, string|null $calledClass = null)

Stores a rejected behavior option, its actual and expected types and diagnostic location.

Parameters

ParameterTypeDescription
$ownerstringClass whose behaviors() returns the configuration, receiver type of the attach call, or component created by createObject(), as PHPStan displays it.
$methodstringMethod that supplies the configuration: behaviors, attachBehavior, attachBehaviors or createObject.
$nameint|string|nullBehavior 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.
$lineintLine to report: the option key, else the list item, the definition argument, the as option, the return statement or the call.
$behaviorClassstringBehavior class that Yii creates, as PHPStan displays it.
$optionstringName of the option whose value the behavior class never accepts.
$actualTypestringNative type of the value, as PHPStan describes it precisely.
$memberstringProperty or setter that Yii assigns the value to.
$expectedTypestringNative type of that property or of the first setter parameter.
$calledClassstring|nullClass through which createObject() is called, for an as option, or null.
public function message(): string

Returns the diagnostic message, naming the behavior, its owner and source, the behavior class, the option, the value type and the type that the property or setter accepts.

Returns

string