Skip to content

Commit 375b624

Browse files
committed
fix: remove deprecation notices in php 8.4
1 parent 96bea21 commit 375b624

File tree

16 files changed

+34
-29
lines changed

16 files changed

+34
-29
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
php: [8.2, 8.3]
17+
php: [8.2, 8.3, 8.4]
1818
laravel: [11]
1919

2020
steps:

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. This projec
55

66
## Unreleased
77

8+
### Fixed
9+
10+
- Removed deprecation notices in PHP 8.4.
11+
812
## [4.2.0] - 2024-08-21
913

1014
### Added

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
failOnWarning="true"
1414
failOnDeprecation="true"
1515
failOnNotice="true"
16+
displayDetailsOnTestsThatTriggerDeprecations="true"
1617
>
1718
<coverage/>
1819
<testsuites>

src/Contracts/Schema/Schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function uriType(): string;
7272
* @param bool|null $secure
7373
* @return string
7474
*/
75-
public function url($extra = [], bool $secure = null): string;
75+
public function url($extra = [], ?bool $secure = null): string;
7676

7777
/**
7878
* Do resources of this type have a `self` link?

src/Contracts/Server/Server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ public function authorizable(): bool;
7474
* @param bool|null $secure
7575
* @return string
7676
*/
77-
public function url($extra = [], bool $secure = null): string;
77+
public function url($extra = [], ?bool $secure = null): string;
7878
}

src/Core/Document/JsonApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class JsonApi implements Serializable
3434
* @param string|null $version
3535
* @return JsonApi
3636
*/
37-
public static function make(string $version = null): self
37+
public static function make(?string $version = null): self
3838
{
3939
return new self($version);
4040
}
@@ -113,7 +113,7 @@ public static function nullable($value): ?self
113113
*
114114
* @param string|null $version
115115
*/
116-
public function __construct(string $version = null)
116+
public function __construct(?string $version = null)
117117
{
118118
$this->version = $version ?: null;
119119
}

src/Core/Document/LinkHref.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static function cast($value): self
5656
* @param string $uri
5757
* @param iterable|null $query
5858
*/
59-
public function __construct(string $uri, iterable $query = null)
59+
public function __construct(string $uri, ?iterable $query = null)
6060
{
6161
if (empty($uri)) {
6262
throw new UnexpectedValueException('Expecting a non-empty string URI.');

src/Core/Exceptions/JsonApiException.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class JsonApiException extends Exception implements HttpExceptionInterface, Resp
3838
* @param Throwable|null $previous
3939
* @return static
4040
*/
41-
public static function make($errors, Throwable $previous = null): self
41+
public static function make($errors, ?Throwable $previous = null): self
4242
{
4343
return new self($errors, $previous);
4444
}
@@ -50,7 +50,7 @@ public static function make($errors, Throwable $previous = null): self
5050
* @param Throwable|null $previous
5151
* @return static
5252
*/
53-
public static function error($error, Throwable $previous = null): self
53+
public static function error($error, ?Throwable $previous = null): self
5454
{
5555
return new self(Error::cast($error), $previous);
5656
}
@@ -62,7 +62,7 @@ public static function error($error, Throwable $previous = null): self
6262
* @param Throwable|null $previous
6363
* @param array $headers
6464
*/
65-
public function __construct($errors, Throwable $previous = null, array $headers = [])
65+
public function __construct($errors, ?Throwable $previous = null, array $headers = [])
6666
{
6767
parent::__construct('JSON:API error', 0, $previous);
6868
$this->errors = ErrorList::cast($errors);

src/Core/Json/Hash.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static function cast($value): self
5555
*
5656
* @param array|null $value
5757
*/
58-
public function __construct(array $value = null)
58+
public function __construct(?array $value = null)
5959
{
6060
$this->value = $value ?: [];
6161
}

src/Core/Query/Custom/ExtendedQueryParameters.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ExtendedQueryParameters extends QueryParameters
3434
* @param string|null $name
3535
* @return string
3636
*/
37-
public static function withCount(string $name = null): string
37+
public static function withCount(?string $name = null): string
3838
{
3939
if (empty($name)) {
4040
return self::$withCount;
@@ -59,12 +59,12 @@ public static function withCount(string $name = null): string
5959
* @param array|null $unrecognised
6060
*/
6161
public function __construct(
62-
IncludePaths $includePaths = null,
63-
FieldSets $fieldSets = null,
64-
SortFields $sortFields = null,
65-
array $page = null,
66-
FilterParameters $filters = null,
67-
array $unrecognised = null
62+
?IncludePaths $includePaths = null,
63+
?FieldSets $fieldSets = null,
64+
?SortFields $sortFields = null,
65+
?array $page = null,
66+
?FilterParameters $filters = null,
67+
?array $unrecognised = null
6868
) {
6969
parent::__construct(
7070
$includePaths,

src/Core/Query/QueryParameters.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ public static function nullable($value): ?self
158158
* @param array|null $unrecognised
159159
*/
160160
public function __construct(
161-
IncludePaths $includePaths = null,
162-
FieldSets $fieldSets = null,
163-
SortFields $sortFields = null,
164-
array $page = null,
165-
FilterParameters $filters = null,
166-
array $unrecognised = null
161+
?IncludePaths $includePaths = null,
162+
?FieldSets $fieldSets = null,
163+
?SortFields $sortFields = null,
164+
?array $page = null,
165+
?FilterParameters $filters = null,
166+
?array $unrecognised = null
167167
) {
168168
$this->includePaths = $includePaths;
169169
$this->fieldSets = $fieldSets;

src/Core/Resources/JsonApiResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ protected function identifierMeta(): array
309309
* @param string|null $keyName
310310
* @return Relation
311311
*/
312-
protected function relation(string $fieldName, string $keyName = null): Relation
312+
protected function relation(string $fieldName, ?string $keyName = null): Relation
313313
{
314314
$field = $this->schema->isRelationship($fieldName) ? $this->schema->relationship($fieldName) : null;
315315

src/Core/Resources/Relation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public function __construct(
9191
object $resource,
9292
?string $baseUri,
9393
string $fieldName,
94-
string $keyName = null,
95-
string $uriName = null
94+
?string $keyName = null,
95+
?string $uriName = null
9696
) {
9797
$this->resource = $resource;
9898
$this->baseUri = $baseUri;

src/Core/Responses/Concerns/IsResponsable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function withEncodeOptions(int $options): self
143143
* @param string|null $value
144144
* @return $this
145145
*/
146-
public function withHeader(string $name, string $value = null): self
146+
public function withHeader(string $name, ?string $value = null): self
147147
{
148148
$this->headers[$name] = $value;
149149

src/Core/Schema/IdParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static function encoder($value): IdEncoderContract
4444
* @param ID|null $field
4545
* @return static
4646
*/
47-
public static function make(ID $field = null): self
47+
public static function make(?ID $field = null): self
4848
{
4949
return new self($field);
5050
}

src/Core/Server/Server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function authorizable(): bool
159159
/**
160160
* @inheritDoc
161161
*/
162-
public function url($extra = [], bool $secure = null): string
162+
public function url($extra = [], ?bool $secure = null): string
163163
{
164164
$tail = Collection::make(Arr::wrap($extra))
165165
->map(fn($value) => ($value instanceof UrlRoutable) ? $value->getRouteKey() : $value)

0 commit comments

Comments
 (0)