-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] use "allowedVariables" to configure the ExpressionLanguageSyntax constraint #37009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
xabbuh
commented
May 30, 2020
Q | A |
---|---|
Branch? | 5.1 |
Bug fix? | no |
New feature? | no |
Deprecations? | no |
Tickets | Fix symfony/symfony-docs#13669 |
License | MIT |
Doc PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me. Just a naming suggestion.
@@ -29,8 +29,7 @@ class ExpressionLanguageSyntax extends Constraint | ||
|
||
public $message = 'This value should be a valid expression.'; | ||
public $service; | ||
public $validateNames = true; | ||
public $names = []; | ||
public $variableNames = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$allowedVariables
would be better to me (as suggested in the linked doc issue btw)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, and shouldn't the default be null
, to allow any variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, the suggested name sounds better to me. I am going to change that.
My reasoning for the empty array as the default value was that allowing arbitrary names rather looks like an edge case to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not allowing any variables by default means allowing only static expressions, isn't it? Since static expressions are never why ppl use EL, this would effectively force ppl to be explicit all the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I applied the suggested changes while merging, please tell if you think this is a mistake :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me. :) Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution! I agree with Nico's comments, but overall it looks OK.
…eSyntax constraint
Thank you @xabbuh. |