function AutowireCallable::__construct
Parameters
string|array|null $callable The callable to autowire:
string|null $service The service containing the callable to autowire:
string|null $method The method name that will be autowired:
bool|class-string $lazy Whether to use lazy-loading for this argument:
Overrides AutowireInline::__construct
2 calls to AutowireCallable::__construct()
- AutowireMethodOf::__construct in vendor/
symfony/ dependency-injection/ Attribute/ AutowireMethodOf.php - AutowireMethodOf::__construct in vendor/
symfony/ dependency-injection/ Attribute/ AutowireMethodOf.php
1 method overrides AutowireCallable::__construct()
- AutowireMethodOf::__construct in vendor/
symfony/ dependency-injection/ Attribute/ AutowireMethodOf.php
File
-
vendor/
symfony/ dependency-injection/ Attribute/ AutowireCallable.php, line 30
Class
- AutowireCallable
- Attribute to tell which callable to give to an argument of type Closure.
Namespace
Symfony\Component\DependencyInjection\AttributeCode
public function __construct(string|array|null $callable = null, ?string $service = null, ?string $method = null, bool|string $lazy = false) {
if (!(null !== $callable xor null !== $service)) {
throw new LogicException('#[AutowireCallable] attribute must declare exactly one of $callable or $service.');
}
if (null === $service && null !== $method) {
throw new LogicException('#[AutowireCallable] attribute cannot have a $method without a $service.');
}
Autowire::__construct($callable ?? [
new Reference($service),
$method ?? '__invoke',
], lazy: $lazy);
}