Skip to content

Commit

Permalink
PHP 8.0 | Squiz/DisallowSizeFunctionsInLoops: allow for nullsafe obje…
Browse files Browse the repository at this point in the history
…ct operator

Includes unit test.
  • Loading branch information
jrfnl committed Sep 1, 2020
1 parent 85f3521 commit 3a094b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ public function process(File $phpcsFile, $stackPtr)
$functionName = 'object.'.$functionName;
} else {
// Make sure it isn't a member var.
if ($tokens[($i - 1)]['code'] === T_OBJECT_OPERATOR) {
if ($tokens[($i - 1)]['code'] === T_OBJECT_OPERATOR
|| $tokens[($i - 1)]['code'] === T_NULLSAFE_OBJECT_OPERATOR
) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ do {
} while($a->count);

for ($i = 0; $i < $a->count; $i++) {}
?>
for ($i = 0; $i < $a?->count; $i++) {}

0 comments on commit 3a094b7

Please sign in to comment.