Skip to content

Commit 9d27d32

Browse files
committed
fix: remove php 8.4 deprecation notices
1 parent 18a8e4a commit 9d27d32

File tree

20 files changed

+22
-22
lines changed

20 files changed

+22
-22
lines changed

src/Contracts/Spec/ResourceDocumentComplianceChecker.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface ResourceDocumentComplianceChecker
2424
* @param ResourceId|string|null $id
2525
* @return $this
2626
*/
27-
public function mustSee(ResourceType|string $type, ResourceId|string $id = null): static;
27+
public function mustSee(ResourceType|string $type, ResourceId|string|null $id = null): static;
2828

2929
/**
3030
* Check whether the provided content passes compliance with the JSON:API spec.

src/Core/Auth/Container.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static function resolver(): callable
6464
public function __construct(
6565
private readonly ContainerResolver $container,
6666
private readonly SchemaContainer $schemas,
67-
callable $resolver = null
67+
?callable $resolver = null
6868
) {
6969
$this->resolver = $resolver ?? self::resolver();
7070
}

src/Core/Bus/Commands/Result.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Result implements ResultContract
2929
* @param Payload|null $payload
3030
* @return self
3131
*/
32-
public static function ok(Payload $payload = null): self
32+
public static function ok(?Payload $payload = null): self
3333
{
3434
return new self(true, $payload ?? new Payload(null, false));
3535
}

src/Core/Http/Actions/AttachRelationship/AttachRelationshipActionInput.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(
4848
ResourceType $type,
4949
ResourceId $id,
5050
string $fieldName,
51-
object $model = null,
51+
?object $model = null,
5252
) {
5353
parent::__construct($request, $type);
5454
$this->id = $id;

src/Core/Http/Actions/Destroy/DestroyActionInput.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(
4040
Request $request,
4141
ResourceType $type,
4242
ResourceId $id,
43-
object $model = null,
43+
?object $model = null,
4444
) {
4545
parent::__construct($request, $type);
4646
$this->id = $id;

src/Core/Http/Actions/DetachRelationship/DetachRelationshipActionInput.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(
4848
ResourceType $type,
4949
ResourceId $id,
5050
string $fieldName,
51-
object $model = null,
51+
?object $model = null,
5252
) {
5353
parent::__construct($request, $type);
5454
$this->id = $id;

src/Core/Http/Actions/FetchOne/FetchOneActionInput.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(
4040
Request $request,
4141
ResourceType $type,
4242
ResourceId $id,
43-
object $model = null,
43+
?object $model = null,
4444
) {
4545
parent::__construct($request, $type);
4646
$this->id = $id;

src/Core/Http/Actions/FetchRelated/FetchRelatedActionInput.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(
4242
ResourceType $type,
4343
ResourceId $id,
4444
string $fieldName,
45-
object $model = null,
45+
?object $model = null,
4646
) {
4747
parent::__construct($request, $type);
4848
$this->id = $id;

src/Core/Http/Actions/FetchRelationship/FetchRelationshipActionInput.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(
4242
ResourceType $type,
4343
ResourceId $id,
4444
string $fieldName,
45-
object $model = null,
45+
?object $model = null,
4646
) {
4747
parent::__construct($request, $type);
4848
$this->id = $id;

src/Core/Http/Actions/Update/UpdateActionInput.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(
4646
Request $request,
4747
ResourceType $type,
4848
ResourceId $id,
49-
object $model = null,
49+
?object $model = null,
5050
) {
5151
parent::__construct($request, $type);
5252
$this->id = $id;

src/Core/Http/Actions/UpdateRelationship/UpdateRelationshipActionInput.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(
4949
ResourceType $type,
5050
ResourceId $id,
5151
string $fieldName,
52-
object $model = null,
52+
?object $model = null,
5353
) {
5454
parent::__construct($request, $type);
5555
$this->id = $id;

src/Core/Http/Exceptions/HttpNotAcceptableException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class HttpNotAcceptableException extends HttpException
2727
*/
2828
public function __construct(
2929
string $message = '',
30-
Throwable $previous = null,
30+
?Throwable $previous = null,
3131
array $headers = [],
3232
int $code = 0
3333
) {

src/Core/Http/Exceptions/HttpUnsupportedMediaTypeException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class HttpUnsupportedMediaTypeException extends HttpException
2727
*/
2828
public function __construct(
2929
string $message = '',
30-
Throwable $previous = null,
30+
?Throwable $previous = null,
3131
array $headers = [],
3232
int $code = 0
3333
) {

src/Core/Responses/Concerns/HasHeaders.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ trait HasHeaders
2525
* @param string|null $value
2626
* @return $this
2727
*/
28-
public function withHeader(string $name, string $value = null): static
28+
public function withHeader(string $name, ?string $value = null): static
2929
{
3030
$this->headers[$name] = $value;
3131

src/Core/Schema/Schema.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function getIterator(): Traversable
125125
/**
126126
* @inheritDoc
127127
*/
128-
public function url($extra = [], bool $secure = null): string
128+
public function url($extra = [], ?bool $secure = null): string
129129
{
130130
$extra = Arr::wrap($extra);
131131

tests/Integration/Http/Actions/UpdateTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ private function willValidateOperation(object $model, ResourceObject $resource,
500500
* @param object|null $model
501501
* @return stdClass
502502
*/
503-
private function willStore(string $type, array $validated, object $model = null): object
503+
private function willStore(string $type, array $validated, ?object $model = null): object
504504
{
505505
$model = $model ?? new \stdClass();
506506

tests/Unit/Bus/Commands/Middleware/ValidateRelationshipCommandTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static function commandProvider(): array
9595
{
9696
return [
9797
'update' => [
98-
function (ResourceType $type, Request $request = null): UpdateRelationshipCommand {
98+
function (ResourceType $type, ?Request $request = null): UpdateRelationshipCommand {
9999
$operation = new UpdateToOne(
100100
new Ref(type: $type, id: new ResourceId('123'), relationship: 'author'),
101101
new ResourceIdentifier(new ResourceType('users'), new ResourceId('456')),
@@ -105,7 +105,7 @@ function (ResourceType $type, Request $request = null): UpdateRelationshipComman
105105
},
106106
],
107107
'attach' => [
108-
function (ResourceType $type, Request $request = null): AttachRelationshipCommand {
108+
function (ResourceType $type, ?Request $request = null): AttachRelationshipCommand {
109109
$operation = new UpdateToMany(
110110
OpCodeEnum::Add,
111111
new Ref(type: $type, id: new ResourceId('123'), relationship: 'tags'),
@@ -116,7 +116,7 @@ function (ResourceType $type, Request $request = null): AttachRelationshipComman
116116
},
117117
],
118118
'detach' => [
119-
function (ResourceType $type, Request $request = null): DetachRelationshipCommand {
119+
function (ResourceType $type, ?Request $request = null): DetachRelationshipCommand {
120120
$operation = new UpdateToMany(
121121
OpCodeEnum::Remove,
122122
new Ref(type: $type, id: new ResourceId('123'), relationship: 'tags'),

tests/Unit/Bus/Queries/FetchRelated/Middleware/AuthorizeFetchRelatedQueryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private function willAuthorize(
199199
?Request $request,
200200
object $model,
201201
string $fieldName,
202-
ErrorList $expected = null
202+
?ErrorList $expected = null
203203
): void
204204
{
205205
$this->authorizerFactory

tests/Unit/Bus/Queries/FetchRelationship/Middleware/AuthorizeFetchRelationshipQueryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private function willAuthorize(
199199
?Request $request,
200200
object $model,
201201
string $fieldName,
202-
ErrorList $expected = null
202+
?ErrorList $expected = null
203203
): void
204204
{
205205
$this->authorizerFactory

tests/Unit/Extensions/Atomic/Parsers/HrefParserTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function testItParsesHrefAndConvertsUriSegmentsToExpectedValues(ParsedHre
184184
* @param string|null $relationship
185185
* @return void
186186
*/
187-
private function withSchema(ParsedHref $expected, ResourceType $type = null, string $relationship = null): void
187+
private function withSchema(ParsedHref $expected, ?ResourceType $type = null, ?string $relationship = null): void
188188
{
189189
$type = $type ?? $expected->type;
190190

0 commit comments

Comments
 (0)