Skip to content

Commit 86f1f3c

Browse files
authored
Merge pull request #1 from FastyBird/feature/typing
Extending types
2 parents cc42b69 + 71c31a5 commit 86f1f3c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/Exceptions/JsonApiError.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use Exception as PHPException;
1919
use Neomerx\JsonApi as NeomerxJsonApi;
20+
use Stringable;
2021

2122
/**
2223
* Process single error
@@ -34,10 +35,10 @@ class JsonApiError extends PHPException implements Exception, JsonApi
3435
*/
3536
public function __construct(
3637
int $code,
37-
string $title,
38-
private readonly string|null $detail = null,
38+
string|Stringable $title,
39+
private readonly string|Stringable|null $detail = null,
3940
private readonly array|null $source = null,
40-
private readonly string|null $type = null,
41+
private readonly string|Stringable|null $type = null,
4142
)
4243
{
4344
parent::__construct($title, $code);

src/Exceptions/JsonApiMultipleError.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Exception as PHPException;
1919
use Fig\Http\Message\StatusCodeInterface;
2020
use Neomerx\JsonApi as NeomerxJsonApi;
21+
use Stringable;
2122

2223
/**
2324
* Process multiple error
@@ -46,10 +47,10 @@ public function __construct()
4647
*/
4748
public function addError(
4849
int $code,
49-
string $title,
50-
string|null $detail = null,
50+
string|Stringable $title,
51+
string|Stringable|null $detail = null,
5152
array|null $source = null,
52-
string|null $type = null,
53+
string|Stringable|null $type = null,
5354
): void
5455
{
5556
$this->errors[] = new NeomerxJsonApi\Schema\Error(

0 commit comments

Comments
 (0)