Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Oct 2, 2020

Constants are currently array-dereferencable, that is FOO[0] is legal. However, magic constants are non-dereferencable.

This RFC proposes to treat magic constants the same way as constants, that is, writing __FUNCTION__[0] etc becomes legal.

Ref:

Includes unit tests.

Related to #809

…` sniff

> Constants are currently array-dereferencable, that is FOO[0] is legal. However, magic constants are non-dereferencable.
> This RFC proposes to treat magic constants the same way as constants, that is, writing __FUNCTION__[0] etc becomes legal.

Ref:
* https://wiki.php.net/rfc/variable_syntax_tweaks#constants_and_magic_constants
* php/php-src@357fbc9

Includes unit tests.
@jrfnl jrfnl force-pushed the php-8.0/new-newmagicconstantdereferencing-sniff branch from 3428ef7 to 1530578 Compare October 2, 2020 23:36
@wimg wimg merged commit 597bfb6 into develop Nov 21, 2020
@wimg wimg deleted the php-8.0/new-newmagicconstantdereferencing-sniff branch November 21, 2020 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants