Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

InvalidArgumentType.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Base\Exceptions;
8
9 use Exception;
10
16 class InvalidArgumentType extends InvalidArgumentException
17 {
26 public function __construct($argumentName, $expectedType, $value = null, Exception $previous = null)
27 {
28 $parameters = ['%argumentName%' => $argumentName, '%expectedType%' => $expectedType];
29 $this->setMessageTemplate("Argument '%argumentName%' is invalid: expected value to be of type '%expectedType%'");
30 if ($value) {
31 $this->setMessageTemplate("Argument '%argumentName%' is invalid: expected value to be of type '%expectedType%', got '%actualType%'");
32 $actualType = is_object($value) ? get_class($value) : gettype($value);
33 $parameters['%actualType%'] = $actualType;
34 }
35
37 $this->addParameters($parameters);
38 $this->message = $this->getBaseTranslation();
39 }
40 }
eZ\Publish\Core\Base\$parameters
$parameters
Definition: TranslatableBase.php:16
eZ\Publish\Core\Base\Exceptions\InvalidArgumentException
Invalid Argument Type Exception implementation.
Definition: Core/Base/Exceptions/InvalidArgumentException.php:20
eZ\Publish\Core\Base\Exceptions\InvalidArgumentType
Invalid Argument Type Exception implementation.
Definition: InvalidArgumentType.php:17
eZ\Publish\Core\Base\Exceptions\InvalidArgumentType\__construct
__construct($argumentName, $expectedType, $value=null, Exception $previous=null)
Generates: "Argument '{$argumentName}' is invalid: expected value to be of type '{$expectedType}'[,...
Definition: InvalidArgumentType.php:26
eZ\Publish\Core\Base\Translatable\setMessageTemplate
setMessageTemplate($messageTemplate)
Injects the message template.
eZ\Publish\Core\Base\Translatable\getBaseTranslation
getBaseTranslation()
Returns base translation, computed with message template and parameters.
eZ\Publish\Core\Base\Translatable\addParameters
addParameters(array $parameters)
Adds $parameters to existing hash map.
eZ\Publish\Core\Base\Exceptions
Definition: Core/Base/Exceptions/BadStateException.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.