Skip to content

Commit bcb3269

Browse files
committed
Fixed phpstan errors
1 parent 8f938c9 commit bcb3269

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

src/Extractor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function withoutAuthentication(
3232
string $host,
3333
string $vhost,
3434
string $topic,
35-
?int $port = null,
35+
int $port = null,
3636
): self {
3737
$connection = new Client([
3838
'host' => $host,
@@ -52,7 +52,7 @@ public static function withAuthentication(
5252
string $topic,
5353
?string $user,
5454
?string $password,
55-
?int $port = null,
55+
int $port = null,
5656
): self {
5757
$connection = new Client([
5858
'host' => $host,

src/Loader.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Bunny\Channel;
88
use Bunny\Client;
99
use Kiboko\Component\Bucket\AcceptanceResultBucket;
10+
use Kiboko\Component\Bucket\EmptyResultBucket;
1011
use Kiboko\Contract\Pipeline\LoaderInterface;
1112

1213
final readonly class Loader implements LoaderInterface
@@ -33,8 +34,8 @@ public static function withoutAuthentication(
3334
string $host,
3435
string $vhost,
3536
string $topic,
36-
?string $exchange = null,
37-
?int $port = null,
37+
string $exchange = null,
38+
int $port = null,
3839
): self {
3940
$connection = new Client([
4041
'host' => $host,
@@ -54,8 +55,8 @@ public static function withAuthentication(
5455
string $topic,
5556
?string $user,
5657
?string $password,
57-
?string $exchange = null,
58-
?int $port = null,
58+
string $exchange = null,
59+
int $port = null,
5960
): self {
6061
$connection = new Client([
6162
'host' => $host,
@@ -71,9 +72,9 @@ public static function withAuthentication(
7172

7273
public function load(): \Generator
7374
{
74-
$line = yield;
75+
$line = new EmptyResultBucket();
7576

76-
while (true) {
77+
while ($line) {
7778
$this->channel->publish(
7879
json_encode($line, \JSON_THROW_ON_ERROR),
7980
[

src/Rejection.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public static function withoutAuthentication(
3434
string $host,
3535
string $vhost,
3636
string $topic,
37-
?string $exchange = null,
38-
?int $port = null,
37+
string $exchange = null,
38+
int $port = null,
3939
): self {
4040
$connection = new Client([
4141
'host' => $host,
@@ -56,8 +56,8 @@ public static function withAuthentication(
5656
string $topic,
5757
?string $user,
5858
?string $password,
59-
?string $exchange = null,
60-
?int $port = null,
59+
string $exchange = null,
60+
int $port = null,
6161
): self {
6262
$connection = new Client([
6363
'host' => $host,
@@ -71,7 +71,7 @@ public static function withAuthentication(
7171
return new self($connection, stepUuid: $stepUuid, topic: $topic, exchange: $exchange);
7272
}
7373

74-
public function reject(StepCodeInterface $step, object|array $rejection, ?\Throwable $exception = null): void
74+
public function reject(StepCodeInterface $step, array|object $rejection, \Throwable $exception = null): void
7575
{
7676
$this->channel->publish(
7777
json_encode([
@@ -87,7 +87,7 @@ public function reject(StepCodeInterface $step, object|array $rejection, ?\Throw
8787
);
8888
}
8989

90-
public function rejectWithReason(StepCodeInterface $step, object|array $rejection, string $reason, ?\Throwable $exception = null): void
90+
public function rejectWithReason(StepCodeInterface $step, array|object $rejection, string $reason, \Throwable $exception = null): void
9191
{
9292
$this->channel->publish(
9393
json_encode([

src/State.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Kiboko\Component\Flow\RabbitMQ;
66

7-
use Kiboko\Contract\Pipeline\StepCodeInterface;
87
use Kiboko\Contract\Pipeline\StepStateInterface;
98

109
final class State implements StepStateInterface
@@ -17,8 +16,7 @@ public function __construct(
1716
private readonly StateManager $manager,
1817
private readonly string $stepCode,
1918
private readonly string $stepLabel,
20-
) {
21-
}
19+
) {}
2220

2321
public function accept(int $count = 1): void
2422
{

src/StateManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private function sendUpdate(): void
7373
$this->channel->publish(
7474
json_encode([
7575
'messageNumber' => ++$this->messageCount,
76-
'id' => \uuid_create(\UUID_TYPE_RANDOM),
76+
'id' => uuid_create(UUID_TYPE_RANDOM),
7777
'date' => ['date' => $date->format('c'), 'tz' => $date->getTimezone()->getName()],
7878
'stepsUpdates' => array_map(fn (State $step) => $step->toArray(), $this->steps),
7979
], \JSON_THROW_ON_ERROR),

0 commit comments

Comments
 (0)