PHP Class PhpParser\Error

Inheritance: extends RuntimeException
Show file Open project: nikic/php-parser Class Usage Examples

Protected Properties

Property Type Description
$attributes
$rawMessage

Public Methods

Method Description
__construct ( string $message, array | integer $attributes = [] ) Creates an Exception signifying a parse error.
getAttributes ( ) : array Gets the attributes of the node/token the error occurred at.
getEndColumn ( string $code ) : integer Gets the end column (1-based) into the line where the error ended.
getEndLine ( ) : integer Gets the line the error ends in.
getMessageWithColumnInfo ( $code )
getRawMessage ( ) : string Gets the error message
getStartColumn ( string $code ) : integer Gets the start column (1-based) into the line where the error started.
getStartLine ( ) : integer Gets the line the error starts in.
hasColumnInfo ( ) : boolean Returns whether the error has start and end column information.
setAttributes ( array $attributes ) Sets the attributes of the node/token the error occured at.
setRawMessage ( string $message ) Sets the line of the PHP file the error occurred in.
setStartLine ( integer $line ) Sets the line the error starts in.

Protected Methods

Method Description
updateMessage ( ) Updates the exception message after a change to rawMessage or rawLine.

Private Methods

Method Description
toColumn ( $code, $pos )

Method Details

__construct() public method

Creates an Exception signifying a parse error.
public __construct ( string $message, array | integer $attributes = [] )
$message string Error message
$attributes array | integer Attributes of node/token where error occurred (or start line of error -- deprecated)

getAttributes() public method

Gets the attributes of the node/token the error occurred at.
public getAttributes ( ) : array
return array

getEndColumn() public method

Gets the end column (1-based) into the line where the error ended.
public getEndColumn ( string $code ) : integer
$code string Source code of the file
return integer

getEndLine() public method

Gets the line the error ends in.
public getEndLine ( ) : integer
return integer Error end line

getMessageWithColumnInfo() public method

public getMessageWithColumnInfo ( $code )

getRawMessage() public method

Gets the error message
public getRawMessage ( ) : string
return string Error message

getStartColumn() public method

Gets the start column (1-based) into the line where the error started.
public getStartColumn ( string $code ) : integer
$code string Source code of the file
return integer

getStartLine() public method

Gets the line the error starts in.
public getStartLine ( ) : integer
return integer Error start line

hasColumnInfo() public method

For column information enable the startFilePos and endFilePos in the lexer options.
public hasColumnInfo ( ) : boolean
return boolean

setAttributes() public method

Sets the attributes of the node/token the error occured at.
public setAttributes ( array $attributes )
$attributes array

setRawMessage() public method

Sets the line of the PHP file the error occurred in.
public setRawMessage ( string $message )
$message string Error message

setStartLine() public method

Sets the line the error starts in.
public setStartLine ( integer $line )
$line integer Error start line

updateMessage() protected method

Updates the exception message after a change to rawMessage or rawLine.
protected updateMessage ( )

Property Details

$attributes protected property

protected $attributes

$rawMessage protected property

protected $rawMessage