From 2f0c672d336832f032b276578b44fc8f4888dd77 Mon Sep 17 00:00:00 2001 From: SerhiiKotelnikov <165281614+SerhiiKotelnikov@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:32:52 +0200 Subject: [PATCH 1/3] docs: update readme link to docs (#297) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 50ef5fa..977e3d9 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ See our website, [laraveljsonapi.io](https://laraveljsonapi.io) ### Tutorial New to JSON:API and/or Laravel JSON:API? Then -the [Laravel JSON:API tutorial](https://laraveljsonapi.io/docs/2.0/tutorial/) +the [Laravel JSON:API tutorial](https://laraveljsonapi.io/4.x/tutorial/) is a great way to learn! Follow the tutorial to build a blog application with a JSON:API compliant API. From 0f10886a27d7d71a1240c7f7dc182c1bb3c3abbe Mon Sep 17 00:00:00 2001 From: Christopher Gammie Date: Fri, 29 Nov 2024 18:32:02 +0000 Subject: [PATCH 2/3] fix: remove deprecation notices in php 8.4 --- .github/workflows/tests.yml | 2 +- CHANGELOG.md | 4 ++++ composer.json | 14 ++++++------- phpunit.xml | 21 ++++++++++++++----- src/Exceptions/HttpNotAcceptableException.php | 4 ++-- src/Routing/ActionRegistrar.php | 16 +++++++------- src/Routing/PendingResourceRegistration.php | 2 +- src/Routing/ResourceRegistrar.php | 2 +- tests/lib/Integration/Routing/TestCase.php | 6 +++--- 9 files changed, 43 insertions(+), 28 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 843531a..1f1b5a4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: true matrix: - php: [8.2, 8.3] + php: [8.2, 8.3, 8.4] laravel: [11] steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index ac5a964..c713820 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. This projec ## Unreleased +### Fixed + +- Remove deprecation notices in PHP 8.4. + ## [4.1.0] - 2024-06-26 ### Fixed diff --git a/composer.json b/composer.json index 9fb3e7a..5ac9733 100644 --- a/composer.json +++ b/composer.json @@ -25,16 +25,16 @@ "require": { "php": "^8.2", "ext-json": "*", - "laravel-json-api/core": "^4.1", - "laravel-json-api/eloquent": "^4.1", - "laravel-json-api/encoder-neomerx": "^4.0", - "laravel-json-api/exceptions": "^3.0", - "laravel-json-api/spec": "^3.0", - "laravel-json-api/validation": "^4.0", + "laravel-json-api/core": "^4.3.2", + "laravel-json-api/eloquent": "^4.4", + "laravel-json-api/encoder-neomerx": "^4.1", + "laravel-json-api/exceptions": "^3.1", + "laravel-json-api/spec": "^3.1", + "laravel-json-api/validation": "^4.2", "laravel/framework": "^11.0" }, "require-dev": { - "laravel-json-api/testing": "^3.0", + "laravel-json-api/testing": "^3.0.2", "orchestra/testbench": "^9.0", "phpunit/phpunit": "^10.5" }, diff --git a/phpunit.xml b/phpunit.xml index 539875b..f2ba358 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,9 +1,20 @@ - + diff --git a/src/Exceptions/HttpNotAcceptableException.php b/src/Exceptions/HttpNotAcceptableException.php index ea6384d..7f7594a 100644 --- a/src/Exceptions/HttpNotAcceptableException.php +++ b/src/Exceptions/HttpNotAcceptableException.php @@ -26,8 +26,8 @@ class HttpNotAcceptableException extends HttpException * @param int $code */ public function __construct( - string $message = null, - Throwable $previous = null, + ?string $message = null, + ?Throwable $previous = null, array $headers = [], int $code = 0 ) { diff --git a/src/Routing/ActionRegistrar.php b/src/Routing/ActionRegistrar.php index c259278..b98680f 100644 --- a/src/Routing/ActionRegistrar.php +++ b/src/Routing/ActionRegistrar.php @@ -77,7 +77,7 @@ public function __construct( string $resourceType, array $options, string $controller, - string $prefix = null + ?string $prefix = null ) { $this->router = $router; $this->resource = $resource; @@ -106,7 +106,7 @@ public function withId(): self * @param string|null $method * @return ActionProxy */ - public function get(string $uri, string $method = null): ActionProxy + public function get(string $uri, ?string $method = null): ActionProxy { return $this->register('get', $uri, $method); } @@ -118,7 +118,7 @@ public function get(string $uri, string $method = null): ActionProxy * @param string|null $method * @return ActionProxy */ - public function post(string $uri, string $method = null): ActionProxy + public function post(string $uri, ?string $method = null): ActionProxy { return $this->register('post', $uri, $method); } @@ -130,7 +130,7 @@ public function post(string $uri, string $method = null): ActionProxy * @param string|null $method * @return ActionProxy */ - public function patch(string $uri, string $method = null): ActionProxy + public function patch(string $uri, ?string $method = null): ActionProxy { return $this->register('patch', $uri, $method); } @@ -142,7 +142,7 @@ public function patch(string $uri, string $method = null): ActionProxy * @param string|null $method * @return ActionProxy */ - public function put(string $uri, string $method = null): ActionProxy + public function put(string $uri, ?string $method = null): ActionProxy { return $this->register('put', $uri, $method); } @@ -154,7 +154,7 @@ public function put(string $uri, string $method = null): ActionProxy * @param string|null $method * @return ActionProxy */ - public function delete(string $uri, string $method = null): ActionProxy + public function delete(string $uri, ?string $method = null): ActionProxy { return $this->register('delete', $uri, $method); } @@ -166,7 +166,7 @@ public function delete(string $uri, string $method = null): ActionProxy * @param string|null $method * @return ActionProxy */ - public function options(string $uri, string $method = null): ActionProxy + public function options(string $uri, ?string $method = null): ActionProxy { return $this->register('options', $uri, $method); } @@ -177,7 +177,7 @@ public function options(string $uri, string $method = null): ActionProxy * @param string|null $action * @return ActionProxy */ - public function register(string $method, string $uri, string $action = null): ActionProxy + public function register(string $method, string $uri, ?string $action = null): ActionProxy { $action = $action ?: $this->guessControllerAction($uri); $parameter = $this->getParameter(); diff --git a/src/Routing/PendingResourceRegistration.php b/src/Routing/PendingResourceRegistration.php index c98fa02..627bd0f 100644 --- a/src/Routing/PendingResourceRegistration.php +++ b/src/Routing/PendingResourceRegistration.php @@ -229,7 +229,7 @@ public function relationships(Closure $callback): self * @param Closure|null $callback * @return $this */ - public function actions($prefixOrCallback, Closure $callback = null): self + public function actions($prefixOrCallback, ?Closure $callback = null): self { if ($prefixOrCallback instanceof Closure && null === $callback) { $this->actionsPrefix = null; diff --git a/src/Routing/ResourceRegistrar.php b/src/Routing/ResourceRegistrar.php index 265fc79..5da31db 100644 --- a/src/Routing/ResourceRegistrar.php +++ b/src/Routing/ResourceRegistrar.php @@ -51,7 +51,7 @@ public function __construct(RegistrarContract $router, Server $server) * @param string|null $controller * @return PendingResourceRegistration */ - public function resource(string $resourceType, string $controller = null): PendingResourceRegistration + public function resource(string $resourceType, ?string $controller = null): PendingResourceRegistration { return new PendingResourceRegistration( $this, diff --git a/tests/lib/Integration/Routing/TestCase.php b/tests/lib/Integration/Routing/TestCase.php index e520ec1..d8d589f 100644 --- a/tests/lib/Integration/Routing/TestCase.php +++ b/tests/lib/Integration/Routing/TestCase.php @@ -66,8 +66,8 @@ protected function createServer(string $name): Server protected function createSchema( Server $server, string $name, - string $pattern = null, - string $uriType = null + ?string $pattern = null, + ?string $uriType = null ): Schema { $schema = $this->createMock(Schema::class); @@ -89,7 +89,7 @@ protected function createSchema( * @param string|null $uriName * @return void */ - protected function createRelation(MockObject $schema, string $fieldName, string $uriName = null): void + protected function createRelation(MockObject $schema, string $fieldName, ?string $uriName = null): void { $relation = $this->createMock(Relation::class); $relation->method('name')->willReturn($fieldName); From fa0addc1b47fff14d02259c38f4b52824d7d392d Mon Sep 17 00:00:00 2001 From: Christopher Gammie Date: Sat, 30 Nov 2024 17:58:48 +0000 Subject: [PATCH 3/3] docs: update changelog and bump version --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c713820..f404766 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. This projec ## Unreleased +## [4.1.1] - 2024-11-30 + ### Fixed - Remove deprecation notices in PHP 8.4.