Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MissingOverrideAttribute errorLevel="suppress" />
<ClassMustBeFinal errorLevel="suppress" />
</issueHandlers>
<forbiddenFunctions>
Expand Down
3 changes: 3 additions & 0 deletions src/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,19 @@
return new self($env);
}

#[\Override]
public function getMode(): string
{
return $this->get('RR_MODE');
}

#[\Override]
public function getRelayAddress(): string
{
return $this->get('RR_RELAY', 'pipes');
}

#[\Override]
public function getRPCAddress(): string
{
return $this->get('RR_RPC', 'tcp://127.0.0.1:6001');
Expand All @@ -62,7 +65,7 @@
*/
private function get(string $name, string $default = ''): string
{
if (isset($this->env[$name]) || \array_key_exists($name, $this->env)) {

Check warning on line 68 in src/Environment.php

View workflow job for this annotation

GitHub Actions / mutation

Escaped Mutant for Mutator "LogicalOr": @@ @@ */ private function get(string $name, string $default = ''): string { - if (isset($this->env[$name]) || \array_key_exists($name, $this->env)) { + if (isset($this->env[$name]) && \array_key_exists($name, $this->env)) { /** @psalm-suppress RedundantCastGivenDocblockType */ return (string) $this->env[$name]; }
/** @psalm-suppress RedundantCastGivenDocblockType */
return (string) $this->env[$name];
}
Expand Down
1 change: 1 addition & 0 deletions src/Informer/Workers.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function getWorkers(): array
return $this->workers;
}

#[\Override]
public function count(): int
{
return \count($this->workers);
Expand Down
4 changes: 1 addition & 3 deletions src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ class Logger implements LoggerInterface
{
use LoggerTrait;

/**
* @psalm-suppress RedundantConditionGivenDocblockType
*/
#[\Override]
public function log(mixed $level, string|\Stringable $message, array $context = []): void
{
\assert(\is_scalar($level), 'Invalid log level type');
Expand Down
7 changes: 7 additions & 0 deletions src/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function getLogger(): LoggerInterface
return $this->logger;
}

#[\Override]
public function waitPayload(): ?Payload
{
while (true) {
Expand Down Expand Up @@ -118,6 +119,7 @@ public function waitPayload(): ?Payload
}
}

#[\Override]
public function withStreamMode(): static
{
$clone = clone $this;
Expand All @@ -133,29 +135,34 @@ public function withStreamMode(): static
* Can be {@see Frame::CODEC_PROTO} for Protocol Buffers or {@see Frame::CODEC_JSON} for JSON.
* This parameter will be removed in v4.0 and {@see Frame::CODEC_PROTO} will be used by default.
*/
#[\Override]
public function respond(Payload $payload, ?int $codec = null): void
{
$this->streamMode and ++$this->framesSent;
$this->send($payload->body, $payload->header, $payload->eos, $codec);
}

#[\Override]
public function error(string $error): void
{
$frame = new Frame($error, [], Frame::ERROR);

$this->sendFrame($frame);
}

#[\Override]
public function stop(): void
{
$this->send('', $this->encode(['stop' => true]));
}

#[\Override]
public function hasPayload(?string $class = null): bool
{
return $this->findPayload($class) !== null;
}

#[\Override]
public function getPayload(?string $class = null): ?Payload
{
$pos = $this->findPayload($class);
Expand Down
3 changes: 3 additions & 0 deletions tests/Unit/Stub/TestRelay.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function getReceivedBody(): string
=> \substr($frame->payload, $frame->options[0] ?? 0), $this->received));
}

#[\Override]
public function waitFrame(): Frame
{
if ($this->frames === []) {
Expand All @@ -63,11 +64,13 @@ public function waitFrame(): Frame
return \array_shift($this->frames);
}

#[\Override]
public function send(Frame $frame): void
{
$this->received[] = $frame;
}

#[\Override]
public function hasFrame(): bool
{
return $this->frames !== [];
Expand Down
Loading