Skip to content

Commit

Permalink
Change phpstan workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mckenziearts committed Feb 26, 2024
1 parent 545ece8 commit e21f134
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
52 changes: 29 additions & 23 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
name: phpstan
name: "phpstan Static Analysis"

on:
push:
pull_request:

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
3 changes: 1 addition & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
includes:
- ./vendor/larastan/larastan/extension.neon
- ./vendor/nunomaduro/larastan/extension.neon

parameters:
level: 5
Expand All @@ -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

0 comments on commit e21f134

Please sign in to comment.