Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Jan 20, 2020

This sniff only covers a small part of the changes in the PHP 7.0 Uniform Variable Syntax RFC, but it's at least another part which is covered.

// support nested ::
$foo['bar']::$baz
$foo::$bar::$baz
$foo->bar()::baz()

Static property fetches and method calls can now be applied to any dereferencable expression. E.g. $foo['bar']::$baz, $foo::$bar::$baz and $foo->bar()::baz() are all valid now.

Ref: https://wiki.php.net/rfc/uniform_variable_syntax

The sniff implementation as is being pulled now is supported by various tests run on 3v4l:
https://3v4l.org/up9e3
https://3v4l.org/7tZcL
https://3v4l.org/5uuFR
https://3v4l.org/grUNF
https://3v4l.org/mtWn9
https://3v4l.org/PAtnX
https://3v4l.org/qujtp
https://3v4l.org/Rrteo
https://3v4l.org/GQA2P
https://3v4l.org/2XCUZ
https://3v4l.org/d3vcp

Includes unit tests.

The sniff has been run over a number of large PHP projects to see if any false positives could be found, but didn't find any, though I'm not giving out any guarantees at this point.

Fixes #946

This sniff only covers a small part of the changes in the PHP 7.0 Uniform Variable Syntax RFC, but it's at least another part which is covered.

> ```php
> // support nested ::
> $foo['bar']::$baz
> $foo::$bar::$baz
> $foo->bar()::baz()
> ```
>
> Static property fetches and method calls can now be applied to any dereferencable expression. E.g. `$foo['bar']::$baz`, `$foo::$bar::$baz` and `$foo->bar()::baz()` are all valid now.

Ref: https://wiki.php.net/rfc/uniform_variable_syntax

The sniff implementation as is being pulled now is supported by various tests run on 3v4l:
https://3v4l.org/up9e3
https://3v4l.org/7tZcL
https://3v4l.org/5uuFR
https://3v4l.org/grUNF
https://3v4l.org/mtWn9
https://3v4l.org/PAtnX
https://3v4l.org/qujtp
https://3v4l.org/Rrteo
https://3v4l.org/GQA2P
https://3v4l.org/2XCUZ
https://3v4l.org/d3vcp

Includes unit tests.

The sniff has been run over a number of large PHP projects to see if any false positives could be found, but didn't find any.

Fixes 946
@jrfnl jrfnl force-pushed the php-7.0/946-new-nested-static-access-syntax-sniff branch from 144b078 to 7e137ab Compare February 22, 2020 05:00
@wimg wimg merged commit 0a79491 into develop Mar 26, 2020
@wimg wimg deleted the php-7.0/946-new-nested-static-access-syntax-sniff branch March 26, 2020 13:27
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.

Undetected syntax error when accessing a constant from a property on PHP < 7.0

3 participants