Interface PHPStan\Rules\RestrictedUsage\RestrictedClassNameUsageExtension

Extensions implementing this interface are called for each analysed class name usage.

Extension can decide to create RestrictedUsage object with error message & error identifier to be reported for this method call.

Typical usage is to report errors for class names marked as @-deprecated or @-internal.

Extension can take advantage of the usage location information in the ClassNameUsageLocation object.

To register the extension in the configuration file use the following tag:

services:
	-
		class: App\PHPStan\MyExtension
		tags:
			- phpstan.restrictedClassNameUsageExtension
  • PHPStan\Rules\RestrictedUsage\RestrictedClassNameUsageExtension
    • PHPStan\Rules\InternalTag\RestrictedInternalClassNameUsageExtension implements RestrictedClassNameUsageExtension
Methods