Ejemplo n.º 1
0
 /**
  * @param ReporterInterface   $reporter
  * @param ReviewableInterface $subject
  * @param string              $message
  */
 protected function scanMessage(ReporterInterface $reporter, ReviewableInterface $subject, string $message)
 {
     if ($message == 'F') {
         $message = 'Styling has been fixed in ' . $subject->getName();
         $this->getClimate()->green($message);
         $reporter->info($message, $this, $subject);
     }
 }
Ejemplo n.º 2
0
 /**
  * Checks PHP files using php-cs-fixer.
  */
 public function review(ReporterInterface $reporter, ReviewableInterface $file = null)
 {
     $cmd = sprintf('php-cs-fixer fix -v %s --config-file %s', $file->getFullPath(), self::PHP_CS_FIXER_RULE_DIR);
     $process = $this->getProcess($cmd);
     $process->run();
     // Create the array of outputs and remove empty values.
     $output = array_filter(explode(PHP_EOL, $process->getOutput()));
     if (!$process->isSuccessful()) {
         foreach (array_slice($output, 3, -1) as $error) {
             $raw = ucfirst($error);
             $message = trim(str_replace('   1) ' . $file->getFullPath(), '', $raw));
             $reporter->info($message, $this, $file);
             if ($this->autoAddGit) {
                 $cmd = sprintf('git add %s', $file->getFullPath());
                 $process = $this->getProcess($cmd);
                 $process->run();
             }
         }
     }
 }