From 13bf64b09f391399459a8313bacd6dad946083d4 Mon Sep 17 00:00:00 2001 From: Ehsan Soleimanian <59331480+KFTco@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:08:11 +0330 Subject: [PATCH 01/12] Fix Handler registeration syntax .md There is no handle function in ExceptionHandlerHelper and we have to use render function instead, On the other hands the Parameters is not passed in the right order. --- docs/exceptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/exceptions.md b/docs/exceptions.md index 07aa0903..c67fa233 100644 --- a/docs/exceptions.md +++ b/docs/exceptions.md @@ -49,7 +49,7 @@ use MarcinOrlowski\ResponseBuilder\ExceptionHandlerHelper; public function register() { $this->renderable(function (Throwable $ex, $request) { - return ExceptionHandlerHelper::handle($ex, $request); + return ExceptionHandlerHelper::render($request ,$ex ); }); } ``` From a4582d716aefe5cfa0496364ea995f9a1c2bcd0e Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Sun, 15 Oct 2023 22:02:33 +0200 Subject: [PATCH 02/12] Updated Github Actions --- .github/workflows/coding-standards.yml | 2 +- .github/workflows/coverage.yml | 9 +++++---- .github/workflows/markdown.yml | 2 +- .github/workflows/phpstan.yml | 7 ++++--- .github/workflows/phpunit.yml | 7 ++++--- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 43b5820b..e71b1562 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -31,7 +31,7 @@ jobs: steps: - name: "Checkout repository..." - uses: actions/checkout@v3 + uses: actions/checkout@v4 # https://github.com/marketplace/actions/composer-php-actions - name: "Installing dependencies..." diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 251f4e05..9d9d4c52 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -26,15 +26,16 @@ jobs: # do not stop the workflow if single run failed fail-fast: false matrix: - # quotes are needed it is treated as a number and zero at decimal part is gone at runtime - laravel: ["9.x"] - php: ["8.0", "8.1"] + # quotes are needed it is treated as a number and zero at decimal part is gone + # at runtime i.e. 8.10 -> 8.1, while "8.10" => "8.10". + laravel: ["10.0"] + php: ["8.1"] runs-on: ubuntu-latest steps: - name: "Checkout repository..." - uses: actions/checkout@v3 + uses: actions/checkout@v4 # https://github.com/marketplace/actions/composer-php-actions - name: "Installing dependencies..." diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 9ce6ff8b..a729a09d 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # https://github.com/marketplace/actions/my-markdown-linter - name: "Running markdown linter..." diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 4a989368..1cef9a6a 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -26,15 +26,16 @@ jobs: # do not stop the workflow if single run failed fail-fast: false matrix: - # quotes are needed it is treated as a number and zero at decimal part is gone at runtime - laravel: ["10.x"] + # quotes are needed it is treated as a number and zero at decimal part is gone + # at runtime i.e. 8.10 -> 8.1, while "8.10" => "8.10". + laravel: ["10.0"] php: ["8.1"] runs-on: ubuntu-latest steps: - name: "Checkout repository..." - uses: actions/checkout@v3 + uses: actions/checkout@v4 # https://github.com/marketplace/actions/composer-php-actions - name: "Installing dependencies..." diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index d011af56..8442a1cc 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -26,15 +26,16 @@ jobs: # do not stop the workflow if single run failed fail-fast: false matrix: - # quotes are needed it is treated as a number and zero at decimal part is gone at runtime - laravel: ["10.x"] + # quotes are needed it is treated as a number and zero at decimal part is gone + # at runtime i.e. 8.10 -> 8.1, while "8.10" => "8.10". + laravel: ["10.0"] php: ["8.1"] runs-on: ubuntu-latest steps: - name: "Checkout repository..." - uses: actions/checkout@v3 + uses: actions/checkout@v4 # https://github.com/marketplace/actions/composer-php-actions - name: "Installing dependencies..." From b42b77f0240e049a7bce9eff74a00c2ba3de2eb1 Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Mon, 6 May 2024 15:05:32 +0200 Subject: [PATCH 03/12] Updated package requirements --- composer.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 7f7d77f5..b33d3e14 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "marcin-orlowski/laravel-api-response-builder", "description": "Helps building nice, normalized and easy to consume Laravel REST API.", "homepage": "https://github.com/MarcinOrlowski/laravel-api-response-builder", - "version": "10.0.0", + "version": "11.0.0", "keywords": [ "laravel", "laravel10", @@ -13,7 +13,8 @@ "helper", "php", "php8", - "php81", + "php82", + "php83", "mobile", "android", "ios" @@ -44,8 +45,8 @@ } }, "require": { - "php": "^8.1|^8.2", - "laravel/framework": "^10.0" + "php": "^8.2|^8.3", + "laravel/framework": "^11.0" }, "require-dev": { "marcin-orlowski/phpunit-extra-asserts": "^5.1.0", From 795b79bbe0ffa958ccf56799c4c4cb4ef99a617d Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Mon, 6 May 2024 15:06:03 +0200 Subject: [PATCH 04/12] Updated PHPUnit GHA to not use phpunit action any more --- .github/workflows/phpunit.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 8442a1cc..e0b5914b 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -28,8 +28,8 @@ jobs: matrix: # quotes are needed it is treated as a number and zero at decimal part is gone # at runtime i.e. 8.10 -> 8.1, while "8.10" => "8.10". - laravel: ["10.0"] - php: ["8.1"] + laravel: ["11.0"] + php: ["8.2"] runs-on: ubuntu-latest @@ -45,12 +45,9 @@ jobs: php_version: "${{ matrix.php }}" dev: yes - # https://github.com/marketplace/actions/phpunit-php-actions - name: "Running PHPUnit..." - uses: php-actions/phpunit@v3 - with: - bootstrap: "vendor/autoload.php" - configuration: "tests/phpunit.xml" - # version: "10.0.89" - # memory_limit: "16M" - php_version: "${{ matrix.php }}" + shell: bash + run: | + curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + /usr/local/bin/composer install --dev --no-interaction + /usr/local/bin/composer test From 192243045ba9f07d3d24b6630e79dd687a6e349f Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Mon, 6 May 2024 15:11:05 +0200 Subject: [PATCH 05/12] Updated dependencies --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index b33d3e14..9fcaba99 100644 --- a/composer.json +++ b/composer.json @@ -50,11 +50,11 @@ }, "require-dev": { "marcin-orlowski/phpunit-extra-asserts": "^5.1.0", - "orchestra/testbench": "^8.0", - "phpunit/phpunit": "^10.0.0", - "phpunit/php-code-coverage": "^10.0", - "nunomaduro/larastan": "^2.0", - "marcin-orlowski/php-lockpick": "^1.0" + "orchestra/testbench": "^9.0", + "phpunit/phpunit": "^11.0", + "phpunit/php-code-coverage": "^11.0", + "larastan/larastan": "^2.0", + "marcin-orlowski/lockpick": "^1.0" }, "scripts": { "test": "vendor/bin/phpunit -c tests/phpunit.xml", From 616129eace51b24057ff2b0402bc29f1a5edf680 Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Mon, 6 May 2024 15:12:41 +0200 Subject: [PATCH 06/12] Added "disableProcessTimeout" to composer tasks --- composer.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 9fcaba99..46e204dd 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,13 @@ "marcin-orlowski/lockpick": "^1.0" }, "scripts": { - "test": "vendor/bin/phpunit -c tests/phpunit.xml", - "mdlint": "markdownlint --config .markdownlint.yaml --ignore vendor **/*.md .github/**/*.md docs README.md" + "test": [ + "Composer\\Config::disableProcessTimeout", + "vendor/bin/phpunit -c tests/phpunit.xml" + ], + "mdlint": [ + "Composer\\Config::disableProcessTimeout", + "markdownlint --config .markdownlint.yaml --ignore vendor **/*.md .github/**/*.md docs README.md" + ] } } From eca6b2c8e96e224ea66db7fb7547af3b09bc0241 Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Mon, 6 May 2024 15:12:48 +0200 Subject: [PATCH 07/12] Version bump --- docs/CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/CHANGES.md b/docs/CHANGES.md index df0b07e2..73cb6cd0 100644 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -18,6 +18,9 @@ should be able to easily backport future new features to older versions rather e ## CHANGE LOG ## +* dev + * Added support for Laravel v11. + * v10.0.0 (2023-02-20) * **BACKWARD INCOMPATIBLE CHANGES** ([more info](compatibility.md)). * Added support for Laravel v10. From cecf105ca2a857f7fba65cea5973fc567d32bfec Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Mon, 6 May 2024 15:17:46 +0200 Subject: [PATCH 08/12] Updated GHA to use recent versions --- .github/workflows/coding-standards.yml | 4 ++-- .github/workflows/coverage.yml | 4 ++-- .github/workflows/phpstan.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index e71b1562..499e651c 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -24,8 +24,8 @@ jobs: fail-fast: false matrix: # quotes are needed it is treated as a number and zero at decimal part is gone at runtime - laravel: ["9.x"] - php: ["8.0", "8.1"] + laravel: ["11.x"] + php: ["8.2"] runs-on: ubuntu-latest diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 9d9d4c52..0b00a8cb 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -28,8 +28,8 @@ jobs: matrix: # quotes are needed it is treated as a number and zero at decimal part is gone # at runtime i.e. 8.10 -> 8.1, while "8.10" => "8.10". - laravel: ["10.0"] - php: ["8.1"] + laravel: ["11.0"] + php: ["8.2"] runs-on: ubuntu-latest diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 1cef9a6a..7008a303 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -28,8 +28,8 @@ jobs: matrix: # quotes are needed it is treated as a number and zero at decimal part is gone # at runtime i.e. 8.10 -> 8.1, while "8.10" => "8.10". - laravel: ["10.0"] - php: ["8.1"] + laravel: ["11.0"] + php: ["8.2"] runs-on: ubuntu-latest From b7ad0d3965d4306ce4f7122033501a0a5b3a069a Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Mon, 6 May 2024 15:20:46 +0200 Subject: [PATCH 09/12] Updated CHANGELOG --- docs/CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CHANGES.md b/docs/CHANGES.md index 73cb6cd0..99f05b4a 100644 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -20,6 +20,7 @@ should be able to easily backport future new features to older versions rather e * dev * Added support for Laravel v11. + * Corrected documentation (thanks to Ehsan Soleimanian) * v10.0.0 (2023-02-20) * **BACKWARD INCOMPATIBLE CHANGES** ([more info](compatibility.md)). From f4e8a213fedad79fa74e82ebc3360c4708c156af Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Mon, 6 May 2024 15:28:49 +0200 Subject: [PATCH 10/12] Added "lint" composer action --- composer.json | 16 ++++++++++------ phpstan.neon | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 46e204dd..5480e683 100644 --- a/composer.json +++ b/composer.json @@ -58,12 +58,16 @@ }, "scripts": { "test": [ - "Composer\\Config::disableProcessTimeout", - "vendor/bin/phpunit -c tests/phpunit.xml" - ], + "Composer\\Config::disableProcessTimeout", + "vendor/bin/phpunit -c tests/phpunit.xml" + ], + "lint": [ + "Composer\\Config::disableProcessTimeout", + "vendor/bin/phpstan analyse --no-progress --no-interaction -c phpstan.neon" + ], "mdlint": [ - "Composer\\Config::disableProcessTimeout", - "markdownlint --config .markdownlint.yaml --ignore vendor **/*.md .github/**/*.md docs README.md" - ] + "Composer\\Config::disableProcessTimeout", + "markdownlint --config .markdownlint.yaml --ignore vendor **/*.md .github/**/*.md docs README.md" + ] } } diff --git a/phpstan.neon b/phpstan.neon index 80b81152..516f2bed 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -10,7 +10,7 @@ ################################################################################## includes: - - vendor/nunomaduro/larastan/extension.neon + - vendor/larastan/larastan/extension.neon parameters: checkGenericClassInNonGenericObjectType: false level: max From 472db8c5d63c15d8a3accd40356b97bf252805fc Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Mon, 6 May 2024 15:28:59 +0200 Subject: [PATCH 11/12] Annotated code to make linter happy --- tests/phpunit/Models/TestModelJsonSerializable.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/phpunit/Models/TestModelJsonSerializable.php b/tests/phpunit/Models/TestModelJsonSerializable.php index b56f14d2..4622bc67 100644 --- a/tests/phpunit/Models/TestModelJsonSerializable.php +++ b/tests/phpunit/Models/TestModelJsonSerializable.php @@ -29,6 +29,7 @@ public function __construct(protected mixed $val) {} public function getVal(): string { + /** @phpstan-ignore-next-line */ return $this->val; } From 3b312ef655aeaa9b50c0f611c17fe4f3c27f90f4 Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Mon, 6 May 2024 15:36:45 +0200 Subject: [PATCH 12/12] Removed use of deprecated --dev switch --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index e0b5914b..d9fd26c4 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -49,5 +49,5 @@ jobs: shell: bash run: | curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - /usr/local/bin/composer install --dev --no-interaction + /usr/local/bin/composer install --no-interaction /usr/local/bin/composer test