Skip to content
PHP Ecosystem
Explore

InvalidBehaviorAsDefinition

API reference › PHPStan › rules › InvalidBehaviorAsDefinition

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

Represents an as option of a Yii::createObject() configuration that Component rejects, as found by BehaviorDefinitionResolver.

PropertyTypeDescriptionDefined by
$calledClass readonly constructorstringClass through which createObject() is called, as PHPStan displays it.InvalidBehaviorAsDefinition
$definedClass readonly constructorstring|nullClass that the option names, or null for a configuration array without a class or a rejected value.InvalidBehaviorAsDefinition
$line readonly constructorintLine to report: the option key, or the call when the configuration doesn’t locate it.InvalidBehaviorAsDefinition
$option readonly constructorstringOption name as written, including the as prefix.InvalidBehaviorAsDefinition
$owner readonly constructorstringCreated component that receives the option, as PHPStan displays it.InvalidBehaviorAsDefinition
$resolvedClass readonly constructorstring|nullClass that the container resolves the named behavior class to, or null when Component::__set() rejects the option itself.InvalidBehaviorAsDefinition
$valueType readonly constructorstring|nullDescription of a rejected value that is no class name or configuration array, or null otherwise.InvalidBehaviorAsDefinition
MethodDescriptionDefined by
__construct()Stores a rejected as behavior definition and its diagnostic location.InvalidBehaviorAsDefinition
message()Returns the diagnostic message, naming the call, the option, the owner and the defined and resolved classes.InvalidBehaviorAsDefinition
public function __construct(string $calledClass, string $owner, string $option, int $line, string|null $definedClass, string|null $resolvedClass, string|null $valueType)

Stores a rejected as behavior definition and its diagnostic location.

Parameters

ParameterTypeDescription
$calledClassstringClass through which createObject() is called, as PHPStan displays it.
$ownerstringCreated component that receives the option, as PHPStan displays it.
$optionstringOption name as written, including the as prefix.
$lineintLine to report: the option key, or the call when the configuration doesn’t locate it.
$definedClassstring|nullClass that the option names, or null for a configuration array without a class or a rejected value.
$resolvedClassstring|nullClass that the container resolves the named behavior class to, or null when Component::__set() rejects the option itself.
$valueTypestring|nullDescription of a rejected value that is no class name or configuration array, or null otherwise.
public function message(): string

Returns the diagnostic message, naming the call, the option, the owner and the defined and resolved classes.

Returns

string