Skip to content

Commit 4dfbad3

Browse files
committed
Merge branch 'php-8.0/generic-forbiddenfunctions-support-nullsafe-operator' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents 681b157 + bf708e6 commit 4dfbad3

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,19 @@ public function process(File $phpcsFile, $stackPtr)
120120
$tokens = $phpcsFile->getTokens();
121121

122122
$ignore = [
123-
T_DOUBLE_COLON => true,
124-
T_OBJECT_OPERATOR => true,
125-
T_FUNCTION => true,
126-
T_CONST => true,
127-
T_PUBLIC => true,
128-
T_PRIVATE => true,
129-
T_PROTECTED => true,
130-
T_AS => true,
131-
T_NEW => true,
132-
T_INSTEADOF => true,
133-
T_NS_SEPARATOR => true,
134-
T_IMPLEMENTS => true,
123+
T_DOUBLE_COLON => true,
124+
T_OBJECT_OPERATOR => true,
125+
T_NULLSAFE_OBJECT_OPERATOR => true,
126+
T_FUNCTION => true,
127+
T_CONST => true,
128+
T_PUBLIC => true,
129+
T_PRIVATE => true,
130+
T_PROTECTED => true,
131+
T_AS => true,
132+
T_NEW => true,
133+
T_INSTEADOF => true,
134+
T_NS_SEPARATOR => true,
135+
T_IMPLEMENTS => true,
135136
];
136137

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ class SizeOf implements Something {}
5454
function mymodule_form_callback(SizeOf $sizeof) {
5555
}
5656

57-
?>
57+
$size = $class?->sizeof($array);

0 commit comments

Comments
 (0)