getStartLine() public method

Gets the line the error starts in.
public getStartLine ( ) : integer
return integer Error start line
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();
     }
 }
Ejemplo n.º 2
0
 /**
  * @param \PhpParser\Error $exception
  * @param string $filepath
  * @return bool
  */
 public function sytaxError(\PhpParser\Error $exception, $filepath)
 {
     $code = file($filepath);
     $this->output->writeln('<error>Syntax error:  ' . $exception->getMessage() . " in {$filepath} </error>");
     $this->output->writeln('');
     $code = trim($code[$exception->getStartLine() - 2]);
     $this->output->writeln("<comment>\t {$code} </comment>");
     return true;
 }
Ejemplo n.º 3
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());
 }
Ejemplo n.º 4
0
 /**
  * Creates a syntax error message.
  *
  * @param \PhpParser\Error $exception
  * @param string $filepath
  * @return bool
  */
 public function syntaxError(\PhpParser\Error $exception, $filepath)
 {
     $code = file($filepath);
     $this->output->writeln('<error>Syntax error:  ' . $exception->getMessage() . " in {$filepath} </error>");
     $this->output->writeln('');
     $issueCollector = $this->application->getIssuesCollector();
     $issueCollector->addIssue(new Issue('syntax-error', 'syntax-error', new IssueLocation($filepath, $exception->getStartLine() - 2)));
     $code = trim($code[$exception->getStartLine() - 2]);
     $this->output->writeln("<comment>\t {$code} </comment>");
     return true;
 }