Skip to content

Commit 681b157

Browse files
committed
Merge branch 'php-8.0/generic-sapiusage-support-nullsafe-operator' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents ce2712a + 1124ec8 commit 681b157

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Standards/Generic/Sniffs/PHP/SAPIUsageSniff.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ public function process(File $phpcsFile, $stackPtr)
4242
$tokens = $phpcsFile->getTokens();
4343

4444
$ignore = [
45-
T_DOUBLE_COLON => true,
46-
T_OBJECT_OPERATOR => true,
47-
T_FUNCTION => true,
48-
T_CONST => true,
45+
T_DOUBLE_COLON => true,
46+
T_OBJECT_OPERATOR => true,
47+
T_NULLSAFE_OBJECT_OPERATOR => true,
48+
T_FUNCTION => true,
49+
T_CONST => true,
4950
];
5051

5152
$prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);

src/Standards/Generic/Tests/PHP/SAPIUsageUnitTest.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
if (php_sapi_name() !== 'cli') {}
33
if (PHP_SAPI !== 'cli') {}
44
if ($object->php_sapi_name() === true) {}
5+
if ($object?->php_sapi_name() === true) {}

0 commit comments

Comments
 (0)