Skip to content

Commit

Permalink
Fixed Squiz.PHP.DisallowComparisonAssignment false positive for metho…
Browse files Browse the repository at this point in the history
…ds called on an object (ref #3089)
  • Loading branch information
gsherwood committed Sep 20, 2020
1 parent 9cce685 commit 4201fd8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
- PSR12.Functions.NullableTypeDeclaration now supports the PHP8 static return type
-- Thanks to Juliette Reinders Folmer for the patch
- Fixed Squiz.Formatting.OperatorBracket false positive when exiting with a negative number
- Fixed Squiz.PHP.DisallowComparisonAssignment false positive for methods called on an object
- Fixed bug #2882 : Generic.Arrays.ArrayIndent can request close brace indent to be less than the statement indent level
- Fixed bug #2883 : Generic.WhiteSpace.ScopeIndent.Incorrect issue after NOWDOC
- Fixed bug #2975 : Undefined offset in PSR12.Functions.ReturnTypeDeclaration when checking function return type inside ternary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ public function process(File $phpcsFile, $stackPtr)

// Ignore function calls.
$ignore = [
T_NULLSAFE_OBJECT_OPERATOR,
T_OBJECT_OPERATOR,
T_STRING,
T_VARIABLE,
T_WHITESPACE,
T_OBJECT_OPERATOR,
];

$next = $phpcsFile->findNext($ignore, ($stackPtr + 1), null, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ $a = [
$a = [
'a' => ($foo) ? fn() => return 1 : fn() => return 2,
];

$var = $foo->something(!$var);
$var = $foo?->something(!$var);

0 comments on commit 4201fd8

Please sign in to comment.