Skip to content

Modernize PHP test matrix, update PHPStan for 8.2+ compatibility #305

Modernize PHP test matrix, update PHPStan for 8.2+ compatibility

Modernize PHP test matrix, update PHPStan for 8.2+ compatibility #305

Workflow file for this run

name: PHP Standards
on:
push:
branches:
- 'develop'
- 'main'
pull_request:
branches:
- '**'
jobs:
build:
name: PHP Coding Standards
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
php-version: '8.2'
coverage: none
- name: Debugging
run: |
php --version
php -m
composer --version
- name: Get Composer Cache Directory
id: composer-cache-dir
run: |
echo "DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache PHP Dependencies
id: composer-cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ steps.composer-cache-dir.outputs.DIR }}
key: ${{ runner.os }}-composer-8.2-${{ hashFiles('composer.lock') }}
- name: Install PHP Dependencies
run: |
composer install --prefer-dist --no-progress --no-suggest --no-interaction
- name: PHPCS cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: tests/cache
key: ${{ runner.os }}-phpcs-8.2-${{ hashFiles('plugin.php') }}
- name: Run the tests
run: |
composer test:phpcs
composer test:phpstan
env:
MYSQL_DATABASE: wordpress
WP_TESTS_DB_PASS: root