Interface PHPStan\Analyser\DependencyTracker

The interface DependencyTracker can be typehinted in 2nd parameter of Rule::processNode() and Collector::processNode(), and in the Scope parameter of dynamic return type extensions, dynamic throw type extensions, expression type resolver extensions, parameter out type extensions, parameter closure type extensions, parameter closure this extensions and type-specifying extensions:

/**
 * @param Scope&DependencyTracker $scope
 *\/
public function processNode(Node $node, Scope $scope): array

The intersection goes to the PHPDoc: the native parameter type stays Scope, which is what the interfaces declare once PHPStan is downgraded for older PHP versions.

It tracks what the analysis of the current file depends on besides the analysed code, so that the result cache re-analyses the file when that changes - see ResultCacheValueExtension. In a rule for CollectedDataNode, it tracks what the errors of the rule depend on: with the reuseCollectedDataRuleErrors feature toggle, the result cache reuses the errors of such a rule while its collected data and the tracked values stay the same. A rule that does not call get() on the node runs every time.

Extensions that get no Scope because they describe a class - class reflection extensions - use DeclarationDependencyTracker instead.

Methods