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

PSR12.Operators.OperatorSpacing: false positives #2696

Closed
jrfnl opened this issue Nov 14, 2019 · 0 comments · Fixed by #2697
Closed

PSR12.Operators.OperatorSpacing: false positives #2696

jrfnl opened this issue Nov 14, 2019 · 0 comments · Fixed by #2697

Comments

@jrfnl
Copy link
Contributor

jrfnl commented Nov 14, 2019

Looks like PR #2640 has introduced some new issues in PSR12.Operators.OperatorSpacing which extends Squiz.WhiteSpace.OperatorSpacing.

Example code:

if (strpos($tokenContent, 'b"') === 0 && substr($tokenContent, -1) === '"') {}

$oldConstructorPos   = -1;

$content = -$content;

Previously, no errors would be thrown, now you get the following false positives:

-------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------------
 3 | ERROR | [x] Expected at least 1 space after "-"; 0 found
   |       |     (PSR12.Operators.OperatorSpacing.NoSpaceAfter)
 5 | ERROR | [x] Expected at least 1 space after "-"; 0 found
   |       |     (PSR12.Operators.OperatorSpacing.NoSpaceAfter)
 7 | ERROR | [x] Expected at least 1 space after "-"; 0 found
   |       |     (PSR12.Operators.OperatorSpacing.NoSpaceAfter)
-------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------- 
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

Successfully merging a pull request may close this issue.

1 participant