protected function processFile(SplFileInfo $file): array
    {
        $realPath = $file->getRealPath();
        if ($this->output->isDebug()) {
            $this->output->writeln('Process file: ' . $realPath);
        }

        if ($realPath === false) {
            throw new RuntimeException(sprintf('File not found: %s', $file));
        }

        $processor = new FileProcessor($realPath);
        $check = new FileCheck();

        if (!$this->skipClasses) {
            $check->processFileClasses($processor->getClasses(), $realPath);
        }

        if (!$this->skipMethods) {
            $check->processFileMethods($processor->getMethods(), $realPath);
        }

        if (!$this->skipSignatures) {
            $check->processFileSignatues($processor->getMethods(), $realPath);
        }

        foreach ($check->getErrors() as $errorItem) {
            if ($this->output->isDebug()) {
                $this->output->writeln('Error in line: ' . var_export($errorItem, true));
            }
            $this->errors[] = $errorItem;
        }

        foreach ($check->getWarnings() as $warningEntry) {
            if ($this->output->isDebug()) {
                $this->output->writeln('Warning in line: ' . var_export($warningEntry, true));
            }
            $this->warnings[] = $warningEntry;
        }

        $hasErrors = !empty($errorItem);
        $hasWarnings = !empty($warningEntry);

        if (!$hasErrors) {
            $this->passed++;
        }

        return [$hasErrors, $hasWarnings];
    }
protected function processFile(SplFileInfo $file): array
    {
        $realPath = $file->getRealPath();
        if ($this->output->isDebug()) {
            $this->output->writeln('Process file: ' . $realPath);
        }

        if ($realPath === false) {
            throw new RuntimeException(sprintf('File not found: %s', $file));
        }

        $processor = new FileProcessor($realPath);
        $check = new FileCheck();

        if (!$this->skipClasses) {
            $check->processFileClasses($processor->getClasses(), $realPath);
        }

        if (!$this->skipMethods) {
            $check->processFileMethods($processor->getMethods(), $realPath);
        }

        if (!$this->skipSignatures) {
            $check->processFileSignatues($processor->getMethods(), $realPath);
        }

        foreach ($check->getErrors() as $errorItem) {
            if ($this->output->isDebug()) {
                $this->output->writeln('Error in line: ' . var_export($errorItem, true));
            }
            $this->errors[] = $errorItem;
        }

        foreach ($check->getWarnings() as $warningEntry) {
            if ($this->output->isDebug()) {
                $this->output->writeln('Warning in line: ' . var_export($warningEntry, true));
            }
            $this->warnings[] = $warningEntry;
        }

        $hasErrors = !empty($errorItem);
        $hasWarnings = !empty($warningEntry);

        if (!$hasErrors) {
            $this->passed++;
        }

        return [$hasErrors, $hasWarnings];
    }
protected function processFile ( SplFileInfo $ file ) : array { $ realPath = $ file -> getRealPath ( ) ; if ( $ this -> output -> isDebug ( ) ) { $ this -> output -> writeln ( 'Process file: ' . $ realPath ) ; } if ( $ realPath === false ) { throw new RuntimeException ( sprintf ( 'File not found: %s' , $ file ) ) ; } $ processor = new FileProcessor ( $ realPath ) ; $ check = new FileCheck ( ) ; if ( ! $ this -> skipClasses ) { $ check -> processFileClasses ( $ processor -> getClasses ( ) , $ realPath ) ; } if ( ! $ this -> skipMethods ) { $ check -> processFileMethods ( $ processor -> getMethods ( ) , $ realPath ) ; } if ( ! $ this -> skipSignatures ) { $ check -> processFileSignatues ( $ processor -> getMethods ( ) , $ realPath ) ; } foreach ( $ check -> getErrors ( ) as $ errorItem ) { if ( $ this -> output -> isDebug ( ) ) { $ this -> output -> writeln ( 'Error in line: ' . var_export ( $ errorItem , true ) ) ; } $ this -> errors [ ] = $ errorItem ; } foreach ( $ check -> getWarnings ( ) as $ warningEntry ) { if ( $ this -> output -> isDebug ( ) ) { $ this -> output -> writeln ( 'Warning in line: ' . var_export ( $ warningEntry , true ) ) ; } $ this -> warnings [ ] = $ warningEntry ; } $ hasErrors = ! empty ( $ errorItem ) ; $ hasWarnings = ! empty ( $ warningEntry ) ; if ( ! $ hasErrors ) { $ this -> passed ++ ; } return [ $ hasErrors , $ hasWarnings ] ; }
Check a specific PHP file for errors.

@param SplFileInfo $file

@return array
Check a specific PHP file for errors .