PHP Coverage
| This documentation was generated with the assistance of AI. Please report any inaccuracies. |
Run a PHP project’s tests with a coverage driver enabled and report the exact, measured coverage for the classes or files the caller cares about, read from a Clover XML report. It only measures and reports: it never adds tests, edits code, or installs extensions unless asked to as a follow-up.
Purpose
iru-php-coverage replaces eyeballing the runner’s console coverage table with exact numbers. It reuses iru-php-test’s environment, runner, config and unit-versus-integration detection, picks a coverage driver (PCOV first, Xdebug in `coverage mode otherwise), writes --coverage-clover, and computes line coverage (coveredstatements / statements) and method coverage per target class, plus the uncovered line ranges for targets under the caller’s bar. It refuses to report a false 0%: with no driver it says "no coverage driver available" and how to install PCOV, and a target absent from the report is reported as outside the config’s <source>.
Plugin
Shipped by the iru-php plugin of the ai-catalog marketplace (install with /plugin install iru-php@ai-catalog; see Plugins).
Inputs
| Argument | Required | Description | Default |
|---|---|---|---|
|
No |
Same syntax as |
None — runs the whole suite and reports whole-project coverage. |
|
No |
Comma-separated short names or FQCNs (or files, for procedural WordPress/PrestaShop code) to report on. |
Inferred from the selector by test-name convention ( |
Driver choice, in order: PCOV when loaded (fast, line coverage only; pcov.directory is overridden with -d pcov.directory=. when code lives outside src/, lib/ or app/), then Xdebug with XDEBUG_MODE=coverage (slower, the only driver for branch and path coverage via --path-coverage), else stop. php artisan test and --parallel start a child process that does not inherit -d options, so the runner binary is called directly or the driver is loaded through PHP_INI_SCAN_DIR.
Outputs
-
A summary naming the driver and environment/runner, then per target class (or file) the line coverage percentage and method coverage, computed from the Clover numbers; branch and path coverage only when collected with Xdebug, and an explicit "unavailable" with PCOV.
-
For targets under the user’s bar, the uncovered line ranges (for example
uncovered: 17, 24-31). -
A clear verdict per target and for the total when a bar such as "at least 80%" was given.
-
Missing driver, missing environment, or a target outside
<source>is reported with the failing command and the fix instead of a percentage. Numbers from a failing test run are labeled as such. -
The Clover and text reports are written under
build/iru-php-coverage-*and deleted afterwards. No source or test code is modified.
Execution flow
Dependencies
Invokes
None — iru-php-coverage is a leaf skill. It reuses `iru-php-test’s detection rules by convention (Steps 1–3) but runs its own commands and does not call that skill.
Invoked by
-
PHP Code One Task Group — Step 3.5, 80% fast-test coverage gate, via the
iru-gate-runneragent.
Related agents
None — it spawns no agents itself. Calling skills normally run it inside an iru-gate-runner sub-agent.
Source
SKILL.md on GitHub — the file this page was generated from.