SqlParser\Lexer::error PHP Метод

error() публичный Метод

Creates a new error log.
public error ( string $msg = '', string $str = '', integer $pos, integer $code ) : void
$msg string The error message.
$str string The character that produced the error.
$pos integer The position of the character.
$code integer The code of the error.
Результат void
    public function error($msg = '', $str = '', $pos = 0, $code = 0)
    {
        $error = new LexerException($msg, $str, $pos, $code);
        if ($this->strict) {
            throw $error;
        }
        $this->errors[] = $error;
    }

Usage Example

Пример #1
0
 /**
  * @expectedException SqlParser\Exceptions\LexerException
  * @expectedExceptionMessage strict error
  * @expectedExceptionCode 4
  */
 public function testErrorStrict()
 {
     $lexer = new Lexer('');
     $lexer->strict = true;
     $lexer->error(__('strict error'), 'foo', 1, 4);
 }