Greenlight

Documentation

API reference

On this page

Reporter API

This reference lists reporter and output contracts.

These signatures are the public API.

Output

Namespace: Greenlight\Reporting

A destination for reporter text.

write() sends the exact text to the destination. It does not add, escape, or buffer text.

interface Output

View source

write()

public function write(string $text): void;

PHPDoc:

View source

Reporter

Namespace: Greenlight\Reporting

Converts the run event stream to an output format.

A reporter receives each event in stream order. The stream contains run, test-class, test, and worker events. Greenlight calls finish() one time after the final event.

interface Reporter

View source

onEvent()

public function onEvent(Event $event): void;

PHPDoc:

View source

finish()

Greenlight calls this method exactly one time after the final event. Reporters with buffers write their buffered text here.

public function finish(): void;

PHPDoc:

View source

ReporterDefinition

Namespace: Greenlight\Reporting

Defines one command-line reporter name and its factory.

The name starts with a lowercase ASCII letter. The remaining characters are lowercase ASCII letters, digits, or hyphens.

final readonly class ReporterDefinition

View source

$name

public string $name

View source

$factory

public \Closure $factory

View source

__construct()

public function __construct(
    public string $name,
    public \Closure $factory,
)

PHPDoc:

View source

ReportGenerationFailed

Namespace: Greenlight\Reporting

A reporter could not render or deliver its required output.

final class ReportGenerationFailed extends \RuntimeException

View source

because()

Creates a failure for a reporter implementation.

public static function because(string $reason, ?\Throwable $previous = null): self

PHPDoc:

View source