Skip to content

Commit c5c596d

Browse files
committed
fix: remove php 8.4 deprecation notices
1 parent c78f07d commit c5c596d

File tree

9 files changed

+19
-14
lines changed

9 files changed

+19
-14
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+
- Remove deprecation notices in PHP 8.4.
11+
812
## [4.1.1] - 2024-06-20
913

1014
### Fixed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"ext-json": "*",
2828
"illuminate/contracts": "^11.0",
2929
"illuminate/support": "^11.0",
30-
"laravel-json-api/core": "^4.0"
30+
"laravel-json-api/core": "^4.3.2"
3131
},
3232
"require-dev": {
3333
"orchestra/testbench": "^9.0",
@@ -53,7 +53,7 @@
5353
]
5454
}
5555
},
56-
"minimum-stability": "stable",
56+
"minimum-stability": "dev",
5757
"prefer-stable": true,
5858
"config": {
5959
"sort-packages": true

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/JsonApiValidation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static function showValidatorFailures(): self
6666
* @param string|null $path
6767
* @return string
6868
*/
69-
public static function translationKeyForRule($rule, string $path = null): string
69+
public static function translationKeyForRule($rule, ?string $path = null): string
7070
{
7171
$name = Str::snake(class_basename($rule));
7272

@@ -80,7 +80,7 @@ public static function translationKeyForRule($rule, string $path = null): string
8080
* @param string|null $path
8181
* @return string
8282
*/
83-
public static function qualifyTranslationKey(string $key, string $path = null): string
83+
public static function qualifyTranslationKey(string $key, ?string $path = null): string
8484
{
8585
$namespace = self::$translationNamespace;
8686
$qualified = "{$namespace}::validation.{$key}";

src/Rule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static function dateTime(): DateTimeIso8601
128128
* @param array|null $allowed
129129
* @return AllowedFieldSets
130130
*/
131-
public static function fieldSets(array $allowed = null): AllowedFieldSets
131+
public static function fieldSets(?array $allowed = null): AllowedFieldSets
132132
{
133133
if (is_null($allowed)) {
134134
return AllowedFieldSets::make(
@@ -217,7 +217,7 @@ public static function integer(): JsonNumber
217217
* @param string|null $name
218218
* @return ParameterNotSupported
219219
*/
220-
public static function notSupported(string $name = null): ParameterNotSupported
220+
public static function notSupported(?string $name = null): ParameterNotSupported
221221
{
222222
return new ParameterNotSupported($name);
223223
}

src/Rules/AllowedFieldSets.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct(iterable $allowed = [])
6868
* the allowed fields, empty array for none allowed, or null for all allowed.
6969
* @return $this
7070
*/
71-
public function allow(string $resourceType, array $fields = null): self
71+
public function allow(string $resourceType, ?array $fields = null): self
7272
{
7373
$this->allowed[$resourceType] = $fields;
7474

src/Rules/ParameterNotSupported.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class ParameterNotSupported implements Rule
2525
/**
2626
* DisallowedParameter constructor.
2727
*
28-
* @param string $name
28+
* @param string|null $name
2929
*/
30-
public function __construct(string $name = null)
30+
public function __construct(?string $name = null)
3131
{
3232
$this->name = $name;
3333
}

src/Translator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(TranslatorContract $translator)
4646
* rule failure details
4747
* @return Error
4848
*/
49-
public function invalid(string $pointer, string $detail = null, array $failed = []): Error
49+
public function invalid(string $pointer, ?string $detail = null, array $failed = []): Error
5050
{
5151
return Error::make()
5252
->setStatus(422)
@@ -67,7 +67,7 @@ public function invalid(string $pointer, string $detail = null, array $failed =
6767
* rule failure details
6868
* @return Error
6969
*/
70-
public function invalidResource(string $pointer, string $detail = null, array $failed = []): Error
70+
public function invalidResource(string $pointer, ?string $detail = null, array $failed = []): Error
7171
{
7272
return Error::make()
7373
->setStatus(422)
@@ -88,7 +88,7 @@ public function invalidResource(string $pointer, string $detail = null, array $f
8888
* rule failure details.
8989
* @return Error
9090
*/
91-
public function invalidQueryParameter(string $param, string $detail = null, array $failed = []): Error
91+
public function invalidQueryParameter(string $param, ?string $detail = null, array $failed = []): Error
9292
{
9393
return Error::make()
9494
->setStatus(400)
@@ -106,7 +106,7 @@ public function invalidQueryParameter(string $param, string $detail = null, arra
106106
* the validation message (already translated).
107107
* @return Error
108108
*/
109-
public function invalidDeleteRequest(string $detail = null): Error
109+
public function invalidDeleteRequest(?string $detail = null): Error
110110
{
111111
return Error::make()
112112
->setStatus(422)

0 commit comments

Comments
 (0)