From d82fcbdc9910d27ec4545c49a610e0b6500f56e0 Mon Sep 17 00:00:00 2001 From: Matthew Batchelder Date: Mon, 14 Jul 2025 18:27:03 -0400 Subject: [PATCH 1/2] Add PHP lint workflow Adds GitHub Actions workflow to validate PHP syntax across all PHP files in the repository. The workflow runs on push and pull requests, checking PHP 7.4 and 8.0 compatibility. --- .github/workflows/php-lint.yml | 59 ++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/php-lint.yml diff --git a/.github/workflows/php-lint.yml b/.github/workflows/php-lint.yml new file mode 100644 index 0000000..bff17b1 --- /dev/null +++ b/.github/workflows/php-lint.yml @@ -0,0 +1,59 @@ +name: PHP Code Linting + +on: + push: + branches: + - trunk + - 'feature/**' + - 'release/**' + # Only run if PHP-related files changed. + paths: + - '.github/workflows/php-lint.yml' + - '**.php' + - 'phpcs.xml.dist' + - 'phpstan.neon.dist' + - 'composer.json' + - 'composer.lock' + pull_request: + # Only run if PHP-related files changed. + paths: + - '.github/workflows/php-lint.yml' + - '**.php' + - 'phpcs.xml.dist' + - 'phpstan.neon.dist' + - 'composer.json' + - 'composer.lock' + types: + - opened + - reopened + - synchronize + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + php-lint: + name: PHP + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: 'latest' + + - name: Validate Composer configuration + run: composer validate + + - name: Install PHP dependencies + uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 + with: + composer-options: '--prefer-dist' + + - name: PHPStan + run: composer phpstan + + - name: PHP Code Sniffer + run: composer phpcs From d33b5ede23e26f9f76ca6230b12b35f3002b6b31 Mon Sep 17 00:00:00 2001 From: Matthew Batchelder Date: Tue, 15 Jul 2025 11:38:01 -0400 Subject: [PATCH 2/2] Update composer-install version to v3 --- .github/workflows/php-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php-lint.yml b/.github/workflows/php-lint.yml index bff17b1..4074ede 100644 --- a/.github/workflows/php-lint.yml +++ b/.github/workflows/php-lint.yml @@ -48,7 +48,7 @@ jobs: run: composer validate - name: Install PHP dependencies - uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 + uses: ramsey/composer-install@v3 with: composer-options: '--prefer-dist'