diff --git a/build/code_sniffer/phpbb/Sniffs/ControlStructures/StaticKeywordSniff.php b/build/code_sniffer/phpbb/Sniffs/ControlStructures/StaticKeywordSniff.php
new file mode 100644
index 0000000000..1dabe82235
--- /dev/null
+++ b/build/code_sniffer/phpbb/Sniffs/ControlStructures/StaticKeywordSniff.php
@@ -0,0 +1,57 @@
+
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+/**
+ * Checks that the visibility qualifiers are placed after the static keyword
+ * according to the coding guidelines
+ */
+class phpbb_Sniffs_ControlStructures_StaticKeywordSniff implements Sniff
+{
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ */
+ public function register()
+ {
+ return [
+ T_STATIC,
+ ];
+ }
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ $disallowed_before_tokens = [
+ T_PUBLIC,
+ T_PROTECTED,
+ T_PRIVATE,
+ ];
+
+ if (in_array($tokens[$stackPtr - 2]['code'], $disallowed_before_tokens))
+ {
+ $error = 'Access specifier (e.g. public) should follow static scope attribute. Encountered "' . $tokens[$stackPtr - 2]['content'] . '" before static';
+ $phpcsFile->addError($error, $stackPtr, 'InvalidStaticFunctionDeclaration');
+ }
+ }
+}
diff --git a/build/code_sniffer/ruleset-php-legacy.xml b/build/code_sniffer/ruleset-php-legacy.xml
index c740c6080f..47d0ca772a 100644
--- a/build/code_sniffer/ruleset-php-legacy.xml
+++ b/build/code_sniffer/ruleset-php-legacy.xml
@@ -89,4 +89,7 @@
+
+
+