Skip to content

Commit

Permalink
PHP 8.0 | Squiz/LowercasePHPFunctions: allow for nullsafe object oper…
Browse files Browse the repository at this point in the history
…ator

Includes unit test.
  • Loading branch information
jrfnl committed Sep 1, 2020
1 parent 85f3521 commit a222ec6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public function process(File $phpcsFile, $stackPtr)
return;
}

if ($tokens[$prev]['code'] === T_OBJECT_OPERATOR) {
if ($tokens[$prev]['code'] === T_OBJECT_OPERATOR
|| $tokens[$prev]['code'] === T_NULLSAFE_OBJECT_OPERATOR
) {
// Not an inbuilt function.
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ $callToNamespacedFunction = MyNamespace /* phpcs:ignore Standard */ \STR_REPEAT(
$callToNamespacedFunction = namespace\STR_REPEAT($a, 2); // Could potentially be false negative.

$filePath = new \File($path);

$count = $object?->Count();
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ $callToNamespacedFunction = MyNamespace /* phpcs:ignore Standard */ \STR_REPEAT(
$callToNamespacedFunction = namespace\STR_REPEAT($a, 2); // Could potentially be false negative.

$filePath = new \File($path);

$count = $object?->Count();

0 comments on commit a222ec6

Please sign in to comment.