Make WordPress Core

Opened 4 months ago

Closed 3 months ago

Last modified 3 months ago

#53477 closed task (blessed) (fixed)

Composer: update PHP_CodeSniffer

Reported by: jrf Owned by: SergeyBiryukov
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: commit has-patch
Focuses: coding-standards Cc:


The latest PHP_CodeSniffer release is 3.6.0 from April this year.

Based on the composer.lock file, however, WP is still using PHPCS 3.5.5 (April 2020).

I'd like to recommend an update as the releases since PHPCS 3.5.5 contain various bugfixes which may benefit WP, as well as (nearly complete) support for everything PHP 8.0, though, for now, I'd still recommend running PHPCS on PHP 7.4 in CI.

Relevant changelogs:

To update, a patch is needed which:

  1. Updates the composer.json and composer.lock files.
  2. Verifies whether any exclusions made in the custom ruleset which were related to PHPCS bugs can be removed (and if applicable, removes them).
  3. Verifies whether any inline phpcs:ignore annotations which were related to PHPCS bugs can be removed (and if applicable, removes them).
  4. If necessary, selectively fixes newly flagged errors, which can happen when a "false negative" bug in PHPCS has been fixed.

Attachments (1)

53477.patch (2.2 KB) - added by jrf 3 months ago.
Update PHPCS to version 3.6.0, no new violations flagged.

Download all attachments as: .zip

Change History (7)

3 months ago

Update PHPCS to version 3.6.0, no new violations flagged.

#1 @jrf
3 months ago

  • Keywords commit has-patch added; needs-patch removed

All four tasks have been executed and only the composer.lock file needs an update.
See GH PR https://github.com/WordPress/wordpress-develop/pull/1510 for a passing build.

I did come across a few stray ignore annotations during the review, but those were not related to the PHPCS update, so the patches for those have been added to the WP 5.9 CS ticket #53359.

This ticket was mentioned in PR #1510 on WordPress/wordpress-develop by jrfnl.

3 months ago

Update the PHP_CodeSniffer dependency from version 3.5.5 to version 3.6.0.

Trac ticket: https://core.trac.wordpress.org/ticket/53477

I have also verified the ignore annotations, but no changes are needed there which are directly related to the PHPCS update. Changes which could be made have been added to #53359.

#3 @SergeyBiryukov
3 months ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#4 @SergeyBiryukov
3 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 51470:

Build/Test Tools: Update PHP_CodeSniffer to version 3.6.0.

The latest releases contain various bugfixes, as well as (nearly complete) support for PHP 8.0.

Relevant changelogs:

For a full list of changes in this update, see the PHP_CodeSniffer GitHub:

Props jrf.
Fixes #53477.

#5 @prbot
3 months ago

jrfnl commented on PR #1510:

Closing as merged via changeset https://core.trac.wordpress.org/changeset/51470

This ticket was mentioned in Slack in #core by sergey. View the logs.

3 months ago

Note: See TracTickets for help on using tickets.