PHP_CodeSniffer_File::getErrors PHP Method

getErrors() public method

Returns the errors raised from processing this file.
public getErrors ( ) : array
return array
    public function getErrors()
    {
        return $this->_errors;
    }

Usage Example

Exemplo n.º 1
0
 private function handlePHPCSErrors(File $file, \PHP_CodeSniffer_File $phpcsFile)
 {
     $maxLine = strlen(max(array_keys($phpcsFile->getErrors())));
     $byLine = $this->prepareFileContent($file);
     foreach ($phpcsFile->getErrors() as $lineNumber => $errorsByLine) {
         $message = sprintf("   | Line %{$maxLine}s:%s\n", $lineNumber, $byLine[$lineNumber + 1]);
         foreach ($errorsByLine as $column => $errorsCollection) {
             foreach ($errorsCollection as $error) {
                 $message .= sprintf("   |%{$maxLine}s| Error at column %s: %s\n", '', $column, $error['message']);
             }
         }
         $this->pushError($message);
     }
 }
All Usage Examples Of PHP_CodeSniffer_File::getErrors