You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a file called test.php with the code sample above
Create a file called ruleset.xml with the code ruleset above
Run phpcs --standard="ruleset.xml" test.php
See error message displayed
FILE: test.php
---------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------
13 | ERROR | The value of a comparison must not be assigned to a variable
---------------------------------------------------------------------------
Time: 21ms; Memory: 4MB
Expected behavior
No output (no errors)
Versions:
OS: Linux (Ubuntu 20.04.1 LTS)
PHP: 7.4.3
PHPCS: 3.5.8
Standard: Custom
Additional context
Similar bug was already fixed in 3.5.7: Fixed Squiz.PHP.DisallowComparisonAssignment false positive for methods called on an object
The text was updated successfully, but these errors were encountered:
gsherwood
changed the title
Squiz.PHP.DisallowComparisonAssignment false positive for callbacks with comparison inside, assigned to variables
Squiz.PHP.DisallowComparisonAssignment false positive when comparison inside closure
Nov 17, 2020
Describe the bug
DisallowComparisonAssignment
triggered on callbacks with comparison inside, assigned to variablesCode sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample aboveruleset.xml
with the code ruleset abovephpcs --standard="ruleset.xml" test.php
Expected behavior
No output (no errors)
Versions:
Additional context
Similar bug was already fixed in 3.5.7:
Fixed Squiz.PHP.DisallowComparisonAssignment false positive for methods called on an object
The text was updated successfully, but these errors were encountered: