Skip to content

Update PHPStan command in composer.json to use configuration file #9

Update PHPStan command in composer.json to use configuration file

Update PHPStan command in composer.json to use configuration file #9

Workflow file for this run

name: Lint and Test
on:
push:
branches: [ main, master, development ]
pull_request:
branches: [ main, master, development ]
jobs:
lint:
name: Lint & Static Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
tools: composer:v2, phpstan, phpcs
extensions: dom, mbstring, intl, json, xml, curl
- name: Validate composer.json
run: composer validate --strict
- name: Install dependencies (with cache)
uses: ramsey/composer-install@v3
with:
composer-options: --no-interaction --prefer-dist --no-progress
- name: PHPCS (PSR-12)
run: composer run lint
- name: Detect style drift (fail if auto-fixes needed)
shell: bash
run: |
# Run phpcbf to apply auto-fixes into the working tree
vendor/bin/phpcbf --standard=phpcs.xml --no-patch || true
# Fail if any changes were made by phpcbf (style drift)
git --no-pager diff --name-only --exit-code || { echo "::error ::Style drift detected. Please run phpcbf locally."; exit 1; }
- name: PHPStan (max level)
run: composer run stan
test:
name: PHPUnit (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: composer:v2
extensions: dom, mbstring, intl, json, xml, curl
- name: Install dependencies (with cache)
uses: ramsey/composer-install@v3
with:
composer-options: --no-interaction --prefer-dist --no-progress
- name: Run tests
run: composer run test