File tree 1 file changed +20
-0
lines changed 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,26 @@ can chain multiple coalescing operators.
96
96
97
97
The null-coalescing operator was introduced in Symfony 6.2.
98
98
99
+ Parsing and Linting Expressions
100
+ ...............................
101
+
102
+ The ExpressionLanguage component provides a way to parse and lint expressions.
103
+ The :method: `Symfony\\ Component\\ ExpressionLanguage\\ ExpressionLanguage::parse `
104
+ method returns a :class: `Symfony\\ Component\\ ExpressionLanguage\\ ParsedExpression `
105
+ instance that can be used to inspect and manipulate the expression. The
106
+ :method: `Symfony\\ Component\\ ExpressionLanguage\\ ExpressionLanguage::lint `, on the
107
+ other hand, returns a boolean indicating if the expression is valid or not::
108
+
109
+ use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
110
+
111
+ $expressionLanguage = new ExpressionLanguage();
112
+
113
+ var_dump($expressionLanguage->parse('1 + 2'));
114
+ // displays the AST nodes of the expression which can be
115
+ // inspected and manipulated
116
+
117
+ var_dump($expressionLanguage->lint('1 + 2')); // displays true
118
+
99
119
Passing in Variables
100
120
--------------------
101
121
You can’t perform that action at this time.
0 commit comments