Merge pull request #18464 from kamil-tekiela/Refactor-parsePath

More specific return type
This commit is contained in:
Maurício Meneghini Fauth 2023-05-29 23:20:36 -03:00 committed by GitHub
commit 8bb312514e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 7 deletions

View File

@ -40,6 +40,7 @@ use function _ngettext;
use function array_intersect_key;
use function array_key_exists;
use function array_keys;
use function array_map;
use function array_merge;
use function array_shift;
use function base64_decode;
@ -289,16 +290,11 @@ class NavigationTree
*
* @param string $string The path to parse
*
* @return mixed[]
* @return non-empty-list<string>
*/
private function parsePath(string $string): array
{
$path = explode('.', $string);
foreach ($path as $key => $value) {
$path[$key] = base64_decode($value);
}
return $path;
return array_map(base64_decode(...), explode('.', $string));
}
/**

View File

@ -4640,6 +4640,11 @@ parameters:
count: 1
path: libraries/classes/Navigation/NavigationTree.php
-
message: "#^Method PhpMyAdmin\\\\Navigation\\\\NavigationTree\\:\\:parsePath\\(\\) should return non\\-empty\\-array\\<int, string\\> but returns non\\-empty\\-array\\<int, string\\|false\\>\\.$#"
count: 1
path: libraries/classes/Navigation/NavigationTree.php
-
message: "#^Only numeric types are allowed in \\+, int\\|false given on the left side\\.$#"
count: 1

View File

@ -7657,6 +7657,12 @@
<code><![CDATA[$this->pos3Name]]></code>
<code><![CDATA[$this->pos3Name]]></code>
</InvalidPropertyAssignmentValue>
<InvalidReturnStatement>
<code><![CDATA[array_map(base64_decode(...), explode('.', $string))]]></code>
</InvalidReturnStatement>
<InvalidReturnType>
<code><![CDATA[non-empty-list<string>]]></code>
</InvalidReturnType>
<MixedArgument>
<code>$db</code>
<code>$item</code>