PHP 5.6 / 8.0: NewConstantDereferencing: add support for constant array / object dereferencing by elazar · Pull Request #1263 · PHPCompatibility/PHPCompatibility
…ay / object dereferencing
> This RFC brings static scalar expressions to the parser. This allows places that only take static values (const declarations, ... etc) to also be able to take static expressions.
> Constants... are currently special cased and only dereferencable under the `[]` operator (and do not even support the nominally equivalent `{}` operator).
>
> This RFC proposes to make constants (and class constants) fully array and object dereferencable, i.e. to allow both `FOO{0}` and `FOO->length()` (the latter only being relevant in conjunction with scalar objects).
Ref:
* https://wiki.php.net/rfc/const_scalar_exprs
* php/php-src@d5ddd2d
* https://wiki.php.net/rfc/variable_syntax_tweaks#constant_dereferencability
Includes unit tests.
Relates to PHPCompatibility#809.
jrfnl
mentioned this pull request
40 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters