Ejemplo n.º 1
0
 public function filterOutAbstractAndNonPhpSniffClasses(array $originSniffClasses) : array
 {
     $finalSniffClasses = [];
     foreach ($originSniffClasses as $sniffClass) {
         if ($this->isAbstractClass($sniffClass)) {
             continue;
         }
         if (!$this->doesSniffSupportsPhp($sniffClass)) {
             continue;
         }
         $sniffCode = SniffNaming::guessCodeByClass($sniffClass);
         $finalSniffClasses[$sniffCode] = $sniffClass;
     }
     return $finalSniffClasses;
 }
 public function getCurrentListenerSniffCode() : string
 {
     if (!is_callable($this->currentListener)) {
         return '';
     }
     if (isset($this->sniffClassToSniffCodeMap[$this->currentListener])) {
         return $this->sniffClassToSniffCodeMap[$this->currentListener];
     }
     $closureReflection = new ReflectionFunction($this->currentListener);
     if (!isset($closureReflection->getStaticVariables()['sniffObject'])) {
         return '';
     }
     $sniffClass = get_class($closureReflection->getStaticVariables()['sniffObject']);
     $sniffCode = SniffNaming::guessCodeByClass($sniffClass);
     return $this->sniffClassToSniffCodeMap[$this->currentListener] = $sniffCode;
 }
 public function isSniffClassExcluded(string $sniffClassName) : bool
 {
     $sniffCode = SniffNaming::guessCodeByClass($sniffClassName);
     return $this->isSniffCodeExcluded($sniffCode);
 }