Re: [VOTE] throw expression
| From: | Dan Ackroyd | Date: | Sun, 05 Apr 2020 10:35:53 +0000 |
| Subject: | Re: [VOTE] throw expression | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109533@lists.php.net to get a copy of this message | ||
Hi Iija,
During the discussion of the precedence, you wrote:
> There is a reasonable way to recognize this, namely to check if the expression
> after the throw keyword is of type ZEND_AST_OR or ZEND_AST_AND. The
> expression above will fail with this message (given that $condition is false):
Did the RFC get updated to address this?
As the current behaviour listed* in the RFC seems wrong and surprising to me.
cheers
Dan
Ack
* relevant part:
> $condition || throw new Exception('$condition must be truthy')
> && $condition2 || throw new Exception('$condition2 must be truthy');
> // Evaluated as
> $condition || (throw new Exception('$condition must be truthy') &&
> $condition2 || (throw new Exception('$condition2 must be truthy')));