1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-13 20:32:11 +02:00

[ticket/16671] Do not allow leading backslashes in use statements

PHPBB3-16671
This commit is contained in:
Máté Bartus 2020-12-31 14:49:49 +01:00
parent 8830354555
commit 3d8f7ee33b

View File

@ -86,6 +86,11 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff
$class_name_short = $tokens[$class_name_end - 1]['content'];
}
if ($class_name_full[0] === '\\')
{
$phpcsFile->addError("There must not be a leading '\\' in use statements.", $stackPtr, 'Malformed');
}
$ok = false;
// Checks in simple statements (new, instanceof and extends)