Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RobiNN1 committed Feb 15, 2025
1 parent 4f065e8 commit dbe13c3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/Dashboards/APCu/APCuTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ private function keysTreeView(array $keys): array {
'expanded' => false,
];
}

$current = &$current[$part]['children'];
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Dashboards/Memcached/MemcachedTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ private function keysTreeView(array $keys): array {
'expanded' => false,
];
}

$current = &$current[$part]['children'];
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/Dashboards/OPCache/OPCacheTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ private function getCachedScripts(): array {
}
}

$cached_scripts = Helpers::sortKeys($this->template, $cached_scripts);

return $cached_scripts;
return Helpers::sortKeys($this->template, $cached_scripts);
}

private function mainDashboard(): string {
Expand Down
4 changes: 1 addition & 3 deletions src/Dashboards/Realpath/RealpathTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ private function getAllKeys(): array {
}
}

$keys = Helpers::sortKeys($this->template, $keys);

return $keys;
return Helpers::sortKeys($this->template, $keys);
}
}
1 change: 1 addition & 0 deletions src/Dashboards/Redis/RedisTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ private function keysTreeView(array $keys): array {
'expanded' => false,
];
}

$current = &$current[$part]['children'];
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function keysProvider(): array {
* @return array<int|string, mixed>
*/
public function sortKeys(array $keys): array {
usort($keys, static fn ($a, $b) => strcmp($a['key'], $b['key']));
usort($keys, static fn ($a, $b): int => strcmp((string) $a['key'], (string) $b['key']));

return $keys;
}
Expand All @@ -68,8 +68,8 @@ public function sortKeys(array $keys): array {
public function sortTreeKeys(array $tree): array {
foreach ($tree as &$item) {
if (isset($item['children'])) {
usort($item['children'], static fn ($a, $b) => strcmp($a['key'], $b['key']));
$item['children'] = self::sortTreeKeys($item['children']);
usort($item['children'], static fn ($a, $b): int => strcmp((string) $a['key'], (string) $b['key']));
$item['children'] = $this->sortTreeKeys($item['children']);
}
}

Expand All @@ -91,7 +91,7 @@ public function normalizeInfoFields(array $data, array $fields): array {
}

if (isset($item['children']) && is_array($item['children'])) {
$item['children'] = array_map(static function (array $child) use ($fields) {
$item['children'] = array_map(static function (array $child) use ($fields): array {
foreach ($fields as $field) {
if (isset($child['info'][$field])) {
$child['info'][$field] = 0;
Expand Down

0 comments on commit dbe13c3

Please sign in to comment.