| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\DependencyInjection; |
| 4: | |
| 5: | use Attribute; |
| 6: | |
| 7: | /** |
| 8: | * Autowires constructor parameters in service classes using #[AutowiredService], |
| 9: | * #[GenerateFactory], #[RegisteredRule] or #[RegisteredCollector] attributes. |
| 10: | * |
| 11: | * If ref is omitted, it looks for parameter of the same name. |
| 12: | * |
| 13: | * Works thanks to https://github.com/ondrejmirtes/composer-attribute-collector |
| 14: | * and AutowiredAttributeServicesExtension. |
| 15: | * |
| 16: | * @api |
| 17: | */ |
| 18: | #[Attribute(flags: Attribute::TARGET_PARAMETER)] |
| 19: | final class AutowiredParameter |
| 20: | { |
| 21: | |
| 22: | /** @api */ |
| 23: | public function __construct(public ?string $ref = null) |
| 24: | { |
| 25: | } |
| 26: | |
| 27: | } |
| 28: |