public function traverse($path, RuleSet $ruleSet = null)
{
$result = $this->finder->parsePhpFiles($path);
if (!$ruleSet instanceof RuleSet) {
$ruleSet = new RuleSet();
}
foreach ($result->parsedFiles() as $file) {
if ($file->hasDeprecations()) {
$ruleSet->merge($file);
}
}
return $ruleSet;
}
/** * {@inheritdoc} */ public function loadRuleSet($path) { $key = $this->generateDirectoryKey($path); if ($this->cache->has($key)) { return $this->cache->getCachedRuleSet($key); } $ruleSet = $this->traverser->traverse($path); $this->cache->cacheRuleSet($key, $ruleSet); return $ruleSet; }