Skip to content
PHP Ecosystem
Explore

InvalidBehaviorDefinition

API reference › PHPStan › rules › InvalidBehaviorDefinition

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

Represents a behavior definition that Component can’t attach, as found by BehaviorDefinitionResolver.

PropertyTypeDescriptionDefined by
$definedClass readonly constructorstring|nullClass or container ID that the definition names, or null for a configuration array without a class.InvalidBehaviorDefinition
$line readonly constructorintLine to report: the list item, the definition argument or the return statement.InvalidBehaviorDefinition
$method readonly constructorstringMethod that supplies the definition: behaviors, attachBehavior or attachBehaviors.InvalidBehaviorDefinition
$name readonly constructorint|string|nullBehavior 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 constructorstringClass whose behaviors() returns the definition, or receiver type of the attach call, as PHPStan displays it.InvalidBehaviorDefinition
$resolvedClass readonly constructorstring|nullClass that the container resolves the defined class to, or null when the definition has no class.InvalidBehaviorDefinition
MethodDescriptionDefined 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
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

ParameterTypeDescription
$ownerstringClass whose behaviors() returns the definition, or receiver type of the attach call, as PHPStan displays it.
$methodstringMethod that supplies the definition: behaviors, attachBehavior or attachBehaviors.
$nameint|string|nullBehavior name: a string for a named behavior, an int for an anonymous one, or null when the name isn’t a single constant.
$lineintLine to report: the list item, the definition argument or the return statement.
$definedClassstring|nullClass or container ID that the definition names, or null for a configuration array without a class.
$resolvedClassstring|nullClass that the container resolves the defined class to, or null when the definition has no class.
public function message(): string

Returns the diagnostic message, naming the behavior, its owner and method, and the defined and resolved classes.

Returns

string