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

WordPress.Arrays.ArrayDeclaration does not terminate #539

Closed
Akigiri opened this issue Mar 11, 2016 · 4 comments
Closed

WordPress.Arrays.ArrayDeclaration does not terminate #539

Akigiri opened this issue Mar 11, 2016 · 4 comments

Comments

@Akigiri
Copy link

Akigiri commented Mar 11, 2016

The sniff WordPress.Arrays.ArrayDeclaration does not terminate for the following code:

$a = array(
    'key' =>
);

Tested with wpcs 0.9:
phpcs --standard=Wordpress-Core --sniffs=WordPress.Arrays.ArrayDeclaration <file>

I do not get any error message and the phpcs thread starts to use 100% of a cpu core. In conjunction with SublimeLinter it also causes to allocate a lot of memory (probably Sublime Text's fault) which slows down the whole system even more. It only seems to occur when you have an array with closing parentheses and you start to add new items. Once you write the T_DOUBLE_ARROW without a trailing value the sniff causes problems. If I remove the lines 276-316 the sniff terminates again without any errors but I am not sure about exact cause.

@jrfnl
Copy link
Member

jrfnl commented Mar 11, 2016

Which version of PHPCS are you using ? Sounds like this might be an upstream issue.

@Akigiri
Copy link
Author

Akigiri commented Mar 11, 2016

I use PHP_CodeSniffer version 2.5.1 (stable)

@westonruter
Copy link
Member

The code has a syntax error:

Parse error: syntax error, unexpected ')'

This is outside the scope of PHP_CodeSniffer. See #522.

@Akigiri
Copy link
Author

Akigiri commented Mar 11, 2016

That makes sense. Thanks for your response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants