class SourceFiles

internal  
 

Finds the files that values read through reflection come from, for result cache dependencies.

PHPStan analyzes the dependents of a class again only when its declarations change. Property defaults and method bodies are not part of them, and a changed constant reaches only the files naming its class.

Methods

static array
forClass(ClassReflection $classReflection, string|null $baseClass)

Get the files declaring a class and its parents below a base class, with the traits each uses.

static array
forInstance(ReflectionProvider $reflectionProvider, ClassReflection $classReflection, string|null $baseClass)

Get the files an instance's property defaults and method bodies come from: those declaring the class and its parents below a base class, with their traits, and those of the constants the defaults read.

static array
forConstant(ReflectionProvider $reflectionProvider, ClassReflection $classReflection, string $name)

Get the files a constant read through a class takes its value from: those declaring the class and its parents up to the declaring class, as any of them can override it, and those of the constants it reads.

static array
forAttributeArguments(ReflectionProvider $reflectionProvider, ClassReflection $classReflection, string $attributeClass, string|null $method = null)

Get the files of the constants the arguments of a class's or trait's attribute read, or those of the attribute on one of its methods.

static array
forParameterDefault(ReflectionProvider $reflectionProvider, ClassReflection $classReflection, string $method, string $parameter)

Get the files a method parameter's declared default comes from: the one declaring the method and those of the constants the default reads.

Details

at line 34
static array forClass(ClassReflection $classReflection, string|null $baseClass)

Get the files declaring a class and its parents below a base class, with the traits each uses.

Parameters

ClassReflection $classReflection
string|null $baseClass

Return Value

array

at line 69
static array forInstance(ReflectionProvider $reflectionProvider, ClassReflection $classReflection, string|null $baseClass)

Get the files an instance's property defaults and method bodies come from: those declaring the class and its parents below a base class, with their traits, and those of the constants the defaults read.

Parameters

ReflectionProvider $reflectionProvider
ClassReflection $classReflection
string|null $baseClass

Return Value

array

at line 102
static array forConstant(ReflectionProvider $reflectionProvider, ClassReflection $classReflection, string $name)

Get the files a constant read through a class takes its value from: those declaring the class and its parents up to the declaring class, as any of them can override it, and those of the constants it reads.

Parameters

ReflectionProvider $reflectionProvider
ClassReflection $classReflection
string $name

Return Value

array

at line 118
static array forAttributeArguments(ReflectionProvider $reflectionProvider, ClassReflection $classReflection, string $attributeClass, string|null $method = null)

Get the files of the constants the arguments of a class's or trait's attribute read, or those of the attribute on one of its methods.

Parameters

ReflectionProvider $reflectionProvider
ClassReflection $classReflection
string $attributeClass
string|null $method

Return Value

array

at line 140
static array forParameterDefault(ReflectionProvider $reflectionProvider, ClassReflection $classReflection, string $method, string $parameter)

Get the files a method parameter's declared default comes from: the one declaring the method and those of the constants the default reads.

Parameters

ReflectionProvider $reflectionProvider
ClassReflection $classReflection
string $method
string $parameter

Return Value

array