Repository navigation
Give consumer-a the template's footprint, loader and definitions - #60
Merged
Merged
Conversation
Convention 2 spelled every definition as static fn ( ContainerInterface $c ), so consumer-a, consumer-b and the core persona declared $c in six closures that never read it. Under the production PHPCS profile each one is a Generic.CodeAnalysis.UnusedFunctionParameter warning, which fails the run: the plugin template, built from consumer-a's anatomy, reported four of them, while the fixtures passed only because they sit under the tests profile, which excludes the sniff. PHP-DI calls a factory with the container whether or not it declares the parameter, and PHP ignores extra arguments to a closure. The six closures take no parameter, their docblocks return \Closure(): object, and core's README excerpt follows its persona. Convention 2 now reads that definitions are static closures, taking ContainerInterface $c only when they read the container, or autowiring. Assisted-by: Claude Code:claude-opus-5-5
consumer-a declared its footprint as Plugin::FOOTPRINT, which put uninstall data in the composition root, and its one option prefix missed part of what its own roots store: the transients PluginBoot records boot failures in, AdminNotices' user options and network-wide user meta, and, on a network, its network notices option. A consenting uninstall therefore kept those rows, and the plugin template, which takes consumer-a's anatomy, would have copied the gap. The footprint is now Footprint::DATA in src/Footprint.php, beside Migrations::STEPS, and covers those kinds through the transient variants of the prefix, the site and global user meta prefixes and the network notices option. The consenting uninstall row seeds and checks one row of each, and the rows for an engine that cannot run gain a build without src/Footprint.php. Assisted-by: Claude Code:claude-opus-5-5
The plugin template's functions.php requires every includes/*.php in name order and skips names that start with an underscore, so a plugin can park a file there without loading it; consumer-a, the anatomy the template follows, loaded only safeguards.php, from its entry. consumer-a's functions.php now runs the same loader, throwing when the directory cannot be read so the entry's build-error handling reports it, and ships includes/_unloaded.php, whose function the boot row asserts is never defined. Assisted-by: Claude Code:claude-opus-5-5
The docblock said the footprint covers every transient the plugin and
its framework components write, but the bootstrap updater caches its
releases under the text domain, in {slug}_github_release_{channel},
which expires on its own and which the footprint leaves out on
purpose.
The docblock now names what the footprint covers: the plugin's data
under its prefix.
Assisted-by: Claude Code:claude-opus-5-5
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.
Summary. The plugin template now copies consumer-a's anatomy, and three of consumer-a's shapes did not survive the copy: its definitions declared a container parameter they never read, which the production PHPCS profile reports, its footprint sat in the composition root and missed part of what its own framework roots store, and it had no loader for
includes/. consumer-a and the definitions in consumer-b, the core persona and core's README now match the template.ContainerInterface $conly when it reads the container. PHP-DI passes the container either way.Footprint::DATAinsrc/Footprint.phpreplacesPlugin::FOOTPRINTand adds the transientsPluginBootrecords boot failures in,AdminNotices' user options and network-wide user meta, and its network notices option on a network.functions.phprequires everyincludes/*.phpin name order, skipping names that start with an underscore, and throws when the directory cannot be read, so the entry reports an incomplete build.Fixtures +94 −29 (7 files), tests +16 (3 files), core README +1 −2, AGENTS.md +1 −1.
Review points.
includes/_unloaded.phpexists only so the boot row can see the underscore skip.Testing.
composer quality-checkpasses: validate, changelog validation, PHPCS on both profiles, the four PHPStan profiles and the seven fixtures' PHPStan, Unit 189 and Integration 1333.composer test:integration:multisitepasses: 40.composer test:integration:lowestpasses: 33.composer test:integration:php74passes: 2.src/Footprint.php; hand mutants (a footprint kind removed, a loader without the underscore skip) fail them.