From e21f1340486e1b53c5bceaa13a3d7506c4c8ce9b Mon Sep 17 00:00:00 2001 From: Arthur Monney Date: Mon, 26 Feb 2024 05:04:48 +0100 Subject: [PATCH] Change phpstan workflows --- .github/workflows/phpstan.yml | 52 +++++++++++++++++++---------------- phpstan.neon | 3 +- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index bb1cf3073..56b0db2d6 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -1,4 +1,4 @@ -name: phpstan +name: "phpstan Static Analysis" on: push: @@ -6,30 +6,36 @@ on: jobs: phpstan: - runs-on: ubuntu-latest strategy: fail-fast: false matrix: - php: [8.2, 8.1] - laravel: [10.*] - dependency-version: [prefer-stable] - name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} + php: ["8.1", "8.2"] + laravel: ["^9.0", "^10.0"] + dependencies: ["highest"] + + name: "PHP ${{ matrix.php }} - L${{ matrix.laravel }} ${{ matrix.dependencies == 'highest' && '↑' || '↓' }}" + + runs-on: "ubuntu-latest" + steps: - - uses: actions/checkout@v3 - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ~/.composer/cache/files - key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} - - name: Setup PHP - uses: shivammathur/setup-php@v2 + - name: "Checkout code" + uses: "actions/checkout@v3" + + - name: "Setup PHP" + uses: "shivammathur/setup-php@v2" with: - php-version: ${{ matrix.php }} - extensions: mbstring, pdo, pdo_sqlite - coverage: none - - name: Install dependencies - run: | - composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update - composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction - - name: Run PHPStan - run: ./vendor/bin/phpstan analyse + php-version: "${{ matrix.php }}" + extensions: "dom, curl, libxml, mbstring, zip, fileinfo" + tools: "composer:v2" + coverage: "none" + + - name: "Install dependencies from composer.json" + if: "matrix.dependencies != 'lowest'" + run: "composer update --with='laravel/framework:${{ matrix.laravel }}' --no-interaction --no-progress" + + - name: "Install lowest dependencies from composer.json" + if: "matrix.dependencies == 'lowest'" + run: "composer update --with='laravel/framework:${{ matrix.laravel }}' --no-interaction --no-progress --prefer-lowest" + + - name: "Run PHPStan" + run: ./vendor/bin/phpstan diff --git a/phpstan.neon b/phpstan.neon index 8f1c87001..ba77b31f3 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ includes: - - ./vendor/larastan/larastan/extension.neon + - ./vendor/nunomaduro/larastan/extension.neon parameters: level: 5 @@ -12,6 +12,5 @@ parameters: - packages/core/src/Traits/ ignoreErrors: - "#Called 'take' on Laravel collection, but could have been retrieved as a query.#" - - "#^Call to an undefined method Shopper\\\\Core\\\\Repositories\\\\BaseRepository\\:\\:whereNull\\(\\)\\.$#" checkMissingIterableValueType: true treatPhpDocTypesAsCertain: false