public function review(ReporterInterface $reporter, ReviewableInterface $file)
    {
        $cmd = sprintf('php --syntax-check %s', $file->getFullPath());

        $process = $this->getProcess($cmd);
        $process->run();

        // Create the array of outputs and remove empty values.
        $output = array_filter(explode(PHP_EOL, $process->getOutput()));

        $needle = 'Parse error: syntax error, ';

        if (! $process->isSuccessful()) {
            foreach (array_slice($output, 0, count($output) - 1) as $error) {
                $raw = ucfirst(substr($error, strlen($needle)));
                $message = str_replace(' in ' . $file->getFullPath(), '', $raw);
                $reporter->error($message, $this, $file);
            }
        }
    }
public function review(ReporterInterface $reporter, ReviewableInterface $file)
    {
        $cmd = sprintf('php --syntax-check %s', $file->getFullPath());

        $process = $this->getProcess($cmd);
        $process->run();

        // Create the array of outputs and remove empty values.
        $output = array_filter(explode(PHP_EOL, $process->getOutput()));

        $needle = 'Parse error: syntax error, ';

        if (! $process->isSuccessful()) {
            foreach (array_slice($output, 0, count($output) - 1) as $error) {
                $raw = ucfirst(substr($error, strlen($needle)));
                $message = str_replace(' in ' . $file->getFullPath(), '', $raw);
                $reporter->error($message, $this, $file);
            }
        }
    }
public function review ( ReporterInterface $ reporter , ReviewableInterface $ file ) { $ cmd = sprintf ( 'php --syntax-check %s' , $ file -> getFullPath ( ) ) ; $ process = $ this -> getProcess ( $ cmd ) ; $ process -> run ( ) ; // Create the array of outputs and remove empty values. $ output = array_filter ( explode ( PHP_EOL , $ process -> getOutput ( ) ) ) ; $ needle = 'Parse error: syntax error, ' ; if ( ! $ process -> isSuccessful ( ) ) { foreach ( array_slice ( $ output , 0 , count ( $ output ) - 1 ) as $ error ) { $ raw = ucfirst ( substr ( $ error , strlen ( $ needle ) ) ) ; $ message = str_replace ( ' in ' . $ file -> getFullPath ( ) , '' , $ raw ) ; $ reporter -> error ( $ message , $ this , $ file ) ; } } }
Checks PHP files using the builtin PHP linter, `php -l`.
Checks PHP files using the builtin PHP linter php - l .