Final Class Yiisoft\Hydrator\AttributeHandling\Exception\UnexpectedAttributeException
| Inheritance | Yiisoft\Hydrator\AttributeHandling\Exception\UnexpectedAttributeException » InvalidArgumentException |
|---|
Thrown when an attribute isn't of the expected class. Used in data and parameter attribute handlers.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Hydrator\AttributeHandling\Exception\UnexpectedAttributeException |
Method Details
| public mixed __construct ( string $expectedClassName, object $actualObject, integer $code = 0, Throwable|null $previous = null ) | ||
| $expectedClassName | string |
Expected class name of an attribute. |
| $actualObject | object |
An actual given object that's not an instance of |
| $code | integer |
The exception code. |
| $previous | Throwable|null |
The previous throwable used for the exception chaining. |
public function __construct(
string $expectedClassName,
object $actualObject,
int $code = 0,
?Throwable $previous = null,
) {
parent::__construct(
sprintf(
'Expected "%s", but "%s" given.',
$expectedClassName,
$actualObject::class
),
$code,
$previous,
);
}
Signup or Login in order to comment.