Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 12 additions & 24 deletions .github/workflows/phpstan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,33 @@ on:
jobs:
phpstan:
runs-on: ubuntu-latest
# define every php version to test
strategy:
# do not stop at first fail
fail-fast: false
matrix:
php: [7.4, 8.2]

steps:
- uses: actions/checkout@v4

- name: Setup PHP 7.4 for dependencies
- name: Setup PHP ${{ matrix.php }} for dependencies
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: ${{ matrix.php }}

- name: Install Dependencies
run: composer update --ignore-platform-reqs

- name: Setup PHP 8.2 for PHPStan
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

- name: Restore PHPStan cache
id: cache-phpstan
uses: actions/cache/restore@v3
with:
path: phpstan.phar
key: phpstan-1

- name: Download PHPStan
if: steps.cache-phpstan.outputs.cache-hit != 'true'
run: wget https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar

- name: Run PHPStan
run: php phpstan.phar analyse --configuration phpstan.neon
run: vendor/bin/phpstan analyse --configuration phpstan.neon

update-baseline:
needs: phpstan
Expand All @@ -50,9 +48,7 @@ jobs:

- name: Delete existing branch if exists
run: |
if git ls-remote --heads origin update-phpstan-baseline | grep update-phpstan-baseline; then
git push origin --delete update-phpstan-baseline
fi
git ls-remote --exit-code --heads origin update-phpstan-baseline && git push origin --delete update-phpstan-baseline

- name: Setup PHP 7.4 for dependencies
uses: shivammathur/setup-php@v2
Expand All @@ -62,19 +58,11 @@ jobs:
- name: Install Dependencies
run: composer update --ignore-platform-reqs

- name: Setup PHP 8.2 for PHPStan
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

- name: Download PHPStan
run: wget https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar

- name: Generate new baseline
id: generate-baseline
run: |
cp phpstan-baseline.neon phpstan-baseline.neon.old
php phpstan.phar analyse --configuration phpstan.neon --generate-baseline
vendor/bin/phpstan analyse --configuration phpstan.neon --generate-baseline
if ! diff -q phpstan-baseline.neon phpstan-baseline.neon.old > /dev/null; then
echo "baseline_changed=true" >> $GITHUB_OUTPUT
fi
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
"platform": {
"php": "7.4"
}
},
"require-dev": {
"phpstan/phpstan": "^2.1"
}
}
Loading