Skip to content

Commit 41996de

Browse files
Merge pull request #18594 from kamil-tekiela/Fix-SA-reported-issues
Fix SA reported issues
2 parents e436ad2 + a8a3986 commit 41996de

File tree

6 files changed

+30
-150
lines changed

6 files changed

+30
-150
lines changed

libraries/classes/Config/Validator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,9 @@ public static function validateNonNegativeNumber(string $path, array $values): a
570570
* Validates value according to given regular expression
571571
* Pattern and modifiers must be a valid for PCRE <b>and</b> JavaScript RegExp
572572
*
573-
* @param string $path path to config
574-
* @param mixed[] $values config values
575-
* @param string $regex regular expression to match
573+
* @param string $path path to config
574+
* @param mixed[] $values config values
575+
* @param non-empty-string $regex regular expression to match
576576
*/
577577
public static function validateByRegex(string $path, array $values, string $regex): array|string
578578
{

libraries/classes/Controllers/Table/SearchController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,31 @@ class SearchController extends AbstractController
4444
/**
4545
* Names of columns
4646
*
47-
* @var mixed[]
47+
* @var list<string>
4848
*/
4949
private array $columnNames = [];
5050
/**
5151
* Types of columns
5252
*
53-
* @var mixed[]
53+
* @var list<string>
5454
*/
5555
private array $columnTypes = [];
5656
/**
5757
* Types of columns without any replacement
5858
*
59-
* @var mixed[]
59+
* @var list<string>
6060
*/
6161
private array $originalColumnTypes = [];
6262
/**
6363
* Collations of columns
6464
*
65-
* @var mixed[]
65+
* @var list<string>
6666
*/
6767
private array $columnCollations = [];
6868
/**
6969
* Null Flags of columns
7070
*
71-
* @var mixed[]
71+
* @var list<bool>
7272
*/
7373
private array $columnNullFlags = [];
7474
/**
@@ -132,7 +132,7 @@ private function loadTableInfo(): void
132132
$type = mb_strtolower($type);
133133
}
134134

135-
if (empty($type)) {
135+
if ($type === '') {
136136
$type = '&nbsp;';
137137
}
138138

@@ -375,7 +375,7 @@ public function getColumnProperties(int $searchIndex, int $columnIndex): array
375375

376376
$value = $this->template->render('table/search/input_box', [
377377
'str' => '',
378-
'column_type' => (string) $type,
378+
'column_type' => $type,
379379
'column_data_type' => $isInteger ? 'INT' : ($isFloat ? 'FLOAT' : strtoupper($cleanType)),
380380
'html_attributes' => $htmlAttributes,
381381
'column_id' => 'fieldID_',

libraries/classes/Controllers/Table/Structure/MoveColumnsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function __invoke(ServerRequest $request): void
9797
$virtual = ['VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED'];
9898
$data['Virtuality'] = '';
9999
$data['Expression'] = '';
100-
if (isset($data['Extra']) && in_array($data['Extra'], $virtual)) {
100+
if (isset($data['Extra']) && in_array($data['Extra'], $virtual, true)) {
101101
$data['Virtuality'] = str_replace(' GENERATED', '', $data['Extra']);
102102
$expressions = $this->tableObj->getColumnGenerationExpression($column);
103103
$data['Expression'] = is_array($expressions) ? $expressions[$column] : null;

libraries/classes/Controllers/Table/ZoomSearchController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@
4242
*/
4343
class ZoomSearchController extends AbstractController
4444
{
45-
/** @var mixed[] */
45+
/** @var list<string> */
4646
private array $columnNames = [];
4747

48-
/** @var mixed[] */
48+
/** @var list<string> */
4949
private array $columnTypes = [];
5050

51-
/** @var mixed[] */
51+
/** @var list<string> */
5252
private array $originalColumnTypes = [];
5353

54-
/** @var mixed[] */
54+
/** @var list<string> */
5555
private array $columnCollations = [];
5656

57-
/** @var mixed[] */
57+
/** @var list<bool> */
5858
private array $columnNullFlags = [];
5959

6060
/** @var bool Whether a geometry column is present */
@@ -188,7 +188,7 @@ private function loadTableInfo(): void
188188
$type = mb_strtolower($type);
189189
}
190190

191-
if (empty($type)) {
191+
if ($type === '') {
192192
$type = '&nbsp;';
193193
}
194194

@@ -462,7 +462,7 @@ public function getColumnProperties(int $searchIndex, int $columnIndex): array
462462

463463
$value = $this->template->render('table/search/input_box', [
464464
'str' => '',
465-
'column_type' => (string) $type,
465+
'column_type' => $type,
466466
'column_data_type' => $isInteger ? 'INT' : ($isFloat ? 'FLOAT' : strtoupper($cleanType)),
467467
'html_attributes' => $htmlAttributes,
468468
'column_id' => 'fieldID_',

phpstan-baseline.neon

Lines changed: 11 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -8730,14 +8730,9 @@ parameters:
87308730
count: 1
87318731
path: libraries/classes/Controllers/Table/SearchController.php
87328732

8733-
-
8734-
message: "#^Cannot cast mixed to string\\.$#"
8735-
count: 1
8736-
path: libraries/classes/Controllers/Table/SearchController.php
8737-
87388733
-
87398734
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
8740-
count: 2
8735+
count: 1
87418736
path: libraries/classes/Controllers/Table/SearchController.php
87428737

87438738
-
@@ -8770,11 +8765,6 @@ parameters:
87708765
count: 1
87718766
path: libraries/classes/Controllers/Table/SearchController.php
87728767

8773-
-
8774-
message: "#^Parameter \\#1 \\$columnSpecification of static method PhpMyAdmin\\\\Util\\:\\:extractColumnSpec\\(\\) expects string, mixed given\\.$#"
8775-
count: 1
8776-
path: libraries/classes/Controllers/Table/SearchController.php
8777-
87788768
-
87798769
message: "#^Parameter \\#1 \\$database of method PhpMyAdmin\\\\DatabaseInterface\\:\\:getColumns\\(\\) expects string, mixed given\\.$#"
87808770
count: 1
@@ -8806,12 +8796,7 @@ parameters:
88068796
path: libraries/classes/Controllers/Table/SearchController.php
88078797

88088798
-
8809-
message: "#^Parameter \\#1 \\$string of function md5 expects string, mixed given\\.$#"
8810-
count: 1
8811-
path: libraries/classes/Controllers/Table/SearchController.php
8812-
8813-
-
8814-
message: "#^Parameter \\#1 \\$string of function strtoupper expects string, \\(array\\<int, string\\>\\|string\\|null\\) given\\.$#"
8799+
message: "#^Parameter \\#1 \\$string of function strtoupper expects string, string\\|null given\\.$#"
88158800
count: 1
88168801
path: libraries/classes/Controllers/Table/SearchController.php
88178802

@@ -8821,12 +8806,12 @@ parameters:
88218806
path: libraries/classes/Controllers/Table/SearchController.php
88228807

88238808
-
8824-
message: "#^Parameter \\#1 \\$type of method PhpMyAdmin\\\\Types\\:\\:getIntegerRange\\(\\) expects string, \\(array\\<int, string\\>\\|string\\|null\\) given\\.$#"
8809+
message: "#^Parameter \\#1 \\$type of method PhpMyAdmin\\\\Types\\:\\:getIntegerRange\\(\\) expects string, string\\|null given\\.$#"
88258810
count: 1
88268811
path: libraries/classes/Controllers/Table/SearchController.php
88278812

88288813
-
8829-
message: "#^Parameter \\#1 \\$type of method PhpMyAdmin\\\\Types\\:\\:getTypeOperatorsHtml\\(\\) expects string, \\(array\\<int, string\\>\\|string\\|null\\) given\\.$#"
8814+
message: "#^Parameter \\#1 \\$type of method PhpMyAdmin\\\\Types\\:\\:getTypeOperatorsHtml\\(\\) expects string, string\\|null given\\.$#"
88308815
count: 1
88318816
path: libraries/classes/Controllers/Table/SearchController.php
88328817

@@ -8840,26 +8825,11 @@ parameters:
88408825
count: 1
88418826
path: libraries/classes/Controllers/Table/SearchController.php
88428827

8843-
-
8844-
message: "#^Parameter \\#2 \\$column of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:searchColumnInForeigners\\(\\) expects string, mixed given\\.$#"
8845-
count: 1
8846-
path: libraries/classes/Controllers/Table/SearchController.php
8847-
8848-
-
8849-
message: "#^Parameter \\#2 \\$field of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:getForeignData\\(\\) expects string, mixed given\\.$#"
8850-
count: 1
8851-
path: libraries/classes/Controllers/Table/SearchController.php
8852-
88538828
-
88548829
message: "#^Parameter \\#2 \\$foreignField of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:foreignDropdown\\(\\) expects string, mixed given\\.$#"
88558830
count: 1
88568831
path: libraries/classes/Controllers/Table/SearchController.php
88578832

8858-
-
8859-
message: "#^Parameter \\#2 \\$null of method PhpMyAdmin\\\\Types\\:\\:getTypeOperatorsHtml\\(\\) expects bool, mixed given\\.$#"
8860-
count: 1
8861-
path: libraries/classes/Controllers/Table/SearchController.php
8862-
88638833
-
88648834
message: "#^Parameter \\#2 \\$signature of static method PhpMyAdmin\\\\Core\\:\\:checkSqlQuerySignature\\(\\) expects string, mixed given\\.$#"
88658835
count: 1
@@ -8890,11 +8860,6 @@ parameters:
88908860
count: 1
88918861
path: libraries/classes/Controllers/Table/SearchController.php
88928862

8893-
-
8894-
message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, mixed given\\.$#"
8895-
count: 1
8896-
path: libraries/classes/Controllers/Table/SearchController.php
8897-
88988863
-
88998864
message: "#^Parameter \\#4 \\$table of method PhpMyAdmin\\\\Sql\\:\\:executeQueryAndSendQueryResponse\\(\\) expects string\\|null, mixed given\\.$#"
89008865
count: 1
@@ -9032,7 +8997,7 @@ parameters:
90328997

90338998
-
90348999
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
9035-
count: 2
9000+
count: 1
90369001
path: libraries/classes/Controllers/Table/Structure/MoveColumnsController.php
90379002

90389003
-
@@ -9155,11 +9120,6 @@ parameters:
91559120
count: 1
91569121
path: libraries/classes/Controllers/Table/Structure/MoveColumnsController.php
91579122

9158-
-
9159-
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, mixed given\\.$#"
9160-
count: 1
9161-
path: libraries/classes/Controllers/Table/Structure/MoveColumnsController.php
9162-
91639123
-
91649124
message: "#^Parameter \\#4 \\$length of static method PhpMyAdmin\\\\Table\\:\\:generateAlter\\(\\) expects string, mixed given\\.$#"
91659125
count: 1
@@ -9982,12 +9942,12 @@ parameters:
99829942

99839943
-
99849944
message: "#^Cannot cast mixed to string\\.$#"
9985-
count: 2
9945+
count: 1
99869946
path: libraries/classes/Controllers/Table/ZoomSearchController.php
99879947

99889948
-
99899949
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
9990-
count: 3
9950+
count: 2
99919951
path: libraries/classes/Controllers/Table/ZoomSearchController.php
99929952

99939953
-
@@ -10025,11 +9985,6 @@ parameters:
100259985
count: 1
100269986
path: libraries/classes/Controllers/Table/ZoomSearchController.php
100279987

10028-
-
10029-
message: "#^Parameter \\#1 \\$columnSpecification of static method PhpMyAdmin\\\\Util\\:\\:extractColumnSpec\\(\\) expects string, mixed given\\.$#"
10030-
count: 1
10031-
path: libraries/classes/Controllers/Table/ZoomSearchController.php
10032-
100339988
-
100349989
message: "#^Parameter \\#1 \\$dataLabel of method PhpMyAdmin\\\\Controllers\\\\Table\\\\ZoomSearchController\\:\\:displaySelectionFormAction\\(\\) expects string, mixed given\\.$#"
100359990
count: 1
@@ -10081,12 +10036,7 @@ parameters:
1008110036
path: libraries/classes/Controllers/Table/ZoomSearchController.php
1008210037

1008310038
-
10084-
message: "#^Parameter \\#1 \\$string of function md5 expects string, mixed given\\.$#"
10085-
count: 2
10086-
path: libraries/classes/Controllers/Table/ZoomSearchController.php
10087-
10088-
-
10089-
message: "#^Parameter \\#1 \\$string of function strtoupper expects string, \\(array\\<int, string\\>\\|string\\|null\\) given\\.$#"
10039+
message: "#^Parameter \\#1 \\$string of function strtoupper expects string, string\\|null given\\.$#"
1009010040
count: 1
1009110041
path: libraries/classes/Controllers/Table/ZoomSearchController.php
1009210042

@@ -10096,12 +10046,12 @@ parameters:
1009610046
path: libraries/classes/Controllers/Table/ZoomSearchController.php
1009710047

1009810048
-
10099-
message: "#^Parameter \\#1 \\$type of method PhpMyAdmin\\\\Types\\:\\:getIntegerRange\\(\\) expects string, \\(array\\<int, string\\>\\|string\\|null\\) given\\.$#"
10049+
message: "#^Parameter \\#1 \\$type of method PhpMyAdmin\\\\Types\\:\\:getIntegerRange\\(\\) expects string, string\\|null given\\.$#"
1010010050
count: 1
1010110051
path: libraries/classes/Controllers/Table/ZoomSearchController.php
1010210052

1010310053
-
10104-
message: "#^Parameter \\#1 \\$type of method PhpMyAdmin\\\\Types\\:\\:getTypeOperatorsHtml\\(\\) expects string, \\(array\\<int, string\\>\\|string\\|null\\) given\\.$#"
10054+
message: "#^Parameter \\#1 \\$type of method PhpMyAdmin\\\\Types\\:\\:getTypeOperatorsHtml\\(\\) expects string, string\\|null given\\.$#"
1010510055
count: 1
1010610056
path: libraries/classes/Controllers/Table/ZoomSearchController.php
1010710057

@@ -10111,20 +10061,10 @@ parameters:
1011110061
path: libraries/classes/Controllers/Table/ZoomSearchController.php
1011210062

1011310063
-
10114-
message: "#^Parameter \\#2 \\$column of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:searchColumnInForeigners\\(\\) expects string, mixed given\\.$#"
10115-
count: 2
10116-
path: libraries/classes/Controllers/Table/ZoomSearchController.php
10117-
10118-
-
10119-
message: "#^Parameter \\#2 \\$columnIndex of method PhpMyAdmin\\\\Controllers\\\\Table\\\\ZoomSearchController\\:\\:getColumnProperties\\(\\) expects int, int\\|string\\|false given\\.$#"
10064+
message: "#^Parameter \\#2 \\$columnIndex of method PhpMyAdmin\\\\Controllers\\\\Table\\\\ZoomSearchController\\:\\:getColumnProperties\\(\\) expects int, int\\|false given\\.$#"
1012010065
count: 1
1012110066
path: libraries/classes/Controllers/Table/ZoomSearchController.php
1012210067

10123-
-
10124-
message: "#^Parameter \\#2 \\$field of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:getForeignData\\(\\) expects string, mixed given\\.$#"
10125-
count: 2
10126-
path: libraries/classes/Controllers/Table/ZoomSearchController.php
10127-
1012810068
-
1012910069
message: "#^Parameter \\#2 \\$foreignField of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:foreignDropdown\\(\\) expects string, mixed given\\.$#"
1013010070
count: 1
@@ -10135,11 +10075,6 @@ parameters:
1013510075
count: 1
1013610076
path: libraries/classes/Controllers/Table/ZoomSearchController.php
1013710077

10138-
-
10139-
message: "#^Parameter \\#2 \\$null of method PhpMyAdmin\\\\Types\\:\\:getTypeOperatorsHtml\\(\\) expects bool, mixed given\\.$#"
10140-
count: 1
10141-
path: libraries/classes/Controllers/Table/ZoomSearchController.php
10142-
1014310078
-
1014410079
message: "#^Parameter \\#2 \\$signature of static method PhpMyAdmin\\\\Core\\:\\:checkSqlQuerySignature\\(\\) expects string, mixed given\\.$#"
1014510080
count: 1
@@ -10170,11 +10105,6 @@ parameters:
1017010105
count: 1
1017110106
path: libraries/classes/Controllers/Table/ZoomSearchController.php
1017210107

10173-
-
10174-
message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, mixed given\\.$#"
10175-
count: 1
10176-
path: libraries/classes/Controllers/Table/ZoomSearchController.php
10177-
1017810108
-
1017910109
message: "#^Parameter \\#5 \\$max of method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:foreignDropdown\\(\\) expects int\\|null, mixed given\\.$#"
1018010110
count: 2

0 commit comments

Comments
 (0)