Merge pull request #18621 from kamil-tekiela/fix-doctype-on-arrays
Fix array property declarations
This commit is contained in:
commit
90db3a1359
@ -39,23 +39,23 @@ class Form
|
||||
/**
|
||||
* Form fields (paths), filled by {@link readFormPaths()}, indexed by field name
|
||||
*
|
||||
* @var mixed[]
|
||||
* @var string[]
|
||||
*/
|
||||
public array $fields;
|
||||
public array $fields = [];
|
||||
|
||||
/**
|
||||
* Stores default values for some fields (eg. pmadb tables)
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
public array $default;
|
||||
public array $default = [];
|
||||
|
||||
/**
|
||||
* Caches field types, indexed by field names
|
||||
*
|
||||
* @var mixed[]
|
||||
* @var string[]
|
||||
*/
|
||||
private array $fieldsTypes;
|
||||
private array $fieldsTypes = [];
|
||||
|
||||
/**
|
||||
* A counter for the number of groups
|
||||
@ -214,6 +214,7 @@ class Form
|
||||
|
||||
// $this->fields is an array of the form: [0..n] => 'field path'
|
||||
// change numeric indexes to contain field names (last part of the path)
|
||||
/** @var string[] $paths */
|
||||
$paths = $this->fields;
|
||||
$this->fields = [];
|
||||
foreach ($paths as $path) {
|
||||
@ -244,7 +245,7 @@ class Form
|
||||
$type = gettype($this->configFile->getDefault($path));
|
||||
}
|
||||
|
||||
$this->fieldsTypes[$name] = $type;
|
||||
$this->fieldsTypes[$name] = (string) $type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ class RecentFavoriteTable
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
private array $tables;
|
||||
private array $tables = [];
|
||||
|
||||
/**
|
||||
* RecentFavoriteTable instances.
|
||||
|
||||
@ -706,22 +706,7 @@ parameters:
|
||||
path: libraries/classes/Config/ConfigFile.php
|
||||
|
||||
-
|
||||
message: "#^Class PhpMyAdmin\\\\Config\\\\Form has an uninitialized property \\$default\\. Give it default value or assign it in the constructor\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Config/Form.php
|
||||
|
||||
-
|
||||
message: "#^Class PhpMyAdmin\\\\Config\\\\Form has an uninitialized property \\$fieldsTypes\\. Give it default value or assign it in the constructor\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Config/Form.php
|
||||
|
||||
-
|
||||
message: "#^Empty array passed to foreach\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Config/Form.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Config\\\\Form\\:\\:getOptionType\\(\\) should return string\\|null but returns mixed\\.$#"
|
||||
message: "#^Cannot cast mixed to string\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Config/Form.php
|
||||
|
||||
@ -730,21 +715,11 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Config/Form.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$canonicalPath of method PhpMyAdmin\\\\Config\\\\ConfigFile\\:\\:getDefault\\(\\) expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Config/Form.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$keys of function array_combine expects array\\<int\\|string\\>, array\\<int\\<0, max\\>, mixed\\> given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Config/Form.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$path of method PhpMyAdmin\\\\Config\\\\ConfigFile\\:\\:getDbEntry\\(\\) expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Config/Form.php
|
||||
|
||||
-
|
||||
message: "#^Unreachable statement \\- code above always terminates\\.$#"
|
||||
count: 2
|
||||
@ -845,11 +820,6 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Config/FormDisplay.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$optionPath of method PhpMyAdmin\\\\Config\\\\Form\\:\\:getOptionValueList\\(\\) expects string, mixed given\\.$#"
|
||||
count: 2
|
||||
path: libraries/classes/Config/FormDisplay.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$path of method PhpMyAdmin\\\\Config\\\\ConfigFile\\:\\:getValue\\(\\) expects string, int\\|string\\|false given\\.$#"
|
||||
count: 1
|
||||
@ -867,7 +837,7 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$path of static method PhpMyAdmin\\\\Config\\\\Descriptions\\:\\:get\\(\\) expects string, mixed given\\.$#"
|
||||
count: 2
|
||||
count: 1
|
||||
path: libraries/classes/Config/FormDisplay.php
|
||||
|
||||
-
|
||||
@ -915,26 +885,11 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Config/FormDisplay.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$canonicalPath of method PhpMyAdmin\\\\Config\\\\ConfigFile\\:\\:set\\(\\) expects string\\|null, mixed given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Config/FormDisplay.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, int\\|string\\|false given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Config/FormDisplay.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, mixed given\\.$#"
|
||||
count: 2
|
||||
path: libraries/classes/Config/FormDisplay.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$systemPath of method PhpMyAdmin\\\\Config\\\\FormDisplay\\:\\:displayFieldInput\\(\\) expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Config/FormDisplay.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#4 \\$workPath of method PhpMyAdmin\\\\Config\\\\FormDisplay\\:\\:displayFieldInput\\(\\) expects string, int\\|string\\|false given\\.$#"
|
||||
count: 1
|
||||
|
||||
@ -370,39 +370,22 @@
|
||||
<code>$value</code>
|
||||
<code>$value</code>
|
||||
</MissingClosureParamType>
|
||||
<MixedArgument>
|
||||
<code>$path</code>
|
||||
<code>$path</code>
|
||||
<code>$path</code>
|
||||
</MixedArgument>
|
||||
<MixedArgumentTypeCoercion>
|
||||
<code>$keys</code>
|
||||
</MixedArgumentTypeCoercion>
|
||||
<MixedAssignment>
|
||||
<code>$keys[]</code>
|
||||
<code>$path</code>
|
||||
<code>$path</code>
|
||||
<code>$type</code>
|
||||
<code>$v</code>
|
||||
<code>$value</code>
|
||||
</MixedAssignment>
|
||||
<MixedInferredReturnType>
|
||||
<code>string|null</code>
|
||||
</MixedInferredReturnType>
|
||||
<MixedOperand>
|
||||
<code>$key</code>
|
||||
<code>$prefix</code>
|
||||
<code>$prefix</code>
|
||||
<code>$prefix</code>
|
||||
</MixedOperand>
|
||||
<MixedReturnStatement>
|
||||
<code><![CDATA[$this->fieldsTypes[$key] ?? null]]></code>
|
||||
<code><![CDATA[$this->fieldsTypes[$key] ?? null]]></code>
|
||||
</MixedReturnStatement>
|
||||
<PropertyNotSetInConstructor>
|
||||
<code>$default</code>
|
||||
<code>$fields</code>
|
||||
<code>$fieldsTypes</code>
|
||||
<code>$name</code>
|
||||
</PropertyNotSetInConstructor>
|
||||
<UnevaluatedCode>
|
||||
@ -414,21 +397,14 @@
|
||||
<MixedArgument>
|
||||
<code>$canonicalPath</code>
|
||||
<code>$errorList</code>
|
||||
<code><![CDATA[$form->fields[$field]]]></code>
|
||||
<code>$ip</code>
|
||||
<code>$key</code>
|
||||
<code>$path</code>
|
||||
<code>$path</code>
|
||||
<code>$path</code>
|
||||
<code>$systemPath</code>
|
||||
<code>$systemPath</code>
|
||||
<code><![CDATA[$this->systemPaths[$systemPath]]]></code>
|
||||
<code>$translatedPath</code>
|
||||
<code>$userPrefsDisallow ?? []</code>
|
||||
<code>$val</code>
|
||||
<code>$validators[$path]</code>
|
||||
<code>$value</code>
|
||||
<code>$workPath</code>
|
||||
</MixedArgument>
|
||||
<MixedArgumentTypeCoercion>
|
||||
<code>$field</code>
|
||||
@ -451,20 +427,7 @@
|
||||
<code>$_POST[$key]</code>
|
||||
<code>$_POST[$key]</code>
|
||||
<code>$_POST[$key]</code>
|
||||
<code><![CDATA[$this->systemPaths[$workPath]]]></code>
|
||||
<code><![CDATA[$this->translatedPaths[$workPath]]]></code>
|
||||
<code><![CDATA[$this->userprefsDisallow[$path]]]></code>
|
||||
<code><![CDATA[$this->userprefsDisallow[$systemPath]]]></code>
|
||||
<code><![CDATA[$this->userprefsDisallow[$systemPath]]]></code>
|
||||
<code><![CDATA[$this->userprefsKeys[$path]]]></code>
|
||||
<code><![CDATA[$this->userprefsKeys[$systemPath]]]></code>
|
||||
<code>$values[$path]</code>
|
||||
<code>$values[$path]</code>
|
||||
<code>$values[$systemPath]</code>
|
||||
</MixedArrayOffset>
|
||||
<MixedArrayTypeCoercion>
|
||||
<code>$values[$path]</code>
|
||||
</MixedArrayTypeCoercion>
|
||||
<MixedAssignment>
|
||||
<code>$canonicalPath</code>
|
||||
<code>$errorList</code>
|
||||
@ -473,14 +436,7 @@
|
||||
<code>$isSetupScript</code>
|
||||
<code>$key</code>
|
||||
<code><![CDATA[$opts['errors']]]></code>
|
||||
<code>$path</code>
|
||||
<code>$path</code>
|
||||
<code>$path</code>
|
||||
<code>$path</code>
|
||||
<code>$paths[]</code>
|
||||
<code><![CDATA[$proxies['-' . $i]]]></code>
|
||||
<code>$systemPath</code>
|
||||
<code>$toSave[$workPath]</code>
|
||||
<code>$translatedPath</code>
|
||||
<code>$userPrefsDisallow</code>
|
||||
<code>$v</code>
|
||||
@ -492,7 +448,6 @@
|
||||
<code>$valueDefault</code>
|
||||
<code>$valueDefaultJs</code>
|
||||
<code>$values[$path]</code>
|
||||
<code>$workPath</code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand>
|
||||
<code>$ip</code>
|
||||
|
||||
@ -124,8 +124,6 @@ class FormTest extends AbstractTestCase
|
||||
|
||||
$this->assertEquals('preffoo/foo/bar/test', $result[0]);
|
||||
|
||||
$this->assertIsString($result[1]);
|
||||
|
||||
// needs regexp because the counter is static
|
||||
$this->assertMatchesRegularExpression('/^preffoo\/foo\/bar\/\:group\:end\:\d+$/', $result[1]);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user