Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"google/protobuf": "^3.7 || ^4.0",
"spiral/roadrunner-worker": "^3.0",
"spiral/goridge": "^4.0",
"spiral/roadrunner": "^2024.3"
"spiral/roadrunner": "^2024.3 || ^2025.1"
Comment thread
okorneliuk marked this conversation as resolved.
Outdated
},
"require-dev": {
"jetbrains/phpstorm-attributes": "^1.0",
Expand Down
9 changes: 9 additions & 0 deletions src/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function __construct(
private array $values,
) {}

#[\Override]
public function withValue(string $key, mixed $value): ContextInterface
{
$ctx = clone $this;
Expand All @@ -26,16 +27,19 @@ public function withValue(string $key, mixed $value): ContextInterface
return $ctx;
}

#[\Override]
public function getValue(string $key, mixed $default = null): mixed
{
return $this->values[$key] ?? $default;
}

#[\Override]
public function getValues(): array
{
return $this->values;
}

#[\Override]
public function offsetExists(mixed $offset): bool
{
\assert(\is_string($offset), 'Offset argument must be a type of string');
Expand All @@ -49,32 +53,37 @@ public function offsetExists(mixed $offset): bool
return isset($this->values[$offset]) || \array_key_exists($offset, $this->values);
}

#[\Override]
public function offsetGet(mixed $offset): mixed
{
\assert(\is_string($offset), 'Offset argument must be a type of string');

return $this->values[$offset] ?? null;
}

#[\Override]
public function offsetSet(mixed $offset, mixed $value): void
{
\assert(\is_string($offset), 'Offset argument must be a type of string');

$this->values[$offset] = $value;
}

#[\Override]
public function offsetUnset(mixed $offset): void
{
\assert(\is_string($offset), 'Offset argument must be a type of string');

unset($this->values[$offset]);
}

#[\Override]
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->values);
}

#[\Override]
public function count(): int
{
return \count($this->values);
Expand Down
3 changes: 3 additions & 0 deletions src/Exception/GRPCException.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public static function create(
/**
* @return Message[]
*/
#[\Override]
public function getDetails(): array
{
return $this->details;
Expand All @@ -61,11 +62,13 @@ public function getDetails(): array
/**
* @param Message[] $details
*/
#[\Override]
public function setDetails(array $details): void
{
$this->details = $details;
}

#[\Override]
public function addDetails(Message $message): void
{
$this->details[] = $message;
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/GRPCExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface GRPCExceptionInterface extends \Throwable
* @return StatusCodeType
* @psalm-mutation-free
*/
#[\ReturnTypeWillChange]
#[\ReturnTypeWillChange, \Override]
public function getCode();

/**
Expand Down
3 changes: 3 additions & 0 deletions src/Exception/NotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Spiral\RoadRunner\GRPC\StatusCode;

/**
* @final
*/
class NotFoundException extends InvokeException
{
protected const CODE = StatusCode::NOT_FOUND;
Expand Down
3 changes: 3 additions & 0 deletions src/Exception/ServiceException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Spiral\RoadRunner\GRPC\StatusCode;

/**
* @final
*/
class ServiceException extends GRPCException
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Exception/UnauthenticatedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Spiral\RoadRunner\GRPC\StatusCode;

/**
* @final
*/
class UnauthenticatedException extends InvokeException
{
protected const CODE = StatusCode::UNAUTHENTICATED;
Expand Down
3 changes: 3 additions & 0 deletions src/Exception/UnimplementedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Spiral\RoadRunner\GRPC\StatusCode;

/**
* @final
*/
class UnimplementedException extends GRPCException
{
protected const CODE = StatusCode::UNIMPLEMENTED;
Expand Down
1 change: 1 addition & 0 deletions src/Invoker.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ final class Invoker implements InvokerInterface
'Method %s input type must be an instance of %s, ' .
'but the input is type of %s';

#[\Override]
public function invoke(
ServiceInterface $service,
Method $method,
Expand Down
2 changes: 2 additions & 0 deletions src/ResponseHeaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ public function get(string $key, ?string $default = null): ?string
return $this->headers[$key] ?? $default;
}

#[\Override]
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->headers);
}

#[\Override]
public function count(): int
{
return \count($this->headers);
Expand Down
2 changes: 2 additions & 0 deletions src/ResponseTrailers.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ public function get(string $key, ?string $default = null): ?string
return $this->trailers[$key] ?? $default;
}

#[\Override]
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->trailers);
}

#[\Override]
public function count(): int
{
return \count($this->trailers);
Expand Down
Loading