| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\Reflection; |
| 4: | |
| 5: | use PHPStan\Type\Type; |
| 6: | |
| 7: | /** |
| 8: | * This is the extension interface to implement if you want to described |
| 9: | * allowed subtypes - to limit which classes can implement a certain interface |
| 10: | * or extend a certain parent class. |
| 11: | * |
| 12: | * To register it in the configuration file use the `phpstan.broker.allowedSubTypesClassReflectionExtension` service tag: |
| 13: | * |
| 14: | * ``` |
| 15: | * services: |
| 16: | * - |
| 17: | * class: App\PHPStan\MyExtension |
| 18: | * tags: |
| 19: | * - phpstan.broker.allowedSubTypesClassReflectionExtension |
| 20: | * ``` |
| 21: | * |
| 22: | * Learn more: https://phpstan.org/developing-extensions/allowed-subtypes |
| 23: | * |
| 24: | * @api |
| 25: | */ |
| 26: | interface AllowedSubTypesClassReflectionExtension |
| 27: | { |
| 28: | |
| 29: | public function supports(ClassReflection $classReflection): bool; |
| 30: | |
| 31: | /** |
| 32: | * @return array<Type> |
| 33: | */ |
| 34: | public function getAllowedSubTypes(ClassReflection $classReflection): array; |
| 35: | |
| 36: | } |
| 37: |