diff --git a/build/code_sniffer/phpbb/Sniffs/ControlStructures/StaticKeywordSniff.php b/build/code_sniffer/phpbb/Sniffs/ControlStructures/StaticKeywordSniff.php index 1dabe82235..a9d52432d1 100644 --- a/build/code_sniffer/phpbb/Sniffs/ControlStructures/StaticKeywordSniff.php +++ b/build/code_sniffer/phpbb/Sniffs/ControlStructures/StaticKeywordSniff.php @@ -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); } } } diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 93da7d9ee5..89c5002508 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -717,18 +717,18 @@ switch ($mode)
Use the explicit visibility qualifiers public
, private
and protected
for all properties instead of var
.
-
Place the static
qualifier before the visibility qualifiers.
Place the static
qualifier after the visibility qualifiers.
//Wrong
var $x; -private static function f()+static private function f()
// Right
public $x; -static private function f()+private static function f()