Hi Dan,
Dan Ackroyd wrote:
Regarding the example:
$condition || throw new Exception('$condition must be truthy')
&& $condition2 || throw new Exception('$condition2 must be truthy');
The "Deprecate left-associative ternary operator"* RFC made it so that
parentheses are required when ternary operators are nested in
complicated statements.
Would a similar requirement for parentheses around complicated throw
expressions be a suitable solution to avoid people being surprised by
the behaviour?
cheers
Dan
Ack
* https://wiki.php.net/rfc/ternary_associativity
Is there a strong reason to require parentheses? I would think we can
just give `throw` an appropriate precedence so that expressions like the
above do what is desired — and then if you wanted to do something
unusual, you would have to add parentheses anyway.
Regards,
Andrea
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php