On Fri, Jul 23, 2021 at 6:37 AM Derick Rethans <der...@php.net> wrote: > > From the RFC: «Taking all these elements into account, the preference > of... and thus to use the "?X&Y" syntax». > > I think this would be a mistake. You touch upon operator precedence, and > needing to know whether | or & is higher, and inventing a new precedence > for ?. > > I would strongly advocate for not getting into the realm with any > operator precendence, but instead *require* parenthesis for any > combination. This gives the code reader and writer an immediate clue > about what the code does. Most coding standards also recommend this for > expressions in "if" statements and the like.
I also strongly advocate for always requiring parentheses whenever mixing unions and intersections, and I don't think the nullable shorthand should be omitted from this rule. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php