Automattic / Automattic/wp-super-cache

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

Open
#1,066 0 comments 0 reactions 0 assignees View on GitHub
enhancement needs-triage
Dominant language
PHP
Stars
436
Forks
130
Avg merge
15h 11m
Merged PRs (30d)
10

Description

> *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 #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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the eight excluded paths in .phpcs.xml.dist and inspect one relocated inc/ file at a time. Run PHPCS with the specified PHP error_reporting setting, then verify behavior with composer test-php, make test-integration, and composer test-e2e. Done means the selected file satisfies the repository standard and its exclude-pattern is removed without behavior changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.