コード例 #1
0
 private function setCustomSniffPropertyValues(Sniff $sniff) : Sniff
 {
     $sniffPropertyValues = $this->sniffPropertyValueDataCollector->getForSniff($sniff);
     foreach ($sniffPropertyValues as $property => $value) {
         $sniff->{$property} = $value;
     }
     return $sniff;
 }
コード例 #2
0
 /**
  * @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);
 }