Skip to content

Update wp-coding-standards/wpcs to 3.4.1 - #859

Merged
MaggieCabrera merged 2 commits into
WordPress:trunkfrom
obenland:update/wpcs-3.4.1
Jul 28, 2026
Merged

Update wp-coding-standards/wpcs to 3.4.1#859
MaggieCabrera merged 2 commits into
WordPress:trunkfrom
obenland:update/wpcs-3.4.1

Conversation

@obenland

Copy link
Copy Markdown
Member

Migrates off the WPCS 2.x pin. Since this repo's CI runs a full phpcs scan and the ruleset referenced sniffs removed in WPCS 3.0, this PR is more than a version bump:

What changed

  • Bumps wp-coding-standards/wpcs from ^2.2 to ^3.4.1 and regenerates composer.lock.
  • Replaces sniffs removed in WPCS 3.0 with their upstreamed PHPCS equivalents: WordPress.CodeAnalysis.EmptyStatementGeneric.CodeAnalysis.EmptyPHPStatement, and WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileConditionGeneric.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition. With the old references, phpcs 3.x refuses to run entirely.
  • Fixes the violations newly surfaced by WPCS 3.x so lint:php stays green: phpcbf formatting fixes (47 violations — spacing, dirname() modernization, require brackets) and explicit public visibility on 19 methods (behavior-neutral; public is PHP's default).
  • Silences Universal.NamingConventions.NoReservedKeywordParameterNames (7 warnings): the fix would rename parameters like $string, which risks breaking callers using PHP 8 named arguments — a judgment call left to maintainers.

Verification: full phpcs scan is clean (0 errors, 0 warnings), matching the pre-update baseline.

Part of an org-wide sweep to get all repos onto WPCS 3.4.1.

🤖 Generated with Claude Code

- Bump the constraint from ^2.2 to ^3.4.1 and regenerate composer.lock.
- Replace sniffs removed in WPCS 3.0 with their upstreamed PHPCS
  equivalents: WordPress.CodeAnalysis.EmptyStatement ->
  Generic.CodeAnalysis.EmptyPHPStatement, and
  WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition ->
  Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition.
- Fix new violations surfaced by WPCS 3.x: phpcbf formatting fixes and
  explicit public visibility on 19 methods.
- Silence Universal.NamingConventions.NoReservedKeywordParameterNames:
  renaming parameters risks breaking PHP 8 named-argument callers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 27, 2026 19:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@obenland

Copy link
Copy Markdown
Member Author

@MaggieCabrera @bph Could I ask for your help with merging this? I don't seem to have access. Thanks!

@MaggieCabrera MaggieCabrera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me, thanks for the change! I thought I could add people to this repo for this but apparently I can't, sorry!

@obenland

Copy link
Copy Markdown
Member Author

@MaggieCabrera Could you merge the PR?

@MaggieCabrera
MaggieCabrera merged commit 5524f19 into WordPress:trunk Jul 28, 2026
13 checks passed
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.

3 participants