Documentation

AutoDefinition
in package

Table of Contents

Properties

$forceServiceTags  : array<string|int, string>
Oddballs - AutoDefinition can apply a tag to a third-party class/interface. But it's better for classes/interfaces to declare `serviceTags` for themselves.

Methods

create()  : Definition
Create a basic definition for an unnamed service.
findTags()  : array<string|int, mixed>|mixed
Find all `serviceTags` annotations that apply to a class -- either directly or indirectly (via interface, trait, or parent-class).
scan()  : array<string|int, Definition>
Identify any/all service-definitions for the given class.
applyConstructor()  : void
applyObjectMethods()  : void
Scan for any methods with `@inject`. They should be invoked via `$def->addMethodCall()`.
applyObjectProperties()  : void
Scan for any properties with `@inject`. They should be configured via `$def->setProperty()` or via `injectPrivateProperty()`.
applyTags()  : void
createBaseline()  : Definition
pickName()  : string
splitSymbols()  : array<string|int, mixed>
toReferences()  : array<string|int, mixed>

Properties

$forceServiceTags

Oddballs - AutoDefinition can apply a tag to a third-party class/interface. But it's better for classes/interfaces to declare `serviceTags` for themselves.

protected static array<string|int, string> $forceServiceTags = ['Symfony\Component\EventDispatcher\EventSubscriberInterface' => 'event_subscriber']

Methods

create()

Create a basic definition for an unnamed service.

public static create(string $className) : Definition
Parameters
$className : string

The name of the class to scan. Look for @inject and @service annotations.

Return values
Definition

findTags()

Find all `serviceTags` annotations that apply to a class -- either directly or indirectly (via interface, trait, or parent-class).

public static findTags(ReflectionClass $class, array<string|int, mixed>|null $docBlock, bool $isTransitiveLookup) : array<string|int, mixed>|mixed
Parameters
$class : ReflectionClass
$docBlock : array<string|int, mixed>|null
$isTransitiveLookup : bool
Return values
array<string|int, mixed>|mixed

scan()

Identify any/all service-definitions for the given class.

public static scan(string $className) : array<string|int, Definition>

If the class defines any static factory methods, then there may be multiple definitions.

Parameters
$className : string

The name of the class to scan. Look for @inject and @service annotations.

Return values
array<string|int, Definition>

Ex: ['my.service' => new Definition('My\Class')]

applyConstructor()

protected static applyConstructor(Definition $def, ReflectionClass $class) : void
Parameters
$def : Definition
$class : ReflectionClass

applyObjectMethods()

Scan for any methods with `@inject`. They should be invoked via `$def->addMethodCall()`.

protected static applyObjectMethods(Definition $def, ReflectionClass $class) : void
Parameters
$def : Definition
$class : ReflectionClass

applyObjectProperties()

Scan for any properties with `@inject`. They should be configured via `$def->setProperty()` or via `injectPrivateProperty()`.

protected static applyObjectProperties(Definition $def, ReflectionClass $class) : void
Parameters
$def : Definition
$class : ReflectionClass
Tags
throws
Exception

applyTags()

protected static applyTags(Definition $def, ReflectionClass $class, array<string|int, mixed> $docBlock) : void
Parameters
$def : Definition
$class : ReflectionClass
$docBlock : array<string|int, mixed>

createBaseline()

protected static createBaseline(ReflectionClass $class[, array<string|int, mixed>|null $docBlock = [] ]) : Definition
Parameters
$class : ReflectionClass
$docBlock : array<string|int, mixed>|null = []
Return values
Definition

pickName()

protected static pickName(array<string|int, mixed> $docBlock, string $internalDefault) : string
Parameters
$docBlock : array<string|int, mixed>
$internalDefault : string
Return values
string

splitSymbols()

protected static splitSymbols(string $expr) : array<string|int, mixed>
Parameters
$expr : string
Return values
array<string|int, mixed>

toReferences()

protected static toReferences(string $injectExpr) : array<string|int, mixed>
Parameters
$injectExpr : string
Return values
array<string|int, mixed>

        
On this page

Search results