/**
  * @return Sniff[]
  */
 public function create(string $rulesetXmlFile) : array
 {
     $sniffs = $this->createSniffsFromOwnRuleset($rulesetXmlFile);
     $rulesetXml = simplexml_load_file($rulesetXmlFile);
     foreach ($rulesetXml->rule as $ruleXmlElement) {
         if ($this->isRuleXmlElementSkipped($ruleXmlElement)) {
             continue;
         }
         $this->excludedSniffDataCollector->collectFromRuleXmlElement($ruleXmlElement);
         $this->customSniffPropertyDataCollector->collectFromRuleXmlElement($ruleXmlElement);
         $sniffs = array_merge($sniffs, $this->sniffSetFactory->create($ruleXmlElement['ref']));
     }
     return SniffSorter::sort($sniffs);
 }
示例#2
0
 private function createAndRegisterSniffsToSniffDispatcher(array $standards, array $extraSniffs)
 {
     $sniffs = $this->sniffSetFactory->createFromStandardsAndSniffs($standards, $extraSniffs);
     $this->sniffDispatcher->addSniffListeners($sniffs);
 }