| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\DependencyInjection; |
| 4: | |
| 5: | use Attribute; |
| 6: | |
| 7: | /** |
| 8: | * Marks an extension interface and associates it with its service tag. |
| 9: | * |
| 10: | * Services registered with #[AutowiredService] that implement the interface |
| 11: | * get the tag automatically. ValidateServiceTagsExtension checks that manually |
| 12: | * tagged services implement the associated interface. |
| 13: | * |
| 14: | * Third-party interfaces get the attribute in a directory from the |
| 15: | * attributeServicesDirectories section, or are listed in the extensionInterfaces |
| 16: | * section of the configuration file instead. |
| 17: | * |
| 18: | * Works thanks to https://github.com/ondrejmirtes/composer-attribute-collector |
| 19: | * and AutowiredAttributeServicesExtension. |
| 20: | * |
| 21: | * @api |
| 22: | */ |
| 23: | #[Attribute(flags: Attribute::TARGET_CLASS)] |
| 24: | final class ExtensionInterface |
| 25: | { |
| 26: | |
| 27: | /** @api */ |
| 28: | public function __construct(public string $tag) |
| 29: | { |
| 30: | } |
| 31: | |
| 32: | } |
| 33: |