class PendingRun

Traits

Properties

protected null|GroupContinuation): void $observer

The callback used to observe each diagnostic group.

protected null|DiagnosticOutcome): bool|string $fix

The callback that determines whether a failing diagnostic should be fixed.

protected null|Closure(): void $beforeRerun

The callback invoked when applied fixes require the diagnostics to be re-run.

protected bool $bail

Whether the run should stop after the first failing diagnostic.

Methods

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

__construct(Doctor $doctor, DiagnosticSelection $selection)

Create a new pending diagnostic run.

only(string ...$selectors)

Constrain the run to diagnostics matching the given selectors.

except(string ...$selectors)

Exclude diagnostics matching the given selectors from the run.

bail(bool $bail = true)

Stop the run after the first failing diagnostic.

observeUsing(Closure $callback)

Observe each diagnostic group through the given callback.

fixUsing(Closure $callback)

Apply fixes approved by the given callback.

beforeRerun(Closure $callback)

Invoke the given callback when applied fixes require the diagnostics to be re-run.

run()

Run the diagnostics.

check()

Check the selected diagnostics and gather their outcomes into a report.

array
checkGroup(string $group, array $diagnostics)

Check a diagnostic group while allowing its progress to be observed.

array
checkDiagnostics(array $diagnostics, Closure|null $before = null, Closure|null $after = null)

Check the given diagnostics.

bool
hasFailure(array $outcomes)

Determine whether the outcomes contain a failure.

array
fixes(DiagnosticReport $report, Closure $fix)

Apply the approved fixes for the report's failing diagnostics.

Details

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

at line 52
__construct(Doctor $doctor, DiagnosticSelection $selection)

Create a new pending diagnostic run.

Parameters

Doctor $doctor
DiagnosticSelection $selection

at line 64
PendingRun only(string ...$selectors)

Constrain the run to diagnostics matching the given selectors.

Selectors may reference a diagnostic class, class basename, group, or package name. Repeated calls intersect with previous constraints.

Parameters

string ...$selectors

Return Value

PendingRun

at line 74
PendingRun except(string ...$selectors)

Exclude diagnostics matching the given selectors from the run.

Parameters

string ...$selectors

Return Value

PendingRun

at line 84
PendingRun bail(bool $bail = true)

Stop the run after the first failing diagnostic.

Parameters

bool $bail

Return Value

PendingRun

at line 101
PendingRun observeUsing(Closure $callback)

Observe each diagnostic group through the given callback.

The callback receives the group name and a controlled continuation that runs the group. The continuation accepts an optional "before" callback invoked before each diagnostic and an optional "after" callback invoked with each outcome.

Parameters

Closure $callback

Return Value

PendingRun

at line 117
PendingRun fixUsing(Closure $callback)

Apply fixes approved by the given callback.

The callback may return false to skip the fix, true to apply a plain fix, or one of the result's fix option values to apply the fix with that choice.

Parameters

Closure $callback

Return Value

PendingRun

at line 127
PendingRun beforeRerun(Closure $callback)

Invoke the given callback when applied fixes require the diagnostics to be re-run.

Parameters

Closure $callback

Return Value

PendingRun

at line 137
DiagnosticReport run()

Run the diagnostics.

Return Value

DiagnosticReport

at line 161
protected DiagnosticReport check()

Check the selected diagnostics and gather their outcomes into a report.

Return Value

DiagnosticReport

at line 183
protected array checkGroup(string $group, array $diagnostics)

Check a diagnostic group while allowing its progress to be observed.

Parameters

string $group
array $diagnostics

Return Value

array

at line 206
protected array checkDiagnostics(array $diagnostics, Closure|null $before = null, Closure|null $after = null)

Check the given diagnostics.

Parameters

array $diagnostics
Closure|null $before
Closure|null $after

Return Value

array

at line 235
protected bool hasFailure(array $outcomes)

Determine whether the outcomes contain a failure.

Parameters

array $outcomes

Return Value

bool

at line 252
protected array fixes(DiagnosticReport $report, Closure $fix)

Apply the approved fixes for the report's failing diagnostics.

Parameters

DiagnosticReport $report
Closure $fix

Return Value

array