1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\DependencyInjection;
4:
5: use Attribute;
6:
7: /**
8: * Registers a non-autowired named service in the DI container.
9: *
10: * The factory is a method of another service like '@App\MyFactory::create',
11: * or a static method like 'App\MyFactory::create'.
12: *
13: * Works thanks to https://github.com/ondrejmirtes/composer-attribute-collector
14: * and AutowiredAttributeServicesExtension.
15: *
16: * @api
17: */
18: #[Attribute(flags: Attribute::TARGET_CLASS)]
19: final class NonAutowiredService
20: {
21:
22: /** @api */
23: public function __construct(
24: public string $name,
25: public ?string $factory = null,
26: )
27: {
28: }
29:
30: }
31: