Skip to content

Commit de73dc3

Browse files
authored
Bump dependencies; Add ext-pcntl suggestion (#173)
resolve some phpstan/pint issues
1 parent ec40129 commit de73dc3

File tree

13 files changed

+22
-16
lines changed

13 files changed

+22
-16
lines changed

benchmarks/Support/ConcurrentRunner.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected function saveOperations(string $method, int $operations, string $nonce
2929
}
3030

3131
/**
32-
* @return array<int, mixed>
32+
* @return array<int, int>
3333
*/
3434
protected function loadOperations(string $method, string $nonce): array
3535
{
@@ -39,6 +39,7 @@ protected function loadOperations(string $method, string $nonce): array
3939
$result[] = unserialize($iteration);
4040
}
4141

42+
/** @var array<int, int> $result */
4243
return $result;
4344
}
4445

@@ -132,7 +133,7 @@ protected function runConcurrentOnce(Benchmark $benchmark, Reporter $reporter, S
132133
$tot_ops,
133134
($end - $start) / 1e+6,
134135
$cmd2 - $cmd1,
135-
$max_mem, // @phpstan-ignore-line
136+
$max_mem,
136137
$rx2 - $rx1, $tx2 - $tx1
137138
);
138139
}

benchmarks/Support/Statistics.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static function median(array $values)
6767
$count = count($values);
6868
sort($values);
6969

70-
$mid = floor(($count - 1) / 2);
70+
$mid = (int) floor(($count - 1) / 2);
7171

7272
return ($values[$mid] + $values[$mid + 1 - $count % 2]) / 2;
7373
}

benchmarks/Support/Subject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function opsBase()
118118
return $iteration->opsPerSec();
119119
}, $this->iterations);
120120

121-
return min($ops);
121+
return empty($ops) ? 0 : min($ops);
122122
}
123123

124124
public function opsTotal(): int

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,20 @@
1313
"ext-relay": "*"
1414
},
1515
"require-dev": {
16-
"illuminate/redis": "^7|^8|^9|^10",
16+
"illuminate/redis": "^7|^8|^9|^10|^11|^12",
1717
"open-telemetry/api": "^1.0",
18-
"phpstan/phpstan": "^1.7",
19-
"predis/predis": "^1.1|^2.0",
18+
"phpstan/phpstan": "^2.0",
19+
"predis/predis": "^1.1|^2.0|^3.0",
2020
"psr/simple-cache": "^1|^2|^3",
21-
"symfony/console": "^5.0|^6.0"
21+
"symfony/console": "^5.0|^6.0|^7.0"
2222
},
2323
"provide": {
2424
"psr/simple-cache-implementation": "^1|^2|^3"
2525
},
2626
"suggest": {
2727
"ext-relay": "Required to use package.",
28-
"ext-redis": "Required to run benchmarks."
28+
"ext-redis": "Required to run benchmarks.",
29+
"ext-pcntl": "Required to run benchmarks with multiple workers."
2930
},
3031
"autoload": {
3132
"psr-4": {

phpstan.dist.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
parameters:
22

3-
level: max
3+
level: 9
44

55
paths:
66
- benchmarks/

pint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"spacing": "one"
66
},
77
"ordered_imports": false,
8+
"phpdoc_order": false,
89
"no_alternative_syntax": false,
910
"no_superfluous_phpdoc_tags": false,
1011
"no_extra_blank_lines": {

resources/relay-fpm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
$refresh = intval($_GET['refresh'] ?? 60);
3+
$refresh = intval($_GET['refresh'] ?? 60); // @phpstan-ignore-line
44

55
$info = \Relay\Relay::stats();
66
$license = \Relay\Relay::license();

src/Credis/RelayCredisAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ public function __call($name, $args)
8080
return $this;
8181
} else {
8282
$this->isMulti = true;
83-
$this->redisMulti = $this->relay->{$name}(...$args);
83+
$this->redisMulti = $this->relay->{$name}() ?: null; // @phpstan-ignore-line
8484

8585
return $this;
8686
}
8787
} elseif ($name == 'exec' || $name == 'discard') {
8888
$this->isMulti = false;
89-
$response = $this->redisMulti->{$name}();
89+
$response = $this->redisMulti ? $this->redisMulti->{$name}() : null;
9090
$this->redisMulti = null;
9191

9292
return $response;

src/Laravel/RelayClusterConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class RelayClusterConnection extends RelayConnection implements Connection
2525
*/
2626
public function flushdb()
2727
{
28-
/** @var string $arguments */
28+
/** @var string[] $arguments */
2929
$arguments = func_get_args();
3030

3131
$async = strtoupper((string) ($arguments[0] ?? null)) === 'ASYNC';

src/Laravel/RelayConnector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected function establishConnection($client, array $config)
148148
$parameters[] = $context;
149149
}
150150

151-
$client->{$persistent ? 'pconnect' : 'connect'}(...$parameters);
151+
$client->{$persistent ? 'pconnect' : 'connect'}(...$parameters); // @phpstan-ignore-line
152152
}
153153

154154
/**

0 commit comments

Comments
 (0)