From 41010151671cd97f4ae44b514ffc980289c6a74b Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 18 Feb 2025 18:55:41 +0000 Subject: [PATCH 1/5] Bump dependencies for Laravel 12 --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 188d4f4..2f2f82f 100644 --- a/composer.json +++ b/composer.json @@ -18,16 +18,16 @@ "require": { "php": "^8.1", "guzzlehttp/guzzle": "^7.4", - "illuminate/support": "^9.0|^10.0|^11.0", + "illuminate/support": "^9.0|^10.0|^11.0|^12.0", "openfoodfacts/openfoodfacts-php": "^0.3.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.9.5", "larastan/larastan": "^2.9", - "orchestra/testbench": "^7.0|^8.0|^9.0", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5.21|^10.5" + "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0", + "phpstan/phpstan": "^1.10|^2.1", + "phpstan/phpstan-phpunit": "^1.3|^2.0", + "phpunit/phpunit": "^9.5.21|^10.5|^11.5.3" }, "autoload": { "psr-4": { From 8b165e4e31f1e3abac31cb2d3c06201ec9b1d243 Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 18 Feb 2025 18:55:42 +0000 Subject: [PATCH 2/5] Update GitHub Actions for Laravel 12 --- .github/workflows/ci.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48f2a98..ad27923 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,15 +1,18 @@ name: CI + on: push: pull_request: + jobs: tests: runs-on: ubuntu-latest + strategy: fail-fast: false matrix: php: [8.1, 8.2] - laravel: [11.*, 10.*, 9.*] + laravel: ['9.*', '10.*', '11.*', '12.*'] dependency-version: [prefer-stable] include: - laravel: 11.* @@ -18,45 +21,60 @@ jobs: testbench: 8.* - laravel: 9.* testbench: 7.* + - laravel: 12.* + testbench: 10.* exclude: - laravel: 11.* php: 8.1 + - laravel: 12.* + php: 8.1 + name: Tests - PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-version }} + steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 10 + - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, xdebug coverage: xdebug + - name: Report PHP version run: php -v + - name: Get Composer Cache Directory id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache dependencies uses: actions/cache@v4.2.0 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ matrix.php }}-composer- + - name: Install Composer dependencies run: | composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction + - name: Check quality code env: - PHP_CS_FIXER_IGNORE_ENV: 1 + PHP_CS_FIXER_IGNORE_ENV: 1 run: vendor/bin/php-cs-fixer fix --ansi --dry-run --using-cache=no --verbose + - name: Execute phpstan run: vendor/bin/phpstan + - name: Execute tests run: vendor/bin/phpunit --coverage-clover ./build/coverage.clover + - name: Uploading code coverage to scrutinize uses: sudo-bot/action-scrutinizer@latest with: - cli-args: "--format=php-clover build/coverage.clover" + cli-args: --format=php-clover build/coverage.clover From e323d49466c86701df922e9ca975781154df7f13 Mon Sep 17 00:00:00 2001 From: Benoit Colin Date: Mon, 3 Mar 2025 17:09:43 +0100 Subject: [PATCH 3/5] fix: update phpstan --- composer.json | 2 +- phpstan.neon.dist | 1 + src/Facades/OpenFoodFacts.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 2f2f82f..155fae1 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.9.5", - "larastan/larastan": "^2.9", + "larastan/larastan": "^2.9|^3.1", "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0", "phpstan/phpstan": "^1.10|^2.1", "phpstan/phpstan-phpunit": "^1.3|^2.0", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 2d272f9..c4111ab 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -9,6 +9,7 @@ parameters: - src - tests ignoreErrors: + - identifier: method.alreadyNarrowedType - identifier: missingType.iterableValue - message: "#^Cannot access offset '[a-z.]+' on Illuminate\\\\Contracts\\\\Container\\\\Container.$#" diff --git a/src/Facades/OpenFoodFacts.php b/src/Facades/OpenFoodFacts.php index d0b976e..ca76010 100644 --- a/src/Facades/OpenFoodFacts.php +++ b/src/Facades/OpenFoodFacts.php @@ -6,7 +6,7 @@ /** * @method static array barcode(string $value) - * @method static \Illuminate\Support\Collection find(string $searchTerm) + * @method static \Illuminate\Support\Collection find(string $searchTerm) * @method static \OpenFoodFacts\Document getProduct(string $barcode) * * @see \OpenFoodFacts\Laravel\OpenFoodFacts From bc5916c77004f5e615515a36f77cb916fa64d668 Mon Sep 17 00:00:00 2001 From: Benoit Colin Date: Mon, 3 Mar 2025 17:31:48 +0100 Subject: [PATCH 4/5] fix: rebase + phpstan fix (test) --- .github/workflows/ci.yml | 4 ++-- phpstan.neon.dist | 1 + src/Facades/OpenBeautyFacts.php | 2 +- src/Facades/OpenPetFoodFacts.php | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad27923..11a5d20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,14 +15,14 @@ jobs: laravel: ['9.*', '10.*', '11.*', '12.*'] dependency-version: [prefer-stable] include: + - laravel: 12.* + testbench: 10.* - laravel: 11.* testbench: 9.* - laravel: 10.* testbench: 8.* - laravel: 9.* testbench: 7.* - - laravel: 12.* - testbench: 10.* exclude: - laravel: 11.* php: 8.1 diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c4111ab..f5f2bff 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -5,6 +5,7 @@ includes: parameters: level: 9 + reportUnmatchedIgnoredErrors: false paths: - src - tests diff --git a/src/Facades/OpenBeautyFacts.php b/src/Facades/OpenBeautyFacts.php index 9af8e34..d4e8c0e 100644 --- a/src/Facades/OpenBeautyFacts.php +++ b/src/Facades/OpenBeautyFacts.php @@ -6,7 +6,7 @@ /** * @method static array barcode(string $value) - * @method static \Illuminate\Support\Collection find(string $searchTerm) + * @method static \Illuminate\Support\Collection find(string $searchTerm) * @method static \OpenFoodFacts\Document getProduct(string $barcode) * * @see \OpenFoodFacts\Laravel\OpenFoodFacts diff --git a/src/Facades/OpenPetFoodFacts.php b/src/Facades/OpenPetFoodFacts.php index fcaece2..44d0762 100644 --- a/src/Facades/OpenPetFoodFacts.php +++ b/src/Facades/OpenPetFoodFacts.php @@ -6,7 +6,7 @@ /** * @method static array barcode(string $value) - * @method static \Illuminate\Support\Collection find(string $searchTerm) + * @method static \Illuminate\Support\Collection find(string $searchTerm) * @method static \OpenFoodFacts\Document getProduct(string $barcode) * * @see \OpenFoodFacts\Laravel\OpenFoodFacts From 7ab05514a04e1089cf82277142648f14f9c8bf78 Mon Sep 17 00:00:00 2001 From: Benoit Colin Date: Mon, 3 Mar 2025 18:11:40 +0100 Subject: [PATCH 5/5] fix: rollback some modication --- .gitignore | 3 ++- phpunit.xml.dist | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index aed40c4..e8542fc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ composer.lock docs vendor coverage +.phpunit.cache .phpunit.result.cache -.php-cs-fixer.cache \ No newline at end of file +.php-cs-fixer.cache diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 579a2ea..d75671a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,9 +1,6 @@ - + - - src/ - @@ -18,4 +15,9 @@ + + + src/ + +