Пример #1
0
 private function parseErrorIsEOF(\PHPParser_Error $e)
 {
     $msg = $e->getRawMessage();
     return $msg === "Unexpected token EOF" || strpos($msg, "Syntax error, unexpected EOF") !== false;
 }
Пример #2
0
 public function testUnknownLine()
 {
     $error = new PHPParser_Error('Some error');
     $this->assertEquals(-1, $error->getRawLine());
     $this->assertEquals('Some error on unknown line', $error->getMessage());
 }
Пример #3
0
 /**
  * Create a ParseErrorException from a PHPParser Error.
  *
  * @param \PHPParser_Error $e
  *
  * @return ParseErrorException
  */
 public static function fromParseError(\PHPParser_Error $e)
 {
     return new self($e->getRawMessage(), $e->getRawLine());
 }