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