Skip to content

Commit 8a17a80

Browse files
committed
PHP 8.0 | Generic/UpperCaseConstantName: allow for nullsafe object operator
Includes unit test.
1 parent 85f3521 commit 8a17a80

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/Standards/Generic/Sniffs/NamingConventions/UpperCaseConstantNameSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public function process(File $phpcsFile, $stackPtr)
8383
$prev = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
8484
if ($tokens[$prev]['code'] === T_OBJECT_OPERATOR
8585
|| $tokens[$prev]['code'] === T_DOUBLE_COLON
86+
|| $tokens[$prev]['code'] === T_NULLSAFE_OBJECT_OPERATOR
8687
) {
8788
return;
8889
}

src/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ class ClassConstBowOutTest {
2929
const // phpcs:ignore Standard.Category.Sniff
3030
some_constant = 2;
3131
}
32+
33+
$foo->getBar()?->define('foo');

0 commit comments

Comments
 (0)