getRawMessage() public method

Gets the error message
public getRawMessage ( ) : string
return string Error message
Ejemplo n.º 1
0
 private function formatErrorMessage(Error $e, $code)
 {
     if ($e->hasColumnInfo()) {
         return $e->getRawMessage() . ' from ' . $e->getStartLine() . ':' . $e->getStartColumn($code) . ' to ' . $e->getEndLine() . ':' . $e->getEndColumn($code);
     } else {
         return $e->getMessage();
     }
 }
 /**
  * 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());
 }
Ejemplo n.º 3
0
 /**
  * A special test for unclosed single-quoted strings.
  *
  * Unlike (all?) other unclosed statements, single quoted strings have
  * their own special beautiful snowflake syntax error just for
  * themselves.
  *
  * @param \PhpParser\Error $e
  * @param string           $code
  *
  * @return bool
  */
 private function parseErrorIsUnclosedString(\PhpParser\Error $e, $code)
 {
     if ($e->getRawMessage() !== 'Syntax error, unexpected T_ENCAPSED_AND_WHITESPACE') {
         return false;
     }
     try {
         $this->parser->parse($code . "';");
     } catch (\Exception $e) {
         return false;
     }
     return true;
 }
 private function parseErrorIsEOF(\PhpParser\Error $e)
 {
     $msg = $e->getRawMessage();
     return $msg === "Unexpected token EOF" || strpos($msg, "Syntax error, unexpected EOF") !== false;
 }
Ejemplo n.º 5
0
 /**
  * Format a parse error to output to the console.
  *
  * @param  string $fileName
  * @param  Error  $error
  * @return string
  */
 public function formatParseError($fileName, Error $error)
 {
     $result = ' * ';
     $errorMessage = $error->getRawMessage() . ' in ' . $fileName;
     if (($line = $error->getRawLine()) !== -1) {
         $errorMessage .= ' on line ' . $line;
     }
     return $result . wordwrap($errorMessage, $this->consoleWidth - 3, "\n   ", true);
 }
Ejemplo n.º 6
0
 /**
  * @param Error  $exception
  * @param string $filename
  *
  * @return PhpParserError
  */
 public static function fromParseException(Error $exception, $filename)
 {
     return new self(ParseError::TYPE_FATAL, $exception->getRawMessage(), $filename, $exception->getStartLine());
 }