1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

[ticket/16748] Adjust coding guidelines to put static after visibility

PHPBB3-16748
This commit is contained in:
Marc Alexander
2021-04-03 22:41:58 +02:00
parent 7d48254cc9
commit 95496ebd38
2 changed files with 7 additions and 7 deletions

View File

@@ -42,16 +42,16 @@ class phpbb_Sniffs_ControlStructures_StaticKeywordSniff implements Sniff
{
$tokens = $phpcsFile->getTokens();
$disallowed_before_tokens = [
$disallowed_after_tokens = [
T_PUBLIC,
T_PROTECTED,
T_PRIVATE,
];
if (in_array($tokens[$stackPtr - 2]['code'], $disallowed_before_tokens))
if (in_array($tokens[$stackPtr + 2]['code'], $disallowed_after_tokens))
{
$error = 'Access specifier (e.g. public) should follow static scope attribute. Encountered "' . $tokens[$stackPtr - 2]['content'] . '" before static';
$phpcsFile->addError($error, $stackPtr, 'InvalidStaticFunctionDeclaration');
$error = 'Access specifier (e.g. public) should not follow static scope attribute. Encountered "' . $tokens[$stackPtr + 2]['content'] . '" after static';
$phpcsFile->addWarning($error, $stackPtr, 'InvalidStaticFunctionDeclaration', [], 1);
}
}
}