final class Helpers

internal  
 

The DI helpers.

Methods

static mixed
expand(mixed $var, array $params, bool|array $recursive = false)

Expands %placeholders%.

static mixed
escape(mixed $value)

Escapes '%' and '@'

static array
filterArguments(array $args)

Converts @service strings to Reference objects recursively.

static mixed
prefixServiceName(mixed $config, string $namespace)

Replaces @extension with real extension name in service definition.

static string
ensureClassType(Type|null $type, string $hint, bool $allowNullable = false)

Validates that the type is a non-nullable class type and returns the class name.

static string
normalizeClass(string $type)

Normalizes class name to its canonical form using reflection.

static mixed
convertType(mixed $value, string $type)

Non data-loss type conversion.

Details

at line 32
static mixed expand(mixed $var, array $params, bool|array $recursive = false)

Expands %placeholders%.

Parameters

mixed $var
array $params
bool|array $recursive

Return Value

mixed

Exceptions

InvalidArgumentException

at line 138
static mixed escape(mixed $value)

Escapes '%' and '@'

Parameters

mixed $value

Return Value

mixed

at line 161
static array filterArguments(array $args)

Converts @service strings to Reference objects recursively.

Parameters

array $args

Return Value

array

at line 181
static mixed prefixServiceName(mixed $config, string $namespace)

Replaces @extension with real extension name in service definition.

Parameters

mixed $config
string $namespace

Return Value

mixed

at line 211
static string ensureClassType(Type|null $type, string $hint, bool $allowNullable = false)

Validates that the type is a non-nullable class type and returns the class name.

Parameters

Type|null $type
string $hint
bool $allowNullable

Return Value

string

Exceptions

ServiceCreationException

at line 234
static string normalizeClass(string $type)

Normalizes class name to its canonical form using reflection.

Parameters

string $type

Return Value

string

at line 246
static mixed convertType(mixed $value, string $type)

Non data-loss type conversion.

Parameters

mixed $value
string $type

Return Value

mixed

Exceptions

InvalidStateException

Traits

StaticClass