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::
106106
107107 $expressionLanguage->lint('1 + 2', []); // doesn't throw anything
108108
109+ $expressionLanguage->lint('1 + a', []);
110+ // throws a SyntaxError exception:
111+ // "Variable "a" is not valid around position 5 for expression `1 + a`."
112+
109113The behavior of these methods can be configured with some flags defined in the
110114:class: `Symfony\\ Component\\ ExpressionLanguage\\ Parser ` class:
111115
@@ -121,8 +125,8 @@ This is how you can use these flags::
121125
122126 $expressionLanguage = new ExpressionLanguage();
123127
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);
126130
127131.. versionadded :: 7.1
128132
You can’t perform that action at this time.
0 commit comments