Ref T4334. Adds support for nullable return type, which are a thing as of PHP 7.1.
- Group Reviewers
- Maniphest Tasks
- T4334: Support PHP5.4+ syntax in XHPAST
- rPHU2596aecadc53: Add support for nullable return types
Updated test cases.
I was trying to avoid adding a new node type (which is technically a breaking API change), but it seems necessary to accommodate nullability.
This technically allows ?void, which is a fatal error... but I'm not sure it's worth special casing that here.
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.