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 @@
+
+
+
diff --git a/phpBB/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php b/phpBB/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php
index 209aba3646..36544b93da 100644
--- a/phpBB/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php
+++ b/phpBB/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php
@@ -20,7 +20,7 @@ class add_display_unapproved_posts_config extends \phpbb\db\migration\migration
return $this->config->offsetExists('display_unapproved_posts');
}
- public static function depends_on()
+ static public function depends_on()
{
return ['\phpbb\db\migration\data\v330\dev',];
}
diff --git a/phpBB/phpbb/db/migration/data/v330/remove_attachment_flash.php b/phpBB/phpbb/db/migration/data/v330/remove_attachment_flash.php
index c136960905..5bce86457e 100644
--- a/phpBB/phpbb/db/migration/data/v330/remove_attachment_flash.php
+++ b/phpBB/phpbb/db/migration/data/v330/remove_attachment_flash.php
@@ -24,7 +24,7 @@ class remove_attachment_flash extends \phpbb\db\migration\migration
self::ATTACHMENT_CATEGORY_FLASH,
);
- public static function depends_on()
+ static public function depends_on()
{
return ['\phpbb\db\migration\data\v330\dev',];
}
diff --git a/phpBB/phpbb/db/migration/data/v330/remove_max_pass_chars.php b/phpBB/phpbb/db/migration/data/v330/remove_max_pass_chars.php
index 10e5ee385d..c820645004 100644
--- a/phpBB/phpbb/db/migration/data/v330/remove_max_pass_chars.php
+++ b/phpBB/phpbb/db/migration/data/v330/remove_max_pass_chars.php
@@ -20,7 +20,7 @@ class remove_max_pass_chars extends \phpbb\db\migration\migration
return !$this->config->offsetExists('max_pass_chars');
}
- public static function depends_on()
+ static public function depends_on()
{
return [
'\phpbb\db\migration\data\v330\dev',
diff --git a/phpBB/phpbb/db/migration/data/v33x/default_search_return_chars.php b/phpBB/phpbb/db/migration/data/v33x/default_search_return_chars.php
index ec1e7af11f..9175c384dc 100644
--- a/phpBB/phpbb/db/migration/data/v33x/default_search_return_chars.php
+++ b/phpBB/phpbb/db/migration/data/v33x/default_search_return_chars.php
@@ -20,7 +20,7 @@ class default_search_return_chars extends \phpbb\db\migration\migration
return $this->config->offsetExists('default_search_return_chars');
}
- public static function depends_on()
+ static public function depends_on()
{
return [
'\phpbb\db\migration\data\v330\v330',
diff --git a/phpBB/phpbb/db/migration/data/v33x/google_recaptcha_v3.php b/phpBB/phpbb/db/migration/data/v33x/google_recaptcha_v3.php
index 65499cc402..e1362ed813 100644
--- a/phpBB/phpbb/db/migration/data/v33x/google_recaptcha_v3.php
+++ b/phpBB/phpbb/db/migration/data/v33x/google_recaptcha_v3.php
@@ -20,7 +20,7 @@ class google_recaptcha_v3 extends \phpbb\db\migration\migration
return $this->config->offsetExists('recaptcha_v3_key');
}
- public static function depends_on()
+ static public function depends_on()
{
return [
'\phpbb\db\migration\data\v330\v330',
diff --git a/phpBB/phpbb/db/tools/mssql.php b/phpBB/phpbb/db/tools/mssql.php
index 29f816a869..1653abeec0 100644
--- a/phpBB/phpbb/db/tools/mssql.php
+++ b/phpBB/phpbb/db/tools/mssql.php
@@ -30,7 +30,7 @@ class mssql extends tools
*
* @return array
*/
- public static function get_dbms_type_map()
+ static public function get_dbms_type_map()
{
return array(
'mssql' => array(
diff --git a/phpBB/phpbb/db/tools/postgres.php b/phpBB/phpbb/db/tools/postgres.php
index 7cb024d4f6..0c02a05d56 100644
--- a/phpBB/phpbb/db/tools/postgres.php
+++ b/phpBB/phpbb/db/tools/postgres.php
@@ -24,7 +24,7 @@ class postgres extends tools
*
* @return array
*/
- public static function get_dbms_type_map()
+ static public function get_dbms_type_map()
{
return array(
'postgres' => array(
diff --git a/phpBB/phpbb/debug/debug.php b/phpBB/phpbb/debug/debug.php
index c5ffada2e5..5e11c27586 100644
--- a/phpBB/phpbb/debug/debug.php
+++ b/phpBB/phpbb/debug/debug.php
@@ -24,7 +24,7 @@ use Symfony\Component\Debug\ExceptionHandler;
*/
class debug
{
- private static $enabled = false;
+ static private $enabled = false;
/**
* Enables the debug tools.
@@ -37,7 +37,7 @@ class debug
* @param int $errorReportingLevel The level of error reporting you want
* @param bool $displayErrors Whether to display errors (for development) or just log them (for production)
*/
- public static function enable($errorReportingLevel = null, $displayErrors = true)
+ static public function enable($errorReportingLevel = null, $displayErrors = true)
{
if (static::$enabled)
{