1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Rules\RestrictedUsage;
4:
5: use PHPStan\Analyser\Scope;
6: use PHPStan\Reflection\ClassReflection;
7: use PHPStan\Rules\ClassNameUsageLocation;
8:
9: /**
10: * Extensions implementing this interface are called for each analysed class name usage.
11: *
12: * Extension can decide to create RestrictedUsage object
13: * with error message & error identifier to be reported for this method call.
14: *
15: * Typical usage is to report errors for class names marked as @-deprecated or @-internal.
16: *
17: * Extension can take advantage of the usage location information in the ClassNameUsageLocation object.
18: *
19: * To register the extension in the configuration file use the following tag:
20: *
21: * ```
22: * services:
23: * -
24: * class: App\PHPStan\MyExtension
25: * tags:
26: * - phpstan.restrictedClassNameUsageExtension
27: * ```
28: *
29: * @api
30: */
31: interface RestrictedClassNameUsageExtension
32: {
33:
34: public const CLASS_NAME_EXTENSION_TAG = 'phpstan.restrictedClassNameUsageExtension';
35:
36: public function isRestrictedClassNameUsage(
37: ClassReflection $classReflection,
38: Scope $scope,
39: ClassNameUsageLocation $location,
40: ): ?RestrictedUsage;
41:
42: }
43: