Repository navigation
Treat the register_setting option group as a read - #164
Merged
Merged
Conversation
schlessera
added a commit
to mwpd/content-freshness
that referenced
this pull request
Oct 23, 2026
Ported from mwpd/basic-scaffold@fd25d8a (mwpd/basic-scaffold#164). The plugin had made the same change; the scaffold's version replaces it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #158
What changed
The
architecture.prefixedNamesrule now treats the option group ofregister_setting()(1st argument) as a read: it passes when it carries the prefix or is listed insettings.allowed. The option name (2nd argument) is still a write and always needs the prefix.phpstan.neon.distallows the five core settings groups (general,writing,reading,discussion,media), so a plugin can add a field to a core settings page without weakening the check. The docs table row and Allows paragraph describe the split.Why this shape
The third element of a
FUNCTIONSentry is now either the existing boolean or a list of the positions that only read. That keeps the table in one place and leaves every other entry untouched. Allowing the groups throughmanagedwas the alternative; it would exempt both positions, so an option literally namedreadingwould pass.Proof
The new fixture lines (
Registrations.php:44-47) and thesettings.allowed: [ 'reading' ]test config were added first. Before the rule change the test failed:readingwas reported as an unprefixed setting name at line 44, and the expected reports for lines 45 to 47 were wrong (the option group was reported where it should not be). After the change:register_setting( 'reading', 'acme_plugin_max_age' )passes.register_setting( 'reading', 'max_age' )reports the namemax_age.register_setting( 'discussion', 'acme_plugin_max_age' )reports the groupdiscussion.register_setting( 'reading', 'reading' )reports the namereading.Checklist
composer testandcomposer lintpass locally, and CI is green on the current head.breakingand a ruling.Anything left open
Nothing. Note that the issue's
file:linecitations had drifted slightly after #157 (themanagedcheck is atPrefixedNamesRule.php:446, the table row atdocs/architecture-rules.md:1124); they still pointed at the right code.