[wp-trac] [WordPress Trac] #64627: Coding Standards: Remove or update stale PHPCS annotations

WordPress Trac noreply at wordpress.org
Wed Feb 11 19:32:32 UTC 2026


#64627: Coding Standards: Remove or update stale PHPCS annotations
------------------------------+-----------------------------
 Reporter:  rodrigosprimo     |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 The WordPress Core codebase contains a number of stale inline PHPCS
 annotations (`phpcs:ignore`, `phpcs:disable`) that are no longer
 necessary. I would like to suggest updating or removing them depending on
 the case.

 They fall into several categories:

 === Annotations with outdated error codes ===

 In `schema.php` and `ms-site.php`, the `phpcs:ignore` annotations
 reference `WordPress.DB.PreparedSQL.NotPrepared`, but the actual violation
 is `WordPress.DB.PreparedSQL.InterpolatedNotPrepared`. The error code was
 split in WPCS 2.0.0 (see [https://github.com/WordPress/WordPress-Coding-
 Standards/pull/1601 WordPress/WordPress-Coding-Standards#1601]).

 === Annotations for sniffs that no longer flag the code ===

 In `deprecated.php`, the
 `PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore`
 annotations on `__ngettext()` and `__ngettext_noop()` are no longer
 needed. Since PHPCompatibility 9.3.2 (see
 [https://github.com/PHPCompatibility/PHPCompatibility/pull/917
 PHPCompatibility/PHPCompatibility#917]), the sniff skips functions with a
 `@deprecated` docblock tag.

 In `class-twentytwenty-svg-icons.php`, the
 `WordPress.WP.CapitalPDangit.Misspelled` annotation on the `'wordpress'`
 array key is unnecessary because the `CapitalPDangit` sniff skips array
 definitions by design.

 === Annotations for standards not installed in this repository ===

 Three `WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound`
 annotations in Twenty Twenty-One and one
 `VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable` annotation
 in `WP_REST_Font_Collections_Controller` reference standards that are not
 installed. These were likely carried over from upstream repositories.

 === Legacy annotation format no longer recognized by PHPCS ===

 Two `// WPCS: XSS OK.` comments in Twenty Nineteen use a legacy annotation
 format that was deprecated in WPCS 2.0.0 ([https://github.com/WordPress
 /WordPress-Coding-Standards/pull/1580 WordPress/WordPress-Coding-
 Standards#1580]) and removed in WPCS 3.0.0 ([https://github.com/WordPress
 /WordPress-Coding-Standards/pull/1908 WordPress/WordPress-Coding-
 Standards#1908]).

 === Annotations for sniffs not checked in this repository ===

 About 30 annotations across multiple files reference sniffs from the
 `WordPress-Extra` standard (`EscapeOutput`, `NonceVerification`,
 `AlternativeFunctions`, `DevelopmentFunctions`, `IniSet`), which is not
 included in the `phpcs.xml.dist` configuration (the repository uses
 `WordPress-Core`).

 === Expected impact ===

 Running `composer lint` after applying the changes suggested here produces
 two fewer warnings compared to `trunk`: the
 `WordPress.DB.PreparedSQL.InterpolatedNotPrepared` warnings in
 `schema.php` and `ms-site.php` are now properly suppressed by the
 corrected annotations. The remaining changes have no effect on the output
 of `composer lint` or `composer compat`, as all other removed annotations
 were already ineffective.

 Related: #42808.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64627>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list