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