Ref T4334. Adds support for nullable return type, which are a thing as of PHP 7.1.
Details
- Reviewers
epriestley richardvanvelzen - Group Reviewers
Blessed Reviewers - Maniphest Tasks
- T4334: Support PHP5.4+ syntax in XHPAST
- Commits
- rPHU2596aecadc53: Add support for nullable return types
Updated test cases.
Diff Detail
- Repository
- rPHU libphutil
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Oh cool. I'm somewhat surprised this is being accepted as I expected it to be blocked on T4334#222499.
support/xhpast/parser.y | ||
---|---|---|
1089 | I was trying to avoid adding a new node type (which is technically a breaking API change), but it seems necessary to accommodate nullability. | |
1089 | This technically allows ?void, which is a fatal error... but I'm not sure it's worth special casing that here. | |
support/xhpast/xhpast.cpp | ||
15 | Actually, given that nullable types were added in PHP 7.1, maybe I'll bump this to 7.1.0. |
I can if you want, but I think the tests are somewhat useful... if not only because they show me when a parser change has a bigger scope than I had anticipated. I think it would be good (or, at least, an improvement) to land D17819 or some variation thereupon, but I'm guessing it's not a priority.
support/xhpast/parser.y | ||
---|---|---|
1089 | Maybe we should add a new T_VOID token and exclude void from type. |
support/xhpast/parser.y | ||
---|---|---|
1089 | Yeah, that sounds reasonable. I'll do that in a separate diff though. |