Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions components/expression_language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,26 @@ can chain multiple coalescing operators.

The null-coalescing operator was introduced in Symfony 6.2.

Parsing and Linting Expressions
...............................

The ExpressionLanguage component provides a way to parse and lint expressions.
The :method:`Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage::parse`
method returns a :class:`Symfony\\Component\\ExpressionLanguage\\ParsedExpression`
instance that can be used to inspect and manipulate the expression. The
:method:`Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage::lint`, on the
other hand, returns a boolean indicating if the expression is valid or not::

use Symfony\Component\ExpressionLanguage\ExpressionLanguage;

$expressionLanguage = new ExpressionLanguage();

var_dump($expressionLanguage->parse('1 + 2'));
// displays the AST nodes of the expression which can be
// inspected and manipulated

var_dump($expressionLanguage->lint('1 + 2')); // displays true

Passing in Variables
--------------------

Expand Down