Skip to content

Keep consumer-a's hook-free code in includes, as the template does - #61

Merged
ahegyes merged 2 commits into
trunkfrom
refactor/hook-free-includes
Oct 28, 2026
Merged

ahegyes merged 2 commits into
trunkfrom
refactor/hook-free-includes

Conversation

@ahegyes

@ahegyes ahegyes commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Summary. The plugin template now keeps src/ for its composition root and components and puts the code that registers no hooks in includes/. consumer-a, the anatomy the template adopts, still kept its footprint and migration steps as final classes in src/, and conventions 6 and 8 still described an Options class and final-class helpers. consumer-a and both conventions now match the template.

  • consumer-a: acme_ca_get_footprint() in includes/footprint.php and acme_ca_get_migration_steps() with its step in includes/migrations.php replace Footprint::DATA and Migrations::STEPS; uninstall.php requires the footprint by path, and both files parse on PHP 7.4.
  • Conventions: convention 6 says src/ holds a plugin's composition root and components, and hook-free code is prefixed functions and constants in includes/; convention 8 names the plugin's prefixed option constants and its text reader.

Fixtures +80 −111 (6 files), tests +1 −1, AGENTS.md +2 −2.

Review points.

  • The footprint function's @return shape keeps PHPStan's check of the footprint, which a required array file would lose.
  • The core persona and core's README excerpt keep Migrations::STEPS: a persona shows the package's API, not the plugin anatomy.

Testing.

  • composer quality-check passes: validate, changelog validation, PHPCS on both profiles, the PHPStan profiles and every fixture's, Unit 189 and Integration 1333.
  • composer test:integration:multisite passes: 40. composer test:integration:lowest passes: 33.
  • The uninstall row for an engine that cannot run removes includes/footprint.php; hand mutants (a footprint kind removed, the footprint's require dropped) fail the build or a row.

consumer-a kept its footprint and migration steps as final classes in
src/, beside its composition root and components, though neither
registers a hook or joins the component tree. The template now keeps src/
for that tree alone and puts such code in includes/, and consumer-a is
the anatomy the template adopts, so the two would drift apart.

Footprint and Migrations become includes/footprint.php and
includes/migrations.php, a typed footprint function and the step list
with its step, which the includes loader requires. uninstall.php
requires the footprint by path, and the uninstall row that removes the
footprint now removes that file. Both files parse on PHP 7.4, which the
consumer-a syntax job checks.

Assisted-by: Claude Code:claude-opus-5-5
Convention 6 put the logic that global functions or templates need in
static methods of final classes, and convention 8 named an Options class
and its text() method, while the template and consumer-a now keep src/
for the composition root and its components and put option keys and
readers, the footprint, migration steps and asset registrars in
includes/.

Convention 6 states that layout, and convention 8 names the plugin's
prefixed option constants and its text reader. The rule that packages
ship no free functions is unchanged.

Assisted-by: Claude Code:claude-opus-5-5
@ahegyes ahegyes changed the title Refactor/hook free includes Keep consumer-a's hook-free code in includes, as the template does Oct 28, 2026
@ahegyes
ahegyes merged commit af4c428 into trunk Oct 28, 2026
23 checks passed
@ahegyes
ahegyes deleted the refactor/hook-free-includes branch October 28, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant