Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8: RestrictedFunction test failure #574

Closed
GaryJones opened this issue Aug 29, 2020 · 4 comments
Closed

PHP 8: RestrictedFunction test failure #574

GaryJones opened this issue Aug 29, 2020 · 4 comments

Comments

@GaryJones
Copy link
Contributor

Bug Description

As seen, at https://travis-ci.org/github/Automattic/VIP-Coding-Standards/jobs/722253827, there is a test failure for PHP 8:

1) WordPressVIPMinimum\Tests\Functions\RestrictedFunctionsUnitTest::testSniff
[LINE 76] Expected 1 error(s) in RestrictedFunctionsUnitTest.inc but found 0 error(s).

It's related to this line

\add_role(); // Error.

We have it marked down as expecting 1 error on that line.

Environment

Use php -v and composer show to get versions.

Question Answer
PHP version 8.0.0-dev (5th August 2020)
PHP_CodeSniffer version 3.5.5
VIPCS version develop
@GaryJones GaryJones added this to the 2.2.0 milestone Aug 29, 2020
@GaryJones
Copy link
Contributor Author

Possibly a bug/change in the upstream abstract sniff, and this is_token_namespaced() method.

@jrfnl
Copy link
Collaborator

jrfnl commented Aug 29, 2020

This is not directly related to the VIPCS repo and will be fixed when the PHPCS (3.x) tokenizer has been updated for PHP 8.
There are also numerous other sniffs - both in VIPCS as well as WPCS - which will be affected by this PHP change.

The underlying problem is this change in PHP: https://wiki.php.net/rfc/namespaced_names_as_token

This is the proposal for handling this in PHPCS: squizlabs/PHP_CodeSniffer#3041

I intend for the PHPCSUtils abstracts to support this for older PHPCS versions (and for PHPCS 4.x) with a BC layer.

@jrfnl
Copy link
Collaborator

jrfnl commented Aug 30, 2020

See: squizlabs/PHP_CodeSniffer#3063

@GaryJones
Copy link
Contributor Author

Since we can't fix this directly in VIPCS, short of requiring a future minimum version of PHPCS, I'm going to close this out.

@GaryJones GaryJones removed this from the 2.2.0 milestone Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants