Skip to content

Commit 5ddc6fe

Browse files
committed
Merge branch 'php-8.0/squiz-lowercasephpfunctions-support-nullsafe-operator' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents e22262c + a222ec6 commit 5ddc6fe

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/Standards/Squiz/Sniffs/PHP/LowercasePHPFunctionsSniff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ public function process(File $phpcsFile, $stackPtr)
133133
return;
134134
}
135135

136-
if ($tokens[$prev]['code'] === T_OBJECT_OPERATOR) {
136+
if ($tokens[$prev]['code'] === T_OBJECT_OPERATOR
137+
|| $tokens[$prev]['code'] === T_NULLSAFE_OBJECT_OPERATOR
138+
) {
137139
// Not an inbuilt function.
138140
return;
139141
}

src/Standards/Squiz/Tests/PHP/LowercasePHPFunctionsUnitTest.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ $callToNamespacedFunction = MyNamespace /* phpcs:ignore Standard */ \STR_REPEAT(
3939
$callToNamespacedFunction = namespace\STR_REPEAT($a, 2); // Could potentially be false negative.
4040

4141
$filePath = new \File($path);
42+
43+
$count = $object?->Count();

src/Standards/Squiz/Tests/PHP/LowercasePHPFunctionsUnitTest.inc.fixed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ $callToNamespacedFunction = MyNamespace /* phpcs:ignore Standard */ \STR_REPEAT(
3939
$callToNamespacedFunction = namespace\STR_REPEAT($a, 2); // Could potentially be false negative.
4040

4141
$filePath = new \File($path);
42+
43+
$count = $object?->Count();

0 commit comments

Comments
 (0)