| Classes | |
|---|---|
| Assertions | Collection of @phpstan-assert annotations on a function or method. PHPStan supports type assertions via PHPDoc annotations:
|
| AttributeReflection | Reflection for a PHP attribute (PHP 8.0+). Represents a single attribute applied to a class, method, property, function, parameter, or constant. Provides the attribute's class name and the types of its constructor arguments. Returned by the getAttributes() method on ExtendedMethodReflection, ExtendedPropertyReflection, FunctionReflection, ClassConstantReflection, etc. |
| ClassReflection | |
| EnumCaseReflection | |
| ExtendedFunctionVariant | |
| FunctionVariant | |
| GenericParametersAcceptorResolver | |
| InitializerExprContext | |
| InitializerExprTypeResolver | |
| ParametersAcceptorSelector | |
| PassedByReference | Describes how a function/method parameter is passed: by value or by reference. Three modes:
|
| TrivialParametersAcceptor | |
| Interfaces | |
| AdditionalConstructorsExtension | This is the extension interface to implement if you want to dynamically
mark methods as constructor. As opposed to simply list them in the configuration file. To register it in the configuration file use the
|
| AllowedSubTypesClassReflectionExtension | This is the extension interface to implement if you want to described
allowed subtypes - to limit which classes can implement a certain interface
or extend a certain parent class. To register it in the configuration file use the
|
| ClassConstantReflection | Reflection for a class constant. Combines ClassMemberReflection (declaring class, visibility) with ConstantReflection (name, value type, deprecation) and adds class-constant-specific features: the value expression AST, final modifier, and separate PHPDoc/native types. PHP 8.3+ supports native type declarations on class constants, so this interface provides both PHPDoc and native type accessors (similar to property reflection). This is the return type of Type::getConstant() and Scope::getConstantReflection(). |
| ClassMemberAccessAnswerer | Answers questions about visibility and access rights for class members (properties, methods, constants) from the current analysis context. This interface is the Scope's role as an access control checker. It is passed as a parameter to Type methods like getMethod(), getProperty(), getConstant(), etc., so the type system can enforce visibility rules (public/protected/private) based on where the access occurs. The primary implementation is MutatingScope. A secondary implementation, OutOfClassScope, is used when accessing members from outside any class. |
| ClassMemberReflection | Base interface for all class members: properties, methods, and constants. Provides common metadata shared by all class members — their declaring class, visibility (public/private/protected), static-ness, and raw PHPDoc comment. This is the parent interface for PropertyReflection, MethodReflection, and (via ConstantReflection) ClassConstantReflection. Extension developers typically work with the more specific child interfaces. |
| ConstantReflection | Reflection for a constant (class constant or global constant). Provides the constant's name, resolved value type, deprecation status, and metadata. This is the base interface — ClassConstantReflection extends it with class-specific features (declaring class, value expression, native type). |
| ExtendedMethodReflection | Extended method reflection with additional metadata beyond MethodReflection. This interface exists to allow PHPStan to add new method query methods in minor versions without breaking existing MethodsClassReflectionExtension implementations. Extension developers should implement MethodReflection, not this interface — PHPStan wraps MethodReflection implementations to provide ExtendedMethodReflection. Provides access to:
|
| ExtendedParameterReflection | |
| ExtendedParametersAcceptor | Extended function/method signature with separate PHPDoc and native types. Extends ParametersAcceptor with:
|
| ExtendedPropertyReflection | Extended property reflection with additional metadata beyond PropertyReflection. This interface exists to allow PHPStan to add new property query methods in minor versions without breaking existing PropertiesClassReflectionExtension implementations. Extension developers should implement PropertyReflection, not this interface — PHPStan wraps PropertyReflection implementations to provide ExtendedPropertyReflection. Provides access to:
|
| FunctionReflection | Reflection for a standalone function (not a class method). Represents both built-in PHP functions and user-defined functions. Like methods, functions can have multiple "variants" (overloaded signatures) — particularly common for built-in functions where the return type depends on argument types. Extension developers encounter this interface when implementing DynamicFunctionReturnTypeExtension or FunctionTypeSpecifyingExtension. Functions referenced in Scope::getFunctionCallStack() may be either FunctionReflection or MethodReflection. |
| MethodReflection | Reflection for a class method. This is the interface extension developers should implement when creating custom
MethodsClassReflectionExtension implementations for magic methods (__call, etc.). Methods can have multiple "variants" (overloaded signatures) — for example,
built-in functions like |
| MethodsClassReflectionExtension | This is the interface custom methods class reflection extensions implement. To register it in the configuration file use the
|
| NamespaceAnswerer | Provides the current namespace context. Used by the type resolver and PHPDoc parser to resolve relative class names against the current namespace and use statements. |
| ParameterReflection | Reflection for a function/method parameter. Represents a single parameter in a function or method signature. Each parameter has a name, type, and metadata about optionality, variadicity, and pass-by-reference. The type returned by getType() is the combined PHPDoc + native type. For separate PHPDoc and native types, see ExtendedParameterReflection. Part of a ParametersAcceptor which describes a complete function signature. |
| ParametersAcceptor | Describes one signature variant of a function or method. A function/method may have multiple ParametersAcceptor variants — for example,
the built-in |
| PropertiesClassReflectionExtension | This is the interface custom properties class reflection extensions implement. To register it in the configuration file use the
|
| PropertyReflection | Reflection for a class property. This is the interface extension developers should implement when creating custom PropertiesClassReflectionExtension implementations for magic properties. Properties have separate readable and writable types to support:
|
| ReflectionProvider | |
| Namespaces | |
| PHPStan\Reflection\Callables | |
| PHPStan\Reflection\Deprecation | |
| PHPStan\Reflection\Php | |