Twig_Error_Syntax
extends SyntaxError
in package
\Exception thrown when a syntax error occurs during lexing or parsing of a template.
Tags
Table of Contents
- $lineno : mixed
- $name : mixed
- $rawMessage : mixed
- $sourceCode : mixed
- $sourcePath : mixed
- __construct() : mixed
- Constructor.
- addSuggestions() : mixed
- Tweaks the error message to include suggestions.
- appendMessage() : mixed
- getRawMessage() : string
- Gets the raw message.
- getSourceContext() : Source|null
- Gets the source context of the Twig template where the error occurred.
- getTemplateLine() : int
- Gets the template line where the error occurred.
- guess() : mixed
- setSourceContext() : mixed
- Sets the source context of the Twig template where the error occurred.
- setTemplateLine() : mixed
- Sets the template line where the error occurred.
- guessTemplateInfo() : mixed
- updateRepr() : mixed
Properties
$lineno
private
mixed
$lineno
$name
private
mixed
$name
$rawMessage
private
mixed
$rawMessage
$sourceCode
private
mixed
$sourceCode
$sourcePath
private
mixed
$sourcePath
Methods
__construct()
Constructor.
public
__construct(string $message[, int $lineno = -1 ][, Source|string|null $source = null ][, Exception $previous = null ]) : mixed
Set the line number to -1 to enable its automatic guessing. Set the name to null to enable its automatic guessing.
Parameters
- $message : string
-
The error message
- $lineno : int = -1
-
The template line where the error occurred
- $source : Source|string|null = null
-
The source context where the error occurred
- $previous : Exception = null
-
The previous exception
Return values
mixed —addSuggestions()
Tweaks the error message to include suggestions.
public
addSuggestions(string $name, array<string|int, mixed> $items) : mixed
Parameters
- $name : string
-
The original name of the item that does not exist
- $items : array<string|int, mixed>
-
An array of possible items
Return values
mixed —appendMessage()
public
appendMessage(mixed $rawMessage) : mixed
Parameters
- $rawMessage : mixed
Return values
mixed —getRawMessage()
Gets the raw message.
public
getRawMessage() : string
Return values
string —The raw message
getSourceContext()
Gets the source context of the Twig template where the error occurred.
public
getSourceContext() : Source|null
Return values
Source|null —getTemplateLine()
Gets the template line where the error occurred.
public
getTemplateLine() : int
Return values
int —The template line
guess()
public
guess() : mixed
Return values
mixed —setSourceContext()
Sets the source context of the Twig template where the error occurred.
public
setSourceContext([Source $source = null ]) : mixed
Parameters
- $source : Source = null
Return values
mixed —setTemplateLine()
Sets the template line where the error occurred.
public
setTemplateLine(int $lineno) : mixed
Parameters
- $lineno : int
-
The template line
Return values
mixed —guessTemplateInfo()
private
guessTemplateInfo() : mixed
Return values
mixed —updateRepr()
private
updateRepr() : mixed