Skip to content

Commit 0f10886

Browse files
committed
fix: remove deprecation notices in php 8.4
1 parent 2f0c672 commit 0f10886

File tree

9 files changed

+43
-28
lines changed

9 files changed

+43
-28
lines changed

.github/workflows/tests.yml

+1-1
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

+4
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.0] - 2024-06-26
913

1014
### Fixed

composer.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@
2525
"require": {
2626
"php": "^8.2",
2727
"ext-json": "*",
28-
"laravel-json-api/core": "^4.1",
29-
"laravel-json-api/eloquent": "^4.1",
30-
"laravel-json-api/encoder-neomerx": "^4.0",
31-
"laravel-json-api/exceptions": "^3.0",
32-
"laravel-json-api/spec": "^3.0",
33-
"laravel-json-api/validation": "^4.0",
28+
"laravel-json-api/core": "^4.3.2",
29+
"laravel-json-api/eloquent": "^4.4",
30+
"laravel-json-api/encoder-neomerx": "^4.1",
31+
"laravel-json-api/exceptions": "^3.1",
32+
"laravel-json-api/spec": "^3.1",
33+
"laravel-json-api/validation": "^4.2",
3434
"laravel/framework": "^11.0"
3535
},
3636
"require-dev": {
37-
"laravel-json-api/testing": "^3.0",
37+
"laravel-json-api/testing": "^3.0.2",
3838
"orchestra/testbench": "^9.0",
3939
"phpunit/phpunit": "^10.5"
4040
},

phpunit.xml

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false"
3-
beStrictAboutTestsThatDoNotTestAnything="true" bootstrap="vendor/autoload.php" colors="true"
4-
processIsolation="false" stopOnError="false" stopOnFailure="false"
5-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache"
6-
backupStaticProperties="false">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
backupGlobals="false"
4+
beStrictAboutTestsThatDoNotTestAnything="true"
5+
bootstrap="vendor/autoload.php"
6+
colors="true"
7+
processIsolation="false"
8+
stopOnError="false"
9+
stopOnFailure="false"
10+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
11+
cacheDirectory=".phpunit.cache"
12+
backupStaticProperties="false"
13+
failOnWarning="true"
14+
failOnDeprecation="true"
15+
failOnNotice="true"
16+
displayDetailsOnTestsThatTriggerDeprecations="true"
17+
>
718
<coverage/>
819
<testsuites>
920
<testsuite name="Unit">

src/Exceptions/HttpNotAcceptableException.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class HttpNotAcceptableException extends HttpException
2626
* @param int $code
2727
*/
2828
public function __construct(
29-
string $message = null,
30-
Throwable $previous = null,
29+
?string $message = null,
30+
?Throwable $previous = null,
3131
array $headers = [],
3232
int $code = 0
3333
) {

src/Routing/ActionRegistrar.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function __construct(
7777
string $resourceType,
7878
array $options,
7979
string $controller,
80-
string $prefix = null
80+
?string $prefix = null
8181
) {
8282
$this->router = $router;
8383
$this->resource = $resource;
@@ -106,7 +106,7 @@ public function withId(): self
106106
* @param string|null $method
107107
* @return ActionProxy
108108
*/
109-
public function get(string $uri, string $method = null): ActionProxy
109+
public function get(string $uri, ?string $method = null): ActionProxy
110110
{
111111
return $this->register('get', $uri, $method);
112112
}
@@ -118,7 +118,7 @@ public function get(string $uri, string $method = null): ActionProxy
118118
* @param string|null $method
119119
* @return ActionProxy
120120
*/
121-
public function post(string $uri, string $method = null): ActionProxy
121+
public function post(string $uri, ?string $method = null): ActionProxy
122122
{
123123
return $this->register('post', $uri, $method);
124124
}
@@ -130,7 +130,7 @@ public function post(string $uri, string $method = null): ActionProxy
130130
* @param string|null $method
131131
* @return ActionProxy
132132
*/
133-
public function patch(string $uri, string $method = null): ActionProxy
133+
public function patch(string $uri, ?string $method = null): ActionProxy
134134
{
135135
return $this->register('patch', $uri, $method);
136136
}
@@ -142,7 +142,7 @@ public function patch(string $uri, string $method = null): ActionProxy
142142
* @param string|null $method
143143
* @return ActionProxy
144144
*/
145-
public function put(string $uri, string $method = null): ActionProxy
145+
public function put(string $uri, ?string $method = null): ActionProxy
146146
{
147147
return $this->register('put', $uri, $method);
148148
}
@@ -154,7 +154,7 @@ public function put(string $uri, string $method = null): ActionProxy
154154
* @param string|null $method
155155
* @return ActionProxy
156156
*/
157-
public function delete(string $uri, string $method = null): ActionProxy
157+
public function delete(string $uri, ?string $method = null): ActionProxy
158158
{
159159
return $this->register('delete', $uri, $method);
160160
}
@@ -166,7 +166,7 @@ public function delete(string $uri, string $method = null): ActionProxy
166166
* @param string|null $method
167167
* @return ActionProxy
168168
*/
169-
public function options(string $uri, string $method = null): ActionProxy
169+
public function options(string $uri, ?string $method = null): ActionProxy
170170
{
171171
return $this->register('options', $uri, $method);
172172
}
@@ -177,7 +177,7 @@ public function options(string $uri, string $method = null): ActionProxy
177177
* @param string|null $action
178178
* @return ActionProxy
179179
*/
180-
public function register(string $method, string $uri, string $action = null): ActionProxy
180+
public function register(string $method, string $uri, ?string $action = null): ActionProxy
181181
{
182182
$action = $action ?: $this->guessControllerAction($uri);
183183
$parameter = $this->getParameter();

src/Routing/PendingResourceRegistration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public function relationships(Closure $callback): self
229229
* @param Closure|null $callback
230230
* @return $this
231231
*/
232-
public function actions($prefixOrCallback, Closure $callback = null): self
232+
public function actions($prefixOrCallback, ?Closure $callback = null): self
233233
{
234234
if ($prefixOrCallback instanceof Closure && null === $callback) {
235235
$this->actionsPrefix = null;

src/Routing/ResourceRegistrar.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(RegistrarContract $router, Server $server)
5151
* @param string|null $controller
5252
* @return PendingResourceRegistration
5353
*/
54-
public function resource(string $resourceType, string $controller = null): PendingResourceRegistration
54+
public function resource(string $resourceType, ?string $controller = null): PendingResourceRegistration
5555
{
5656
return new PendingResourceRegistration(
5757
$this,

tests/lib/Integration/Routing/TestCase.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ protected function createServer(string $name): Server
6666
protected function createSchema(
6767
Server $server,
6868
string $name,
69-
string $pattern = null,
70-
string $uriType = null
69+
?string $pattern = null,
70+
?string $uriType = null
7171
): Schema
7272
{
7373
$schema = $this->createMock(Schema::class);
@@ -89,7 +89,7 @@ protected function createSchema(
8989
* @param string|null $uriName
9090
* @return void
9191
*/
92-
protected function createRelation(MockObject $schema, string $fieldName, string $uriName = null): void
92+
protected function createRelation(MockObject $schema, string $fieldName, ?string $uriName = null): void
9393
{
9494
$relation = $this->createMock(Relation::class);
9595
$relation->method('name')->willReturn($fieldName);

0 commit comments

Comments
 (0)