Skip to content

Commit 0f0e283

Browse files
committed
Fixes & PHP 8.4 support
1 parent fd728b9 commit 0f0e283

File tree

14 files changed

+35
-24
lines changed

14 files changed

+35
-24
lines changed

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
2222
with:
23-
php-version: 8.3
23+
php-version: 8.4
2424
tools: composer:v2
2525
coverage: none
2626

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
fail-fast: true
2828
matrix:
29-
php: [ '8.2', '8.3' ]
29+
php: [ '8.2', '8.3', '8.4' ]
3030
stability: [ prefer-stable ]
3131

3232
name: PHP ${{ matrix.php }} tests
@@ -69,7 +69,7 @@ jobs:
6969
strategy:
7070
fail-fast: true
7171
matrix:
72-
php: [ '8.2', '8.3' ]
72+
php: [ '8.2', '8.3', '8.4' ]
7373
stability: [ prefer-stable ]
7474

7575
name: PHP ${{ matrix.php }} tests (php clients)

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
],
2626
"require": {
2727
"php": ">=8.2",
28-
"twig/twig": "^3.14"
28+
"twig/twig": "^3.15"
2929
},
3030
"require-dev": {
3131
"clue/phar-composer": "^1.4",
@@ -60,6 +60,6 @@
6060
"phar:twig": "phar-composer build twig/twig",
6161
"phar:predis": "phar-composer build predis/predis",
6262
"phpstan": "phpstan --ansi",
63-
"test": "phpunit --colors=always"
63+
"test": "phpunit --colors=always --display-skipped"
6464
}
6565
}

index.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@
4545
$tpl = new Template();
4646
$admin = new Admin($tpl);
4747

48-
$nav = [];
49-
50-
foreach ($admin->dashboards as $d_key => $d_dashboard) {
51-
$nav[$d_key] = $d_dashboard->dashboardInfo();
52-
}
48+
$nav = array_map(static fn ($d_dashboard) => $d_dashboard->dashboardInfo(), $admin->dashboards);
5349

5450
$current = $admin->currentDashboard();
5551
$dashboard = $admin->getDashboard($current);

predis.phar

100644100755
-2.43 KB
Binary file not shown.

src/Dashboards/Memcached/PHPMem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function getKey(string $key): string|false {
184184
}
185185

186186
/**
187-
* Get key meta data.
187+
* Get key meta-data.
188188
*
189189
* @return array<string, string|int>
190190
* @throws MemcachedException

src/Dashboards/Redis/Compatibility/Predis.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function streamAdd(string $key, string $id, array $messages): string {
121121
return $this->xadd($key, $messages, $id);
122122
}
123123

124-
public function rawCommand(string $command, mixed ...$arguments): mixed {
124+
public function rawcommand(string $command, mixed ...$arguments): mixed {
125125
return $this->executeRaw(func_get_args());
126126
}
127127

src/Dashboards/Redis/Compatibility/Redis.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function getKeyType(string $key): string {
7979

8080
if ($type === self::REDIS_NOT_FOUND) {
8181
$this->setOption(self::OPT_REPLY_LITERAL, true);
82-
$type = $this->rawCommand('TYPE', $key);
82+
$type = $this->rawcommand('TYPE', $key);
8383
}
8484

8585
return $this->getType($type);
@@ -129,7 +129,7 @@ public function scanKeys(string $pattern, int $count): array {
129129
* @throws RedisException
130130
*/
131131
public function listRem(string $key, string $value, int $count): int {
132-
return $this->lRem($key, $value, $count);
132+
return $this->lrem($key, $value, $count);
133133
}
134134

135135
/**
@@ -138,7 +138,7 @@ public function listRem(string $key, string $value, int $count): int {
138138
* @throws RedisException
139139
*/
140140
public function streamAdd(string $key, string $id, array $messages): string {
141-
return $this->xAdd($key, $id, $messages);
141+
return $this->xadd($key, $id, $messages);
142142
}
143143

144144
/**

src/Dashboards/Redis/RedisTrait.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ private function panels(): string {
4444
$max_memory = (int) $info['memory']['maxmemory'];
4545
$memory_usage = $max_memory > 0 ? round(($used_memory / $max_memory) * 100, 2) : 0;
4646

47+
if ($max_memory > 0) { // 0 = unlimited
48+
$used_memory_formatted = ['Used', Format::bytes($used_memory).' ('.$memory_usage.'%)', $memory_usage];
49+
} else {
50+
$used_memory_formatted = ['Used', Format::bytes($used_memory)];
51+
}
52+
4753
$panels = [
4854
[
4955
'title' => $title ?? null,
@@ -60,9 +66,9 @@ private function panels(): string {
6066
[
6167
'title' => 'Memory',
6268
'data' => [
63-
'Total' => Format::bytes($max_memory, 0),
64-
['Used', Format::bytes($used_memory).' ('.$memory_usage.'%)', $memory_usage],
65-
'Free' => Format::bytes($max_memory - $used_memory),
69+
'Total' => $max_memory > 0 ? Format::bytes($max_memory, 0) : '&infin;',
70+
$used_memory_formatted,
71+
'Free' => $max_memory > 0 ? Format::bytes($max_memory - $used_memory) : '&infin;',
6672
'Fragmentation ratio' => $info['memory']['mem_fragmentation_ratio'],
6773
'Used peak percentage' => $info['memory']['used_memory_peak_perc'],
6874
],

src/Helpers.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,7 @@ public static function getServerTitle(array $server): string {
201201
* @param array<int, array<string, int|string>> $servers
202202
*/
203203
public static function serverSelector(Template $template, array $servers, int $selected): string {
204-
$options = [];
205-
206-
foreach ($servers as $id => $server) {
207-
$options[$id] = self::getServerTitle($server);
208-
}
204+
$options = array_map(static fn ($server) => self::getServerTitle($server), $servers);
209205

210206
return $template->render('components/select', [
211207
'id' => 'server_select',

0 commit comments

Comments
 (0)