Repository navigation
Conversation
Add a `phpcs` job to the Unit Tests workflow that installs the locked Composer dependencies on the runner and runs PHPCS, reporting violations as annotations with `cs2pr`. The locked `composer/installers` and `dealerdirect/phpcodesniffer-composer-installer` releases only support Composer 1 and PHP 7 or older, so the job uses Composer 1. It runs on PHP 7.3 because on PHP 7.4 the locked WPCS 2.1.1 raises notices that abort the scan. Also add a PHPCS scan cache in `.cache/phpcs.json`, cached between runs and reset weekly, as trunk does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013wZdkg9DSpSbQmRpBymFfV
desrosj
force-pushed
the
fix-actions-5.3/run-phpcs-on-runner
branch
from
October 21, 2026 02:05
48a5192 to
5d61648
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Adds a
phpcsjob tounit-test.ymlthat runs PHP coding standards checks on the runner and reports violations as annotations withcs2pr. The.cache/.gitkeep,.gitignoreandphpcs.xml.distchanges add the PHPCS scan cache. The job getstimeout-minutes: 20, like the PHP unit test job.Why?
The unit test workflow added in #745 doesn't check coding standards: its parity table lists
npm run lint-phpas not ported, because the locked PHPCS installers only support Composer 1. This PR adds that check.How?
Ports the
phpcsjob from WordPress#46510 (WordPress@9ee17a7), followingwp/5.5's WordPress#85003, including its weekly-reset scan cache.Unlike
wp/5.5, this branch'scomposer.lockpinscomposer/installers1.6.0anddealerdirect/phpcodesniffer-composer-installer0.5.0, which require Composer 1 and PHP 7 or older. The job installs Composer 1 withsetup-phpand runs on PHP7.3: on PHP7.4, the locked WPCS2.1.1raises notices (Trying to access array offset on value of type boolinWordPress/Sniff.php) thatsetup-php'sE_ALLerror reporting turns into scan-aborting errors. ThetestVersioninphpcs.xml.diststill checks compatibility with the PHP versions WordPress 5.3 supports. It runsphpcswithout--runtime-set ignore_warnings_on_exit 1, as this branch'scomposer run-script lintdoes.package.jsonis unchanged:npm run test-phpstill runslint-php, and the PHP unit test job keeps callingnpm run test-unit-phpdirectly.Testing Instructions
actionlintpasses. Locally, in thecomposer:1.9Docker image (Composer1.9.3), and again on PHP7.3with-d error_reporting=-1,composer installinstalls the lock andphpcs --report-full --report-checkstyle=./.cache/phpcs-report.xmlpasses on all 65 files. A second run reuses.cache/phpcs.jsonand finishes in under a second, and an added violation makesphpcsexit with an error and appear in the checkstyle report. Check that thePHP coding standardsjob passes on this PR.Use of AI Tools
This PR was created by Claude Code under my supervision. All code should be treated as AI-produced and not yet reviewed by a human until this PR is marked Ready for Review.
🤖 Generated with Claude Code
https://claude.ai/code/session_013wZdkg9DSpSbQmRpBymFfV