Skip to content

Commit e072b2b

Browse files
committed
Add new PhpSc rule: NativeFunctionInvocation.
- Bug fix
1 parent 8eda466 commit e072b2b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rulesets/PhpCs/Space48Extra/Sniffs/NativeFunctionInvocationSniff.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ private function formatForForbidden(array $functionNames): array
5050
*/
5151
protected function addError($phpcsFile, $stackPtr, $functionName, $pattern = null)
5252
{
53+
$prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
54+
if ($phpcsFile->getTokens()[$prevToken]['code'] === T_NS_SEPARATOR) {
55+
return;
56+
}
57+
5358
$phpcsFile->addError($this->getErrorMessage(), $stackPtr, 'Encountered', [$functionName, $functionName]);
5459
}
5560

0 commit comments

Comments
 (0)