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,

0 commit comments

Comments
 (0)