Skip to content

WPCS-modernize the relocated inc/ files and drop their PHPCS exclusions #1066

Description

@donnchawp

This issue was generated by AI.

Follow-up to #1061 (split wp-cache.php into inc/ files, PR #1065 / ADR-0001).

Background

The split relocated legacy procedural clusters verbatim (pure move, no behaviour change). Each relocated file carries pre-existing WPCS debt — loose comparisons (==/!=), non-strict in_array/array_search, missing escaping, legacy spacing, etc. To keep the move behaviour-preserving and the PR lint-clean, those files are excluded from PHPCS in .phpcs.xml.dist:

  • inc/plugins-cookies.php
  • inc/cache-files.php
  • inc/htaccess.php
  • inc/settings-forms.php
  • inc/preload.php
  • inc/lifecycle.php
  • inc/admin-notices.php
  • inc/admin-ui.php

(inc/boost.php and newly authored files are not excluded and stay fully linted.)

Goal

Modernize each excluded file to satisfy the repo's .phpcs.xml.dist standard, then remove its exclude-pattern so it is linted again.

Constraints

  • Behaviour-preserving. Several flagged rules are not cosmetic — =====, non-strict in_array/array_search, and @-silencing changes can alter behaviour. Verify each change against the test net (composer test-php, make test-integration, composer test-e2e) rather than blanket-applying phpcbf.
  • Do it one file per PR/commit so each is reviewable and revertable, and so the changed-lines linter stays manageable.
  • Note: full-file phpcs on these big procedural files aborts on a pre-existing PHPCompatibility Internal.Exception; run it with php -d error_reporting='E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED' to get the sniff list (see how Refactor: split wp-cache.php into per-responsibility inc/ files (pure move, test-net first) #1061 surfaced them).

Out of scope

Global-state reduction / class extraction (that's the deeper follow-up, e.g. turning inc/preload.php into the #1047 item-5 preload state machine). This issue is WPCS cleanup only.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions