mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-17 22:28:46 +01:00
Merge branch '3.3.x'
This commit is contained in:
commit
46d2a93ae6
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @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');
|
||||
}
|
||||
}
|
||||
}
|
@ -89,4 +89,7 @@
|
||||
<!-- There MUST be one space between control structure and opening parenthesis -->
|
||||
<rule ref="./phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php" />
|
||||
|
||||
<!-- Static qualifier MUST be placed before the visibility qualifiers. -->
|
||||
<rule ref="./phpbb/Sniffs/ControlStructures/StaticKeywordSniff.php" />
|
||||
|
||||
</ruleset>
|
||||
|
@ -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',];
|
||||
}
|
||||
|
@ -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',];
|
||||
}
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user