matcherDefinitions = $matcherDefinitions; $this->validateMatcherDefinitions(); $this->initializeFlatMatcherDefinitions(); } /** * Called by PhpParser. */ public function enterNode(Node $node): null { if (!$this->isFileIgnored($node) && !$this->isLineIgnored($node) && $node instanceof PropertyFetch && $node->name instanceof Identifier && ($node->var->name ?? '') !== 'this' && array_key_exists($node->name->name, $this->flatMatcherDefinitions) ) { $match = [ 'restFiles' => [], 'line' => $node->getAttribute('startLine'), 'message' => 'Fetch of property "' . $node->name->name . '"', 'indicator' => 'weak', ]; foreach ($this->flatMatcherDefinitions[$node->name->name]['candidates'] as $candidate) { $match['restFiles'] = array_unique(array_merge($match['restFiles'], $candidate['restFiles'])); } $this->matches[] = $match; } return null; } }