Skip to content

Upgrade WPCS to 3.4.1 and PHPCS to 3.13 - #11

Merged
roborourke merged 4 commits into
mainfrom
deps/upgrade-wpcs
Sep 1, 2026
Merged

Upgrade WPCS to 3.4.1 and PHPCS to 3.13#11
roborourke merged 4 commits into
mainfrom
deps/upgrade-wpcs

Conversation

@roborourke

Copy link
Copy Markdown
Collaborator

Upgrades dev tooling to clear the Composer security advisory that currently blocks every CI job.

Changes

  • wp-coding-standards/wpcs: ^2.1.1^3.4.1 (fixes CVE-2026-45293, arbitrary code execution via eval() in the EnqueuedResourceParameters sniff)
  • squizlabs/php_codesniffer: ^3.3.1^3.13.1 (required by WPCS 3)
  • yoast/phpunit-polyfills: ^1.1 || ^2.0^2.0
  • Drop PHP 7.4 from the CI matrix (WPCS 3.4 requires PHP >= 8.0)
  • Update .phpcs.xml.dist for WPCS 3: short-array sniff moved Generic.Arrays.DisallowShortArraySyntaxUniversal.Arrays.DisallowShortArraySyntax
  • Fix sniffs newly surfaced by WPCS 3: elseif in class-base.php, __DIR__ in admin/namespace.php, class closing brace in class-implicit.php
  • Keep composer.lock gitignored (plugin project; lockfiles not committed)

Validation

  • vendor/bin/phpcs: 0 errors (2 pre-existing warnings, unchanged behavior)
  • PHPUnit: 100 tests, 240 assertions OK (WP 7.0 / PHP 8.3)

roborourke and others added 4 commits September 1, 2026 14:26
WPCS 2.x is affected by CVE-2026-45293 (arbitrary code execution via
eval() in the EnqueuedResourceParameters sniff). Upgrade to the fixed
3.4.1 release, which requires PHPCS >= 3.13 and PHP >= 8.0, so drop
PHP 7.4 from the CI matrix.

WPCS 3 moves the short-array sniff from Generic to Universal, so update
the ruleset exclusion, and fix the new sniff violations surfaced by the
upgraded standard (elseif, __DIR__, class closing brace).

Composer lockfiles are not committed for composer/installers plugin
projects; composer.lock stays gitignored.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
WPCS 3.4.1 pulls in phpcsstandards/phpcsextra and phpcsstandards/phpcsutils
as dependencies for its Universal, NormalizedArrays, Modernize, and
PHPCSUtils sniffs. The post-install-cmd/post-update-cmd scripts hardcoded
PHPCS's installed_paths to only vendor/wp-coding-standards/wpcs, which
overwrote the paths that dealerdirect/phpcodesniffer-composer-installer
already auto-configures for every installed standard, so those sniffs
could not be found and phpcs exited with code 3 in CI.

Removing the scripts lets the installer plugin's auto-configuration take
over, which includes all installed standards' paths.
WPCS 3.4.1 adds the Universal.NamingConventions.NoReservedKeywordParameterNames
sniff, which flags $default in Access_Token::get_meta() since `default` is a
reserved keyword. Renamed to $default_value.

Also removed the unused $args parameter from Authorization_Code::validate() —
Generic.CodeAnalysis.UnusedFunctionParameter flagged it, and grepping the
codebase confirms no interface or caller relies on it.

phpcs now exits 0 instead of 1, which was failing CI even though these were
only warnings, not errors.
GitHub Actions runners now log a deprecation warning on every job because
actions/checkout@v4 and actions/cache@v4 still target Node 20, which
GitHub is retiring. Bumping to actions/checkout@v7 and actions/cache@v6
(both node24) removes the warning; no config changes were needed for
either action.
@roborourke
roborourke merged commit bb3010c into main Sep 1, 2026
21 checks passed
@roborourke
roborourke deleted the deps/upgrade-wpcs branch September 1, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant