[php-langspec][Issue #226] - Should `$a instanceof $b instanceof $c` be permitted in implementation/specification?
| From: | noreply@php.net | Date: | Wed, 05 Dec 2018 02:08:00 +0000 |
| Subject: | [php-langspec][Issue #226] - Should `$a instanceof $b instanceof $c` be permitted in implementation/specification? | ||
| Groups: | php.standards | ||
| Request: | Send a blank email to standards-+get-1348@lists.php.net to get a copy of this message | ||
You can view the Issue on github:
https://github.com/php/php-langspec/issues/226
Opened By: TysonAndre
Issue Description:
$x instanceof $y instanceof $z is a nonsense expression, but is successfully parsed in
PHP 5.6-7.3 (see https://3v4l.org/QWYZJ)
- This contradicts what is mentioned in https://secure.php.net/manual/en/language.operators.precedence.php
(the website says it's non-associative. However, other non-associative expressions do what
would make sense: They cause Parse errors (e.g. 2 == 3 != 4)
Either of the following would make sense:
1. Mention that this is non-associative in php-langspec (to reflect php.net)
Additionally, try to make that a syntax error in php 8.x or 7.4, to reflect the documentation
on php.net: https://secure.php.net/manual/en/language.operators.precedence.php
2. Update the specification to allow it, and update php.net (it seems like it's currently
parsed as ($x instanceof $y) instanceof $z according to ast\parse_code())
- I'm opposed to that, and it seems like the spec in this repo forbids that
I'm not quite sure what repo to file this in, or the process to request the change to php
implementation's syntax, or if this has been mentioned elsewhere.