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

Issues when 7.2.1 is used with squizlabs/PHP_CodeSniffer 3.7 #1381

Closed
janedbal opened this issue Jun 13, 2022 · 7 comments
Closed

Issues when 7.2.1 is used with squizlabs/PHP_CodeSniffer 3.7 #1381

janedbal opened this issue Jun 13, 2022 · 7 comments
Labels

Comments

@janedbal
Copy link
Contributor

janedbal commented Jun 13, 2022

Hi, I assume there will be some official support in upcoming days/weeks, I just want to point out issues I found when analysing our codebase with slevomat/cs 7.2.1 and squizlabs/PHP_CodeSniffer 3.7.0:

  1. function named empty causing internal server error in FunctionHelper
  2. enum case named True (or False) is identified as constant by SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFallbackGlobalName
  3. enum case named Isset causing internal server error An error occurred during processing; checking has been aborted. The error message was: Undefined array key "parenthesis_closer" in RequireNullCoalesceOperatorSniff.php:69
@kukulich
Copy link
Contributor

Function empty looks like invalid PHP: https://3v4l.org/sQXtT

@janedbal
Copy link
Contributor Author

I oversimplified the case. It was a class method, which is allowed: https://3v4l.org/er5bV

@kukulich
Copy link
Contributor

  1. There's no array access in FunctionHelper on line 92, so it looks like outdated Slevomat CS. I've checked branches 7.2 and master. Please try master.
  2. I'm not able to reproduce it in master now. Please try master.
  3. It's bug of PHPCS itself. The enum case name is tokenized as T_ISSET and that's wrong.

@kukulich
Copy link
Contributor

empty and isset are probably fixed in PHPCS itself: squizlabs/PHP_CodeSniffer#3610

@jrfnl
Copy link
Contributor

jrfnl commented Jun 20, 2022

Yes, the fix is included in the PHPCS 3.7.1 release. Upgrading to that should solve the problem.

@janedbal
Copy link
Contributor Author

Seems like

"slevomat/coding-standard": "dev-master",
"squizlabs/php_codesniffer": "3.7.1",

works fine. Thank you!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants