diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48f2a98..11a5d20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,22 @@ 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: 12.* + testbench: 10.* - laravel: 11.* testbench: 9.* - laravel: 10.* @@ -21,42 +26,55 @@ jobs: 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 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/composer.json b/composer.json index 188d4f4..155fae1 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" + "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", + "phpunit/phpunit": "^9.5.21|^10.5|^11.5.3" }, "autoload": { "psr-4": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 2d272f9..f5f2bff 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -5,10 +5,12 @@ includes: parameters: level: 9 + reportUnmatchedIgnoredErrors: false paths: - src - tests ignoreErrors: + - identifier: method.alreadyNarrowedType - identifier: missingType.iterableValue - message: "#^Cannot access offset '[a-z.]+' on Illuminate\\\\Contracts\\\\Container\\\\Container.$#" 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/ + + 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/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 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