File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ if the expression is not valid::
106
106
107
107
$expressionLanguage->lint('1 + 2', []); // doesn't throw anything
108
108
109
+ $expressionLanguage->lint('1 + a', []);
110
+ // throws a SyntaxError exception:
111
+ // "Variable "a" is not valid around position 5 for expression `1 + a`."
112
+
109
113
The behavior of these methods can be configured with some flags defined in the
110
114
:class: `Symfony\\ Component\\ ExpressionLanguage\\ Parser ` class:
111
115
@@ -121,8 +125,8 @@ This is how you can use these flags::
121
125
122
126
$expressionLanguage = new ExpressionLanguage();
123
127
124
- // this returns true because the unknown variables and functions are ignored
125
- var_dump( $expressionLanguage->lint('unknown_var + unknown_function()', Parser::IGNORE_UNKNOWN_VARIABLES | Parser::IGNORE_UNKNOWN_FUNCTIONS) );
128
+ // does not throw a SyntaxError because the unknown variables and functions are ignored
129
+ $expressionLanguage->lint('unknown_var + unknown_function()', [], Parser::IGNORE_UNKNOWN_VARIABLES | Parser::IGNORE_UNKNOWN_FUNCTIONS);
126
130
127
131
.. versionadded :: 7.1
128
132
You can’t perform that action at this time.
0 commit comments