Skip to content

14. Name the member every report is made from - #76

Open
nikolaystrikhar wants to merge 1 commit into
47-lifecycle-actionsfrom
62-one-shape-for-the-report
Open

14. Name the member every report is made from#76
nikolaystrikhar wants to merge 1 commit into
47-lifecycle-actionsfrom
62-one-shape-for-the-report

Conversation

@nikolaystrikhar

Copy link
Copy Markdown
Contributor

What: one shape for _doing_it_wrong()'s first argument across every report site in the library — Class::method, never a bare class name — with the rule stated on Traits\Reports_Errors and enforced by WithIncorrectUsage.

Usage: a host reading a debug log or listening on {prefix}/plugin_absorber/error now gets

Function Nexcess\PluginAbsorber\Loader::announce was called incorrectly:
A listener on give/plugin_absorber/loaded threw, and was abandoned: …

instead of Function Nexcess\PluginAbsorber\Loader was called incorrectly, which read identically whether the load pass abandoned a sub-plugin, the file gate refused one, or a lifecycle listener threw.

Why this way:

The member is the only thing separating two reports from one class. Absorber reports from two static trampolines and Loader from three methods; a bare class name collapses all five into one attribution, and the message is then the only way to tell them apart.

self::class . '::method', not __METHOD__. __METHOD__ inside a trait method names the trait, so the prefix guard and the error reporter would both attribute to Traits\… rather than to the class that actually stood down.

The too-late boot still names Absorber::boot. Every other site names where the sentence was written; that one names the call the host got wrong, because moving that call is the fix.

The suite pins the shape, not the name. One assertion that a report contains :: refuses a bare class at any new site while leaving method renames free.

`_doing_it_wrong()`'s first argument came in two shapes: `Class::method` at the
facade's two trampolines and at the too-late boot, and a bare class name at the
other eight sites. WordPress prints it as "Function %s was called incorrectly",
so it is the only part of a report that says where in the library the sentence
came from -- and a bare class cannot separate two reports made by the same
class, which is exactly what `Absorber::render_notices` and
`Absorber::filter_activation_error_markup` are, and what `Loader::load_all`,
`Loader::load` and `Loader::announce` are. `Class::method` everywhere.

Written as `self::class . '::method'` rather than `__METHOD__`, because both
traits here are reported through and `__METHOD__` inside a trait method names
the trait rather than the class using it -- a host would be sent to
`Traits\Guards_Hook_Prefix` instead of to the facade or the load pass that
actually stood down. The too-late boot keeps naming `Absorber::boot`: the
mistake there is in a call the host made, and that is the call it has to move.

`Traits\Reports_Errors` now states the rule, so the next report site has one
shape to copy rather than three to choose from, and
`WithIncorrectUsage::assert_the_library_reported_incorrect_usage()` enforces it
across the suite -- the shape, not the member name, so a rename still passes.
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Enterprise

Run ID: 577088db-1da3-4c7c-9d60-359169a2491b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

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