-
Notifications
You must be signed in to change notification settings - Fork 234
allow for dangling comma #11
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
I do really like the change, as it is damn complicated to extend an array if it fails all the time as the previous line did not had a comma. |
you should also allow them in arrays (for which your consistency argument would be even more accurate as PHP does not support it at the end of function call arguments) |
Arrays already good, I tested them. |
Trailing commas in arrays are supported by \Doctrine\Common\Annotations\DocParser::Arrayx() and I manually confirmed that as well. Also, anything that decreases the chances of WTFs is an improvement. |
Working with this daily in Drupal, and also dealing with overcoming this particular objections with Drupal devs very very regularly. I 100% support this. |
Whenever I'm writing JSON and forget that one comma there - I'm wasting another minute of my lifetime to get rid of it. Let's make writing Annotations less painful and get this in, please! |
I think there's a better way to support this without entering on 2nd level of indentation. |
I am not sure what you mean -- I could look at the lookahead token retrieved instead of calling the helper but calling the helper seemed cleaner. If you'd clarify what you'd like me to do, I'd be glad to help more. |
@chx the issue I see is that you're mixing grammar rules by checking a token that is not part of "Values", but its parent, "Annotation". /**
* @Annotation(foo="bar" bar="woo", fur="buzz")
*/ That's why I'm telling that it may be a little bit different your patch. |
I simply upgraded the grammar to be |
@chx that's why I told you there may be a better approach for the problem. I just can't think on this atm (deploying a subsystem to production at work) |
I checked the aforementioned arrayx function and it actually does the exact same. Added in 3b9d2f8 |
I asked this on stackoverflow and fixed my grammar syntax. |
Worked with Damien Tournoud on this; the grammar is LL(1) again. Tests passed. |
Also note that the grammar is positively weird:
So this means that What about (in a followup) removing the special casing of Array from Values? |
Is there any feedback on this in terms of what's left to get it committed? |
Ran into this problem too. Kinda annoying. The syntax error that gets thrown in the least is uninformative, especially as commas are easily overlooked characters. |
Does this issue need to be assigned to a specific person in order to be reviewed for acceptance? |
@guilhermeblanco ping again |
Fixed here: 463d926 |
Drupal developers are much to used to the PHP array syntax which allows a dangling comma:
Doctrine doesn't allow for this and this causes a lot of grief. This PR fixes this. It seems
{}
arrays already support this.