You've already forked phpmyadmin
mirror of
https://github.com/phpmyadmin/phpmyadmin.git
synced 2026-10-23 18:29:15 +03:00
Merge pull request #20465 from kamil-tekiela/Refactoring
Various refactorings
This commit is contained in:
@@ -5802,30 +5802,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/FlashMessenger.php
|
||||
|
||||
-
|
||||
message: '#^Binary operation "\*" between int and mixed results in an error\.$#'
|
||||
identifier: binaryOp.invalid
|
||||
count: 1
|
||||
path: src/Font.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''chars'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
count: 2
|
||||
path: src/Font.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''modifier'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
count: 2
|
||||
path: src/Font.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$search of function str_replace expects array\<string\>\|string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Font.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Access to deprecated static property \$route of class PhpMyAdmin\\Routing\\Routing\:
|
||||
@@ -7383,12 +7359,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/InsertEdit.php
|
||||
|
||||
-
|
||||
message: '#^Method PhpMyAdmin\\InsertEdit\:\:getErrorUrl\(\) should return string but returns mixed\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: src/InsertEdit.php
|
||||
|
||||
-
|
||||
message: '#^Method PhpMyAdmin\\InsertEdit\:\:getFormParametersForInsertForm\(\) should return array\<string, string\> but returns array\<string, mixed\>\.$#'
|
||||
identifier: return.type
|
||||
@@ -7542,12 +7512,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/ListDatabase.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$callback of function usort expects callable\(mixed, mixed\)\: int, Closure\(string, string\)\: int\<\-1, 1\> given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/ListDatabase.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Access to deprecated static property \$route of class PhpMyAdmin\\Routing\\Routing\:
|
||||
@@ -12807,12 +12771,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''desc'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''disk_usage'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
@@ -12825,22 +12783,10 @@ parameters:
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''title'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
count: 3
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''type'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
count: 4
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''value'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
count: 4
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
@@ -12868,31 +12814,7 @@ parameters:
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$haystack of function mb_stripos expects string, string\|null given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$message of static method PhpMyAdmin\\Html\\Generator\:\:showHint\(\) expects string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$string of function htmlspecialchars expects string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 2
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$value of method PhpMyAdmin\\StorageEngine\:\:resolveTypeSize\(\) expects int\|string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$value of static method PhpMyAdmin\\Util\:\:formatNumber\(\) expects float\|int\|numeric\-string, mixed given\.$#'
|
||||
message: '#^Parameter \#1 \$value of static method PhpMyAdmin\\Util\:\:formatNumber\(\) expects float\|int\|numeric\-string, string given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
@@ -4034,31 +4034,6 @@
|
||||
<code><![CDATA[$this->storage[self::STORAGE_KEY]]]></code>
|
||||
</MixedReturnStatement>
|
||||
</file>
|
||||
<file src="src/Font.php">
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$charList['chars']]]></code>
|
||||
<code><![CDATA[$textWidth * $modifier]]></code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$charList['chars']]]></code>
|
||||
<code><![CDATA[$charList['modifier']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$charList]]></code>
|
||||
<code><![CDATA[$count]]></code>
|
||||
<code><![CDATA[$count]]></code>
|
||||
<code><![CDATA[$textWidth]]></code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand>
|
||||
<code><![CDATA[$charList['modifier']]]></code>
|
||||
<code><![CDATA[$count]]></code>
|
||||
<code><![CDATA[$count]]></code>
|
||||
<code><![CDATA[$textWidth]]></code>
|
||||
<code><![CDATA[(mb_strlen($text)
|
||||
- mb_strlen(str_replace($charList['chars'], '', $text))
|
||||
) * $charList['modifier']]]></code>
|
||||
</MixedOperand>
|
||||
</file>
|
||||
<file src="src/Footer.php">
|
||||
<DeprecatedProperty>
|
||||
<code><![CDATA[Routing::$route]]></code>
|
||||
@@ -4787,12 +4762,10 @@
|
||||
<code><![CDATA[$urlParams]]></code>
|
||||
</InvalidArgument>
|
||||
<InvalidReturnStatement>
|
||||
<code><![CDATA[$_POST['err_url'] ?? Url::getFromRoute('/table/change', $urlParams)]]></code>
|
||||
<code><![CDATA[$formParams]]></code>
|
||||
</InvalidReturnStatement>
|
||||
<InvalidReturnType>
|
||||
<code><![CDATA[array<string, string>]]></code>
|
||||
<code><![CDATA[string]]></code>
|
||||
</InvalidReturnType>
|
||||
<LessSpecificReturnStatement>
|
||||
<code><![CDATA[[
|
||||
@@ -4884,9 +4857,6 @@
|
||||
</PossiblyNullOperand>
|
||||
</file>
|
||||
<file src="src/ListDatabase.php">
|
||||
<MixedArgumentTypeCoercion>
|
||||
<code><![CDATA[usort($databaseList, strnatcasecmp(...))]]></code>
|
||||
</MixedArgumentTypeCoercion>
|
||||
<RiskyTruthyFalsyComparison>
|
||||
<code><![CDATA[empty($this->config->selectedServer['hide_db'])]]></code>
|
||||
</RiskyTruthyFalsyComparison>
|
||||
@@ -7581,6 +7551,9 @@
|
||||
</RiskyTruthyFalsyComparison>
|
||||
</file>
|
||||
<file src="src/StorageEngine.php">
|
||||
<ArgumentTypeCoercion>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
</ArgumentTypeCoercion>
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
@@ -7588,37 +7561,17 @@
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$details['desc']]]></code>
|
||||
<code><![CDATA[$details['title']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$decodedData['disk_usage']]]></code>
|
||||
<code><![CDATA[$decodedData['disk_usage']]]></code>
|
||||
<code><![CDATA[$details['desc']]]></code>
|
||||
<code><![CDATA[$details['title']]]></code>
|
||||
<code><![CDATA[$details['type']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
<code><![CDATA[$mroongaData['type']]]></code>
|
||||
<code><![CDATA[$mroongaData['type']['id']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayAssignment>
|
||||
<code><![CDATA[$mysqlVars[$row['Variable_name']]['title']]]></code>
|
||||
<code><![CDATA[$mysqlVars[$row['Variable_name']]['type']]]></code>
|
||||
<code><![CDATA[$mysqlVars[$row['Variable_name']]['value']]]></code>
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$dataLength]]></code>
|
||||
<code><![CDATA[$decodedData]]></code>
|
||||
<code><![CDATA[$details]]></code>
|
||||
<code><![CDATA[$indexLength]]></code>
|
||||
<code><![CDATA[$mroongaData]]></code>
|
||||
<code><![CDATA[$mysqlVars[$row['Variable_name']]]]></code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand>
|
||||
<code><![CDATA[$decodedData['disk_usage']]]></code>
|
||||
@@ -7631,19 +7584,10 @@
|
||||
<code><![CDATA[[$dataLength, $indexLength]]]></code>
|
||||
<code><![CDATA[int[]]]></code>
|
||||
</MixedReturnTypeCoercion>
|
||||
<PossiblyNullArgument>
|
||||
<code><![CDATA[$row['Variable_name']]]></code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyNullArrayOffset>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$variables]]></code>
|
||||
<code><![CDATA[$variables]]></code>
|
||||
</PossiblyNullArrayOffset>
|
||||
<RiskyTruthyFalsyComparison>
|
||||
<code><![CDATA[empty($details['desc'])]]></code>
|
||||
<code><![CDATA[empty($variableInfo['title'])]]></code>
|
||||
</RiskyTruthyFalsyComparison>
|
||||
</file>
|
||||
<file src="src/SystemDatabase.php">
|
||||
<PossiblyNullArgument>
|
||||
|
||||
@@ -21,7 +21,7 @@ class Innodb extends StorageEngine
|
||||
/**
|
||||
* Returns array with variable names related to InnoDB storage engine
|
||||
*
|
||||
* @return mixed[] variable names
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> variable names
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ class Memory extends StorageEngine
|
||||
/**
|
||||
* Returns array with variable names dedicated to MEMORY storage engine
|
||||
*
|
||||
* @return mixed[] variable names
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> variable names
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ class Myisam extends StorageEngine
|
||||
/**
|
||||
* Returns array with variable names dedicated to MyISAM storage engine
|
||||
*
|
||||
* @return mixed[] variable names
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> variable names
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ class Ndbcluster extends StorageEngine
|
||||
/**
|
||||
* Returns array with variable names related to NDBCLUSTER storage engine
|
||||
*
|
||||
* @return mixed[] variable names
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> variable names
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class Pbxt extends StorageEngine
|
||||
/**
|
||||
* Returns array with variable names dedicated to PBXT storage engine
|
||||
*
|
||||
* @return mixed[] variable names
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> variable names
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
131
src/Font.php
131
src/Font.php
@@ -8,7 +8,6 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use function ceil;
|
||||
use function is_array;
|
||||
use function mb_strlen;
|
||||
use function mb_strtolower;
|
||||
use function preg_replace;
|
||||
@@ -19,69 +18,61 @@ use function str_replace;
|
||||
*/
|
||||
class Font
|
||||
{
|
||||
/**
|
||||
* Get list with characters and the corresponding width modifiers.
|
||||
*
|
||||
* @return (float|string[])[][] with characters and corresponding width modifier
|
||||
*/
|
||||
public function getCharLists(): array
|
||||
{
|
||||
return [
|
||||
//ijl
|
||||
['chars' => ['i', 'j', 'l'], 'modifier' => 0.23],
|
||||
//f
|
||||
['chars' => ['f'], 'modifier' => 0.27],
|
||||
//tI
|
||||
['chars' => ['t', 'I'], 'modifier' => 0.28],
|
||||
//r
|
||||
['chars' => ['r'], 'modifier' => 0.34],
|
||||
//1
|
||||
['chars' => ['1'], 'modifier' => 0.49],
|
||||
//cksvxyzJ
|
||||
['chars' => ['c', 'k', 's', 'v', 'x', 'y', 'z', 'J'], 'modifier' => 0.5],
|
||||
//abdeghnopquL023456789
|
||||
[
|
||||
'chars' => [
|
||||
'a',
|
||||
'b',
|
||||
'd',
|
||||
'e',
|
||||
'g',
|
||||
'h',
|
||||
'n',
|
||||
'o',
|
||||
'p',
|
||||
'q',
|
||||
'u',
|
||||
'L',
|
||||
'0',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
],
|
||||
'modifier' => 0.56,
|
||||
private const CHAR_LISTS = [
|
||||
//ijl
|
||||
['chars' => ['i', 'j', 'l'], 'modifier' => 0.23],
|
||||
//f
|
||||
['chars' => ['f'], 'modifier' => 0.27],
|
||||
//tI
|
||||
['chars' => ['t', 'I'], 'modifier' => 0.28],
|
||||
//r
|
||||
['chars' => ['r'], 'modifier' => 0.34],
|
||||
//1
|
||||
['chars' => ['1'], 'modifier' => 0.49],
|
||||
//cksvxyzJ
|
||||
['chars' => ['c', 'k', 's', 'v', 'x', 'y', 'z', 'J'], 'modifier' => 0.5],
|
||||
//abdeghnopquL023456789
|
||||
[
|
||||
'chars' => [
|
||||
'a',
|
||||
'b',
|
||||
'd',
|
||||
'e',
|
||||
'g',
|
||||
'h',
|
||||
'n',
|
||||
'o',
|
||||
'p',
|
||||
'q',
|
||||
'u',
|
||||
'L',
|
||||
'0',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
],
|
||||
//FTZ
|
||||
['chars' => ['F', 'T', 'Z'], 'modifier' => 0.61],
|
||||
//ABEKPSVXY
|
||||
['chars' => ['A', 'B', 'E', 'K', 'P', 'S', 'V', 'X', 'Y'], 'modifier' => 0.67],
|
||||
//wCDHNRU
|
||||
['chars' => ['w', 'C', 'D', 'H', 'N', 'R', 'U'], 'modifier' => 0.73],
|
||||
//GOQ
|
||||
['chars' => ['G', 'O', 'Q'], 'modifier' => 0.78],
|
||||
//mM
|
||||
['chars' => ['m', 'M'], 'modifier' => 0.84],
|
||||
//W
|
||||
['chars' => ['W'], 'modifier' => 0.95],
|
||||
//" "
|
||||
['chars' => [' '], 'modifier' => 0.28],
|
||||
];
|
||||
}
|
||||
'modifier' => 0.56,
|
||||
],
|
||||
//FTZ
|
||||
['chars' => ['F', 'T', 'Z'], 'modifier' => 0.61],
|
||||
//ABEKPSVXY
|
||||
['chars' => ['A', 'B', 'E', 'K', 'P', 'S', 'V', 'X', 'Y'], 'modifier' => 0.67],
|
||||
//wCDHNRU
|
||||
['chars' => ['w', 'C', 'D', 'H', 'N', 'R', 'U'], 'modifier' => 0.73],
|
||||
//GOQ
|
||||
['chars' => ['G', 'O', 'Q'], 'modifier' => 0.78],
|
||||
//mM
|
||||
['chars' => ['m', 'M'], 'modifier' => 0.84],
|
||||
//W
|
||||
['chars' => ['W'], 'modifier' => 0.95],
|
||||
//" "
|
||||
['chars' => [' '], 'modifier' => 0.28],
|
||||
];
|
||||
|
||||
/**
|
||||
* Get width of string/text
|
||||
@@ -89,10 +80,9 @@ class Font
|
||||
* The text element width is calculated depending on font name
|
||||
* and font size.
|
||||
*
|
||||
* @param string $text string of which the width will be calculated
|
||||
* @param string $font name of the font like Arial,sans-serif etc
|
||||
* @param int $fontSize size of font
|
||||
* @param mixed[]|null $charLists list of characters and their width modifiers
|
||||
* @param string $text string of which the width will be calculated
|
||||
* @param string $font name of the font like Arial,sans-serif etc
|
||||
* @param int $fontSize size of font
|
||||
*
|
||||
* @return int width of the text
|
||||
*/
|
||||
@@ -100,16 +90,11 @@ class Font
|
||||
string $text,
|
||||
string $font,
|
||||
int $fontSize,
|
||||
array|null $charLists = null,
|
||||
): int {
|
||||
if (! isset($charLists[0]['chars'], $charLists[0]['modifier']) || ! is_array($charLists[0]['chars'])) {
|
||||
$charLists = $this->getCharLists();
|
||||
}
|
||||
|
||||
// Start by counting the width, giving each character a modifying value
|
||||
$count = 0;
|
||||
|
||||
foreach ($charLists as $charList) {
|
||||
foreach (self::CHAR_LISTS as $charList) {
|
||||
$count += (mb_strlen($text)
|
||||
- mb_strlen(str_replace($charList['chars'], '', $text))
|
||||
) * $charList['modifier'];
|
||||
|
||||
@@ -795,18 +795,6 @@ class InsertEdit
|
||||
return $gotoInclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the url to return in case of failure of the query
|
||||
*
|
||||
* @param mixed[] $urlParams url parameters
|
||||
*
|
||||
* @return string error url for query failure
|
||||
*/
|
||||
public function getErrorUrl(array $urlParams): string
|
||||
{
|
||||
return $_POST['err_url'] ?? Url::getFromRoute('/table/change', $urlParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the sql query and get the result, then move back to the calling page
|
||||
*
|
||||
|
||||
@@ -75,7 +75,7 @@ class ListDatabase extends ArrayObject
|
||||
*
|
||||
* @param string|null $likeDbName usually a db_name containing wildcards
|
||||
*
|
||||
* @return mixed[]
|
||||
* @return string[]
|
||||
*/
|
||||
protected function retrieve(UserPrivileges $userPrivileges, string|null $likeDbName = null): array
|
||||
{
|
||||
|
||||
@@ -340,7 +340,7 @@ class StorageEngine
|
||||
/**
|
||||
* Returns array with detailed info about engine specific server variables
|
||||
*
|
||||
* @return mixed[] array with detailed info about specific engine server variables
|
||||
* @return array<string, array{title: string, desc: string|null, type: int, value: string}>
|
||||
*/
|
||||
public function getVariablesStatus(): array
|
||||
{
|
||||
@@ -355,24 +355,23 @@ class StorageEngine
|
||||
|
||||
$sqlQuery = 'SHOW GLOBAL VARIABLES ' . $like . ';';
|
||||
$res = DatabaseInterface::getInstance()->query($sqlQuery);
|
||||
foreach ($res as $row) {
|
||||
if (isset($variables[$row['Variable_name']])) {
|
||||
$mysqlVars[$row['Variable_name']] = $variables[$row['Variable_name']];
|
||||
} elseif ($like === '' && mb_stripos($row['Variable_name'], $this->engine) !== 0) {
|
||||
/**
|
||||
* @var string $variableName
|
||||
* @var string $value
|
||||
*/
|
||||
foreach ($res as ['Variable_name' => $variableName, 'Value' => $value]) {
|
||||
if (! isset($variables[$variableName]) && $like === '' && mb_stripos($variableName, $this->engine) !== 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mysqlVars[$row['Variable_name']]['value'] = $row['Value'];
|
||||
$variableInfo = $variables[$variableName] ?? [];
|
||||
|
||||
if (empty($mysqlVars[$row['Variable_name']]['title'])) {
|
||||
$mysqlVars[$row['Variable_name']]['title'] = $row['Variable_name'];
|
||||
}
|
||||
|
||||
if (isset($mysqlVars[$row['Variable_name']]['type'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mysqlVars[$row['Variable_name']]['type'] = self::DETAILS_TYPE_PLAINTEXT;
|
||||
$mysqlVars[$variableName] = [
|
||||
'title' => empty($variableInfo['title']) ? $variableName : $variableInfo['title'],
|
||||
'desc' => $variableInfo['desc'] ?? null,
|
||||
'type' => $variableInfo['type'] ?? self::DETAILS_TYPE_PLAINTEXT,
|
||||
'value' => $value,
|
||||
];
|
||||
}
|
||||
|
||||
return $mysqlVars;
|
||||
@@ -420,7 +419,7 @@ class StorageEngine
|
||||
* engine. This function should be overridden when extending this class
|
||||
* for a particular engine.
|
||||
*
|
||||
* @return mixed[] The list of variables.
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> The list of variables.
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
@@ -201,63 +201,4 @@ class FontTest extends AbstractTestCase
|
||||
$this->font->getStringWidth('phpMyAdmin', 'arial', 20),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getStringWidth with a custom charList.
|
||||
*/
|
||||
public function testGetStringWidthCharLists(): void
|
||||
{
|
||||
// string "a", with invalid charlist (= array without proper structure)
|
||||
self::assertSame(
|
||||
6,
|
||||
$this->font->getStringWidth('a', 'arial', 10, ['list']),
|
||||
);
|
||||
|
||||
// string "a", with invalid charlist (= array without proper structure :
|
||||
// modifier is missing
|
||||
self::assertSame(
|
||||
6,
|
||||
$this->font->getStringWidth(
|
||||
'a',
|
||||
'arial',
|
||||
10,
|
||||
[['chars' => 'a']],
|
||||
),
|
||||
);
|
||||
|
||||
// string "a", with invalid charlist (= array without proper structure :
|
||||
// chars is missing
|
||||
self::assertSame(
|
||||
6,
|
||||
$this->font->getStringWidth(
|
||||
'a',
|
||||
'arial',
|
||||
10,
|
||||
[['modifier' => 0.61]],
|
||||
),
|
||||
);
|
||||
|
||||
// string "a", with invalid charlist (= array without proper structure :
|
||||
// chars is not an array
|
||||
self::assertSame(
|
||||
6,
|
||||
$this->font->getStringWidth(
|
||||
'a',
|
||||
'arial',
|
||||
10,
|
||||
[['chars' => 'a', 'modifier' => 0.61]],
|
||||
),
|
||||
);
|
||||
|
||||
// string "a", with valid charlist
|
||||
self::assertSame(
|
||||
7,
|
||||
$this->font->getStringWidth(
|
||||
'a',
|
||||
'arial',
|
||||
10,
|
||||
[['chars' => ['a'], 'modifier' => 0.61]],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1129,23 +1129,6 @@ class InsertEditTest extends AbstractTestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for getErrorUrl
|
||||
*/
|
||||
public function testGetErrorUrl(): void
|
||||
{
|
||||
self::assertSame(
|
||||
'index.php?route=/table/change&lang=en',
|
||||
$this->insertEdit->getErrorUrl([]),
|
||||
);
|
||||
|
||||
$_POST['err_url'] = 'localhost';
|
||||
self::assertSame(
|
||||
'localhost',
|
||||
$this->insertEdit->getErrorUrl([]),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for executeSqlQuery
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user