Documentation

DiagnosticsRegistry
in package

Read onlyYes
FinalYes

Registration surface where packages declare themselves to the boot report.

The registry keeps no state of its own: registrations ride on a WordPress filter, so every plugin and theme in the request that uses the same filter name meets in one report even though each of them boots its own container and kernel. Each package builds its own registry instance with the filter name its family agreed on; there is no static registry to collide on.

The default filter name is the neutral library marker middaglib_diagnostics, which names no product: a consumer passes its own (for example acme_diagnostics). Third-party code can also contribute directly:

add_filter('acme_diagnostics', static fn (array $probes): array =>
    [...$probes, new PackageProbe('acme-addon', '1.2.0')]);

Table of Contents

Constants

DEFAULT_FILTER  : string = 'middaglib_diagnostics'

Properties

$filterName  : string

Methods

__construct()  : mixed
collect()  : PackageProbe>, invalid: int}
Every registration on the filter, split into valid probes and the number of entries that were not a {@see PackageProbe}.
filterName()  : string
register()  : void
Declare a package to the report. Call it from the main plugin file before the kernel boots, so a failed boot still shows up as a failed check instead of a missing package.
report()  : BootReport
Collect the report for the current request.

Constants

Properties

Methods

__construct()

public __construct([string $filterName = self::DEFAULT_FILTER ]) : mixed
Parameters
$filterName : string = self::DEFAULT_FILTER
Tags
throws
InvalidArgumentException

when the filter name is empty

collect()

Every registration on the filter, split into valid probes and the number of entries that were not a {@see PackageProbe}.

public collect() : PackageProbe>, invalid: int}
Return values
PackageProbe>, invalid: int}

register()

Declare a package to the report. Call it from the main plugin file before the kernel boots, so a failed boot still shows up as a failed check instead of a missing package.

public register(PackageProbe $probe) : void
Parameters
$probe : PackageProbe

report()

Collect the report for the current request.

public report([array<int, string> $expected = [] ]) : BootReport
Parameters
$expected : array<int, string> = []

package names that must be registered

Return values
BootReport
On this page

Search results