diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml
index 597b563a..2952a43c 100644
--- a/.github/workflows/linting.yml
+++ b/.github/workflows/linting.yml
@@ -11,10 +11,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
tools: composer
coverage: none
- run: composer install --no-progress
- - run: vendor/bin/phpcs
+ - name: Run PHPCS (changed lines only)
+ run: |
+ if [ "${{ github.event_name }}" = "pull_request" ]; then
+ vendor/bin/phpcs-changed --git --git-base "${{ github.event.pull_request.base.sha }}"
+ else
+ vendor/bin/phpcs-changed --git --git-base "${{ github.event.before }}"
+ fi
diff --git a/.github/workflows/php-tests.yml b/.github/workflows/php-tests.yml
index e867f532..566d4bdb 100644
--- a/.github/workflows/php-tests.yml
+++ b/.github/workflows/php-tests.yml
@@ -20,5 +20,13 @@ jobs:
php-version: ${{ matrix.php }}
tools: composer
coverage: none
- - run: composer install --no-progress
+ - name: Install dependencies
+ run: |
+ if composer install --no-progress 2>&1; then
+ echo "Updating PHPUnit for best match with PHP ${{ matrix.php }}"
+ composer update -W --no-progress phpunit/phpunit
+ else
+ echo "Platform reqs failed, running composer update for dev dependencies"
+ composer update --no-progress
+ fi
- run: composer test-php
diff --git a/composer.json b/composer.json
index eff97a25..61cb24cf 100644
--- a/composer.json
+++ b/composer.json
@@ -10,7 +10,8 @@
"phan/phan": "^5.4",
"php-stubs/wordpress-stubs": "^6.8",
"php-stubs/wp-cli-stubs": "^2.10",
- "automattic/jetpack-codesniffer": "^4.0"
+ "automattic/jetpack-codesniffer": "^4.0",
+ "sirbrillig/phpcs-changed": "^2.11"
},
"autoload": {
"classmap": [
diff --git a/composer.lock b/composer.lock
index a6a6168d..ad986d85 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "a6fface6fb590b5fded7689dda4fb74e",
+ "content-hash": "42809df693a35c59c13127d0c2e03c79",
"packages": [],
"packages-dev": [
{
@@ -3390,6 +3390,60 @@
],
"time": "2025-02-07T05:00:38+00:00"
},
+ {
+ "name": "sirbrillig/phpcs-changed",
+ "version": "v2.12.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sirbrillig/phpcs-changed.git",
+ "reference": "5c9f6b2972166f0d5e2135fd3549c973aaecc099"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sirbrillig/phpcs-changed/zipball/5c9f6b2972166f0d5e2135fd3549c973aaecc099",
+ "reference": "5c9f6b2972166f0d5e2135fd3549c973aaecc099",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1 || ^1.0.0",
+ "phpunit/phpunit": "^6.4 || ^7.0 || ^8.0 || ^9.5",
+ "sirbrillig/phpcs-variable-analysis": "^2.1.3",
+ "squizlabs/php_codesniffer": "^3.2.1",
+ "vimeo/psalm": "^4.24 || ^5.0 || ^6.0"
+ },
+ "bin": [
+ "bin/phpcs-changed"
+ ],
+ "type": "library",
+ "autoload": {
+ "files": [
+ "PhpcsChanged/Cli.php",
+ "PhpcsChanged/functions.php"
+ ],
+ "psr-4": {
+ "PhpcsChanged\\": "PhpcsChanged/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Payton Swick",
+ "email": "payton@foolord.com"
+ }
+ ],
+ "description": "Run phpcs on files, but only report warnings/errors from lines which were changed.",
+ "support": {
+ "issues": "https://github.com/sirbrillig/phpcs-changed/issues",
+ "source": "https://github.com/sirbrillig/phpcs-changed/tree/v2.12.0"
+ },
+ "time": "2025-11-08T22:27:25+00:00"
+ },
{
"name": "sirbrillig/phpcs-variable-analysis",
"version": "v2.13.0",
diff --git a/phpunit.11.xml.dist b/phpunit.11.xml.dist
new file mode 100644
index 00000000..b227c998
--- /dev/null
+++ b/phpunit.11.xml.dist
@@ -0,0 +1,26 @@
+
+
+
+
+ tests/php
+
+
+
diff --git a/phpunit.12.xml.dist b/phpunit.12.xml.dist
new file mode 100644
index 00000000..b227c998
--- /dev/null
+++ b/phpunit.12.xml.dist
@@ -0,0 +1,26 @@
+
+
+
+
+ tests/php
+
+
+
diff --git a/readme.txt b/readme.txt
index c9bc7c55..bd7abbbe 100644
--- a/readme.txt
+++ b/readme.txt
@@ -2,7 +2,7 @@
Contributors: donncha, automattic, adnan007, dilirity, mikemayhem3030, pyronaur, thingalon
Tags: performance, caching, wp-cache, wp-super-cache, cache
Requires at least: 6.8
-Requires PHP: 7.2
+Requires PHP: 7.4
Tested up to: 6.9
Stable tag: 3.0.3
License: GPLv2 or later