Documentation

Inject
in package

An attribute used to mark a property for automatic dependency injection.

The injector will attempt to retrieve the dependency from the container using the provided dependency id and set the target property.

Table of Contents

__construct()  : mixed
getId()  : string
Return the dependency id.

Methods

__construct()

public __construct([string $dependencyId = null ]) : mixed
Parameters
$dependencyId : string = null

The identifier used to register and retrieve a dependency from the container.

Return values
mixed

getId()

Return the dependency id.

public getId(ReflectionProperty $reflectionProperty) : string

When the dependency id is not provided as a constructor argument, the type name of the property will be returned

Parameters
$reflectionProperty : ReflectionProperty
Tags
throws
IntersectionTypeException

Intersection types are not supported.

throws
UnionTypeException

Union types are not supported.

throws
InvalidAttributeConfigurationException

Either the property should have a type hint or the dependency id should be provided.

Return values
string

Search results