1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Classes; |
4: | |
5: | /** |
6: | * This is the extension interface to implement if you want to dynamically |
7: | * add forbidden class prefixes to the ClassForbiddenNameCheck rule. |
8: | * |
9: | * The idea is that you want to report usages of classes that you're not supposed to use in application. |
10: | * For example: Generated Doctrine proxies from their configured namespace. |
11: | * |
12: | * To register it in the configuration file use the `phpstan.forbiddenClassNamesExtension` service tag: |
13: | * |
14: | * ``` |
15: | * services: |
16: | * - |
17: | * class: App\PHPStan\MyExtension |
18: | * tags: |
19: | * - phpstan.forbiddenClassNamesExtension |
20: | * ``` |
21: | * |
22: | * @api |
23: | */ |
24: | interface ForbiddenClassNameExtension |
25: | { |
26: | |
27: | public const EXTENSION_TAG = 'phpstan.forbiddenClassNamesExtension'; |
28: | |
29: | /** @return array<string, string> */ |
30: | public function getClassPrefixes(): array; |
31: | |
32: | } |
33: |