0 follower

Final Class Yiisoft\Injector\InvalidArgumentException

InheritanceYiisoft\Injector\InvalidArgumentException » Yiisoft\Injector\ArgumentException » InvalidArgumentException

Public Methods

Hide inherited methods

Method Description Defined By
__construct() Yiisoft\Injector\ArgumentException

Constants

Hide inherited constants

Constant Value Description Defined By
EXCEPTION_MESSAGE 'Invalid argument "%s" when calling "%s"%s. Non-interface argument should be' . ' named explicitly when passed.' Yiisoft\Injector\InvalidArgumentException

Method Details

Hide inherited methods

__construct() public method
public mixed __construct ( ReflectionFunctionAbstract $reflection, string $parameter )
$reflection ReflectionFunctionAbstract
$parameter string

                public function __construct(ReflectionFunctionAbstract $reflection, string $parameter)
{
    $function = $reflection->getName();
    /** @psalm-var class-string|null $class */
    $class = $reflection->class ?? null;
    if ($class === null) {
        $method = $function;
        if (strpos($method, '{closure') !== false) {
            $method = $this->renderClosureSignature($reflection);
        }
    } else {
        $method = "{$class}::{$function}";
    }
    $fileName = $reflection->getFileName();
    $line = $reflection->getStartLine();
    $fileAndLine = '';
    if (!empty($fileName)) {
        $fileAndLine = " in \"$fileName\" at line $line";
    }
    parent::__construct(sprintf(static::EXCEPTION_MESSAGE, $parameter, $method, $fileAndLine));
}