Skip to content

Commit 916c061

Browse files
authored
Fixed Psalm errors (#38)
* Added support of RR 2025 * fix composer.json * ignore Psalm override errors * fixed psalm errors * added Symfony polyfill * moved Symfony polyfill
1 parent fb627f2 commit 916c061

11 files changed

Lines changed: 32 additions & 2 deletions

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
"google/protobuf": "^3.7 || ^4.0",
4646
"spiral/roadrunner-worker": "^3.0",
4747
"spiral/goridge": "^4.0",
48-
"spiral/roadrunner": "^2024.3 || ^2025.1"
48+
"spiral/roadrunner": "^2024.3 || ^2025.1",
49+
"symfony/polyfill-php83": "*"
4950
},
5051
"require-dev": {
5152
"jetbrains/phpstorm-attributes": "^1.0",

src/Context.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function __construct(
1818
private array $values,
1919
) {}
2020

21+
#[\Override]
2122
public function withValue(string $key, mixed $value): ContextInterface
2223
{
2324
$ctx = clone $this;
@@ -26,16 +27,19 @@ public function withValue(string $key, mixed $value): ContextInterface
2627
return $ctx;
2728
}
2829

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

36+
#[\Override]
3437
public function getValues(): array
3538
{
3639
return $this->values;
3740
}
3841

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

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

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

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

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

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

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

80+
#[\Override]
7381
public function getIterator(): \Traversable
7482
{
7583
return new \ArrayIterator($this->values);
7684
}
7785

86+
#[\Override]
7887
public function count(): int
7988
{
8089
return \count($this->values);

src/Exception/GRPCException.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public static function create(
5353
/**
5454
* @return Message[]
5555
*/
56+
#[\Override]
5657
public function getDetails(): array
5758
{
5859
return $this->details;
@@ -61,11 +62,13 @@ public function getDetails(): array
6162
/**
6263
* @param Message[] $details
6364
*/
65+
#[\Override]
6466
public function setDetails(array $details): void
6567
{
6668
$this->details = $details;
6769
}
6870

71+
#[\Override]
6972
public function addDetails(Message $message): void
7073
{
7174
$this->details[] = $message;

src/Exception/GRPCExceptionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface GRPCExceptionInterface extends \Throwable
1818
* @return StatusCodeType
1919
* @psalm-mutation-free
2020
*/
21-
#[\ReturnTypeWillChange]
21+
#[\ReturnTypeWillChange, \Override]
2222
public function getCode();
2323

2424
/**

src/Exception/NotFoundException.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use Spiral\RoadRunner\GRPC\StatusCode;
88

9+
/**
10+
* @final
11+
*/
912
class NotFoundException extends InvokeException
1013
{
1114
protected const CODE = StatusCode::NOT_FOUND;

src/Exception/ServiceException.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use Spiral\RoadRunner\GRPC\StatusCode;
88

9+
/**
10+
* @final
11+
*/
912
class ServiceException extends GRPCException
1013
{
1114
/**

src/Exception/UnauthenticatedException.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use Spiral\RoadRunner\GRPC\StatusCode;
88

9+
/**
10+
* @final
11+
*/
912
class UnauthenticatedException extends InvokeException
1013
{
1114
protected const CODE = StatusCode::UNAUTHENTICATED;

src/Exception/UnimplementedException.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use Spiral\RoadRunner\GRPC\StatusCode;
88

9+
/**
10+
* @final
11+
*/
912
class UnimplementedException extends GRPCException
1013
{
1114
protected const CODE = StatusCode::UNIMPLEMENTED;

src/Invoker.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ final class Invoker implements InvokerInterface
1616
'Method %s input type must be an instance of %s, ' .
1717
'but the input is type of %s';
1818

19+
#[\Override]
1920
public function invoke(
2021
ServiceInterface $service,
2122
Method $method,

src/ResponseHeaders.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ public function get(string $key, ?string $default = null): ?string
4646
return $this->headers[$key] ?? $default;
4747
}
4848

49+
#[\Override]
4950
public function getIterator(): \Traversable
5051
{
5152
return new \ArrayIterator($this->headers);
5253
}
5354

55+
#[\Override]
5456
public function count(): int
5557
{
5658
return \count($this->headers);

0 commit comments

Comments
 (0)