File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,26 @@ can chain multiple coalescing operators.
9292* ``foo[3] ?? 'no' ``
9393* ``foo.baz ?? foo['baz'] ?? 'no' ``
9494
95+ Parsing and Linting Expressions
96+ ...............................
97+
98+ The ExpressionLanguage component provides a way to parse and lint expressions.
99+ The :method: `Symfony\\ Component\\ ExpressionLanguage\\ ExpressionLanguage::parse `
100+ method returns a :class: `Symfony\\ Component\\ ExpressionLanguage\\ ParsedExpression `
101+ instance that can be used to inspect and manipulate the expression. The
102+ :method: `Symfony\\ Component\\ ExpressionLanguage\\ ExpressionLanguage::lint `, on the
103+ other hand, returns a boolean indicating if the expression is valid or not::
104+
105+ use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
106+
107+ $expressionLanguage = new ExpressionLanguage();
108+
109+ var_dump($expressionLanguage->parse('1 + 2'));
110+ // displays the AST nodes of the expression which can be
111+ // inspected and manipulated
112+
113+ var_dump($expressionLanguage->lint('1 + 2')); // displays true
114+
95115Passing in Variables
96116--------------------
97117
Original file line number Diff line number Diff line change @@ -509,7 +509,7 @@ like this::
509509 $cloner = new VarCloner();
510510 $dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDumper();
511511
512- $dumper->dump($cloner->cloneVar($var));
512+ return $dumper->dump($cloner->cloneVar($var));
513513 });
514514
515515Cloners
You can’t perform that action at this time.
0 commit comments