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

"Short" list syntax is unrecognized #459

Closed
1 task done
dlh01 opened this issue Jan 14, 2020 · 2 comments
Closed
1 task done

"Short" list syntax is unrecognized #459

dlh01 opened this issue Jan 14, 2020 · 2 comments
Milestone

Comments

@dlh01
Copy link

dlh01 commented Jan 14, 2020

Bug Description

Variables assigned using short list() syntax are reported as undefined.

Minimal Code Snippet

[ $foo ] = func();

Error Code

Variable $foo is undefined. (WordPressVIPMinimum.Variables.VariableAnalysis.UndefinedVariable)

Environment

Question Answer
PHP version 7.3.12
PHP_CodeSniffer version 3.5.1
VIPCS version 2.0.0

Additional Context

This syntax was added in PHP 7.1: https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.symmetric-array-destructuring

Tested Against master branch?

  • I have verified the issue still exists in the master branch of VIPCS.
@GaryJones
Copy link
Contributor

Thanks for reporting this @dlh01.

I'm going to close this one as it should be handled in VIPCS by our switching to an external version of VariableAnalysis, and I know that work is under way (by @sirbrillig) there to make use of PHPCSUtils (by @jrfnl) which includes utility methods which better identifies a short list from a short array.

@GaryJones GaryJones added this to the 2.2.0 milestone Jul 13, 2020
@GaryJones
Copy link
Contributor

Now that #449 is completed to use VariableAnalysis proper, I've confirmed that the provided example above doesn't give an error with the develop version of WordPress-VIP-Go, so this is now fixed for VIPCS 2.2.0.

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