Fix coding standard issues
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
2c5f80fc46
commit
199e3d9813
@ -31,7 +31,7 @@ $AUTH_MAP = [
|
||||
],
|
||||
];
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
// phpcs:disable PSR1.Files.SideEffects,Squiz.Functions.GlobalFunction
|
||||
|
||||
/**
|
||||
* Simple function to show HTML page with given content.
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// phpcs:disable Squiz.Functions.GlobalFunction
|
||||
|
||||
/**
|
||||
* This function returns username and password.
|
||||
*
|
||||
|
||||
@ -615,6 +615,7 @@ class FormDisplay
|
||||
|
||||
// keep boolean value as boolean
|
||||
if (! is_bool($value)) {
|
||||
// phpcs:ignore Generic.PHP.ForbiddenFunctions
|
||||
settype($value, gettype($vk));
|
||||
}
|
||||
|
||||
@ -699,12 +700,14 @@ class FormDisplay
|
||||
switch ($type) {
|
||||
case 'double':
|
||||
$_POST[$key] = Util::requestString($_POST[$key]);
|
||||
// phpcs:ignore Generic.PHP.ForbiddenFunctions
|
||||
settype($_POST[$key], 'float');
|
||||
break;
|
||||
case 'boolean':
|
||||
case 'integer':
|
||||
if ($_POST[$key] !== '') {
|
||||
$_POST[$key] = Util::requestString($_POST[$key]);
|
||||
// phpcs:ignore Generic.PHP.ForbiddenFunctions
|
||||
settype($_POST[$key], $type);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -95,6 +95,8 @@ class Plugins
|
||||
*/
|
||||
public static function getPlugins($plugin_type, $plugins_dir, $plugin_param)
|
||||
{
|
||||
global $skip_import;
|
||||
|
||||
$GLOBALS['plugin_param'] = $plugin_param;
|
||||
|
||||
$handle = @opendir($plugins_dir);
|
||||
@ -125,12 +127,12 @@ class Plugins
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @var bool */
|
||||
$GLOBALS['skip_import'] = false;
|
||||
/** @var bool $skip_import */
|
||||
$skip_import = false;
|
||||
|
||||
include_once $plugins_dir . $file;
|
||||
|
||||
if ($GLOBALS['skip_import']) {
|
||||
if ($skip_import) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ use PhpMyAdmin\Plugins\TransformationsPlugin;
|
||||
use PhpMyAdmin\Url;
|
||||
use stdClass;
|
||||
use function array_merge;
|
||||
use function defined;
|
||||
use function htmlspecialchars;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,16 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Query;
|
||||
|
||||
use PhpMyAdmin\Util;
|
||||
use function array_shift;
|
||||
use function count;
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* Handles caching results
|
||||
*/
|
||||
class Cache
|
||||
{
|
||||
|
||||
/** @var array Table data cache */
|
||||
private $tableCache = [];
|
||||
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Query;
|
||||
|
||||
use PhpMyAdmin\Util;
|
||||
use function implode;
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* Handles generating SQL queries
|
||||
|
||||
@ -24,6 +24,7 @@ use function htmlspecialchars;
|
||||
use function implode;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
use function is_bool;
|
||||
use function is_string;
|
||||
use function ksort;
|
||||
use function mb_check_encoding;
|
||||
@ -611,6 +612,7 @@ class Relation
|
||||
}
|
||||
}
|
||||
$this->dbi->freeResult($tableRes);
|
||||
|
||||
return $cfgRelation;
|
||||
}
|
||||
|
||||
|
||||
@ -538,6 +538,7 @@ class Response
|
||||
*/
|
||||
public function header($text)
|
||||
{
|
||||
// phpcs:ignore SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly
|
||||
header($text);
|
||||
}
|
||||
|
||||
|
||||
@ -31,10 +31,10 @@ class NodeTrans extends TransNode
|
||||
*/
|
||||
public function __construct(
|
||||
Node $body,
|
||||
Node $plural = null,
|
||||
AbstractExpression $count = null,
|
||||
Node $context = null,
|
||||
Node $notes = null,
|
||||
?Node $plural = null,
|
||||
?AbstractExpression $count = null,
|
||||
?Node $context = null,
|
||||
?Node $notes = null,
|
||||
$lineno,
|
||||
$tag = null
|
||||
) {
|
||||
@ -66,11 +66,11 @@ class NodeTrans extends TransNode
|
||||
{
|
||||
$compiler->addDebugInfo($this);
|
||||
|
||||
list($msg, $vars) = $this->compileString($this->getNode('body'));
|
||||
[$msg, $vars] = $this->compileString($this->getNode('body'));
|
||||
|
||||
$msg1 = null;
|
||||
if ($this->hasNode('plural')) {
|
||||
list($msg1, $vars1) = $this->compileString($this->getNode('plural'));
|
||||
[$msg1, $vars1] = $this->compileString($this->getNode('plural'));
|
||||
|
||||
$vars = array_merge($vars, $vars1);
|
||||
}
|
||||
|
||||
@ -23,21 +23,21 @@ class MessageExtension extends AbstractExtension
|
||||
return [
|
||||
new TwigFilter(
|
||||
'notice',
|
||||
function (string $string) {
|
||||
static function (string $string) {
|
||||
return Message::notice($string)->getDisplay();
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFilter(
|
||||
'error',
|
||||
function (string $string) {
|
||||
static function (string $string) {
|
||||
return Message::error($string)->getDisplay();
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFilter(
|
||||
'raw_success',
|
||||
function (string $string) {
|
||||
static function (string $string) {
|
||||
return Message::rawSuccess($string)->getDisplay();
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
|
||||
@ -21,6 +21,7 @@ class RelationExtension extends AbstractExtension
|
||||
public function getFunctions()
|
||||
{
|
||||
$relation = new Relation($GLOBALS['dbi']);
|
||||
|
||||
return [
|
||||
new TwigFunction(
|
||||
'foreign_dropdown',
|
||||
|
||||
@ -21,6 +21,7 @@ class TransformationsExtension extends AbstractExtension
|
||||
public function getFunctions()
|
||||
{
|
||||
$transformations = new Transformations();
|
||||
|
||||
return [
|
||||
new TwigFunction(
|
||||
'get_description',
|
||||
|
||||
@ -1016,6 +1016,7 @@ class Util
|
||||
$conditionValue = '= \''
|
||||
. $GLOBALS['dbi']->escapeString($row) . '\'';
|
||||
}
|
||||
|
||||
return [$conditionValue, $condition];
|
||||
}
|
||||
|
||||
@ -1114,7 +1115,7 @@ class Util
|
||||
$condition = ' ' . $con_key . ' ';
|
||||
|
||||
[$con_val, $condition] = self::getConditionValue(
|
||||
(! isset($row[$i]) || $row[$i] === null) ? null : $row[$i],
|
||||
! isset($row[$i]) || $row[$i] === null ? null : $row[$i],
|
||||
$meta,
|
||||
$GLOBALS['dbi']->fieldFlags($handle, $i),
|
||||
$fields_cnt,
|
||||
|
||||
@ -22,29 +22,7 @@
|
||||
<exclude name="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration"/>
|
||||
|
||||
<exclude name="Squiz.Arrays.ArrayDeclaration"/>
|
||||
<exclude name="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces"/>
|
||||
<exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectLinesCountBetweenDescriptionAndAnnotations"/>
|
||||
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat"/>
|
||||
<exclude name="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing"/>
|
||||
<exclude name="SlevomatCodingStandard.ControlStructures.EarlyExit"/>
|
||||
<exclude name="SlevomatCodingStandard.Functions.StaticClosure"/>
|
||||
<exclude name="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
|
||||
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFallbackGlobalName"/>
|
||||
<exclude name="SlevomatCodingStandard.Namespaces.UnusedUses"/>
|
||||
<exclude name="SlevomatCodingStandard.PHP.ShortList"/>
|
||||
<exclude name="SlevomatCodingStandard.PHP.UselessParentheses"/>
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
|
||||
</rule>
|
||||
|
||||
<rule ref="Generic.PHP.ForbiddenFunctions">
|
||||
<exclude-pattern>libraries/classes/Config/FormDisplay.php</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="Squiz.Functions.GlobalFunction">
|
||||
<exclude-pattern>examples/openid.php</exclude-pattern>
|
||||
<exclude-pattern>examples/signon-script.php</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedMethod">
|
||||
|
||||
@ -9,12 +9,11 @@ namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Query\Cache;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Table;
|
||||
use PhpMyAdmin\Query\Cache;
|
||||
use PhpMyAdmin\Tests\Stubs\DbiDummy;
|
||||
use stdClass;
|
||||
use ReflectionClass;
|
||||
|
||||
/**
|
||||
* Tests behaviour of Table class
|
||||
@ -947,9 +946,7 @@ class TableTest extends AbstractTestCase
|
||||
|
||||
$dbi->getCache()->cacheTableContent(
|
||||
['PMA', 'PMA_BookMark'],
|
||||
[
|
||||
'ENGINE' => 'MERGE',
|
||||
]
|
||||
['ENGINE' => 'MERGE']
|
||||
);
|
||||
|
||||
$tableObj = new Table('PMA_BookMark', 'PMA');
|
||||
@ -970,9 +967,7 @@ class TableTest extends AbstractTestCase
|
||||
|
||||
$dbi->getCache()->cacheTableContent(
|
||||
['PMA', 'PMA_BookMark'],
|
||||
[
|
||||
'ENGINE' => 'MRG_MYISAM',
|
||||
]
|
||||
['ENGINE' => 'MRG_MYISAM']
|
||||
);
|
||||
|
||||
$tableObj = new Table('PMA_BookMark', 'PMA');
|
||||
|
||||
@ -21,6 +21,7 @@ use function floatval;
|
||||
use function htmlspecialchars;
|
||||
use function ini_get;
|
||||
use function ini_set;
|
||||
use function str_repeat;
|
||||
use function str_replace;
|
||||
use function strlen;
|
||||
use function trim;
|
||||
@ -74,6 +75,7 @@ class UtilTest extends AbstractTestCase
|
||||
|
||||
/**
|
||||
* Test for listPHPExtensions
|
||||
*
|
||||
* @requires extension mysqli
|
||||
* @requires extension curl
|
||||
* @requires extension mbstring
|
||||
|
||||
Loading…
Reference in New Issue
Block a user