0 follower

Final Class Yiisoft\Definitions\ValueDefinition

InheritanceYiisoft\Definitions\ValueDefinition
ImplementsYiisoft\Definitions\Contract\DefinitionInterface

Value definition resolves value passed as is.

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( mixed $value, string|null $type null )
$value mixed

Value to be returned on resolving.

$type string|null

Value type.

                public function __construct(
    private readonly mixed $value,
    private readonly ?string $type = null,
) {}

            
getType() public method

Get type of the value.

public string|null getType ( )
return string|null

Value type.

                public function getType(): ?string
{
    return $this->type;
}

            
resolve() public method

public mixed resolve ( \Psr\Container\ContainerInterface $container )
$container \Psr\Container\ContainerInterface

                public function resolve(ContainerInterface $container): mixed
{
    return $this->value;
}