class Doctor

Properties

protected Diagnostic>> $diagnostics

The registered diagnostic classes.

Methods

__construct(Container $container)

Create a new Doctor instance.

diagnostic(string $diagnostic)

Register a diagnostic.

diagnostics(iterable $diagnostics)

Register multiple diagnostics.

array
registered()

Get the registered diagnostic classes.

bool
hasDiagnostics()

Determine whether any diagnostics are registered.

run()

Run the registered diagnostics.

only(string ...$selectors)

Begin a run constrained to diagnostics matching the given selectors.

except(string ...$selectors)

Begin a run that excludes diagnostics matching the given selectors.

bail(bool $bail = true)

Begin a run that stops after the first failing diagnostic.

observeUsing(Closure $callback)

Begin a run that observes each diagnostic group through the given callback.

fixUsing(Closure $callback)

Begin a run that applies fixes approved by the given callback.

beforeRerun(Closure $callback)

Begin a run that invokes the given callback when applied fixes require the diagnostics to be re-run.

pendingRun()

Begin a new pending diagnostic run.

defaultSelection()

Get the diagnostic selection configured for the application.

check(Diagnostic $diagnostic)

Run a single diagnostic.

fix(DiagnosticOutcome $outcome, string|null $option = null)

Run the fix for a diagnostic outcome.

array
selectedByGroup(DiagnosticSelection|null $selection = null)

Get the selected diagnostics grouped by diagnostic group.

array
selected(DiagnosticSelection|null $selection = null)

Get the selected diagnostic instances in registration order.

Details

at line 37
__construct(Container $container)

Create a new Doctor instance.

Parameters

Container $container

at line 48
Doctor diagnostic(string $diagnostic)

Register a diagnostic.

On the shared Doctor service, the registration affects subsequent runs.

Parameters

string $diagnostic

Return Value

Doctor

at line 67
Doctor diagnostics(iterable $diagnostics)

Register multiple diagnostics.

On the shared Doctor service, the registration affects subsequent runs.

Parameters

iterable $diagnostics

Return Value

Doctor

at line 82
array registered()

Get the registered diagnostic classes.

Return Value

array

at line 90
bool hasDiagnostics()

Determine whether any diagnostics are registered.

Return Value

bool

at line 98
DiagnosticReport run()

Run the registered diagnostics.

Return Value

DiagnosticReport

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

Begin a run constrained to diagnostics matching the given selectors.

Selectors may reference a diagnostic class, class basename, group, or package name.

Parameters

string ...$selectors

Return Value

PendingRun

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

Begin a run that excludes diagnostics matching the given selectors.

Parameters

string ...$selectors

Return Value

PendingRun

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

Begin a run that stops after the first failing diagnostic.

Parameters

bool $bail

Return Value

PendingRun

at line 135
PendingRun observeUsing(Closure $callback)

Begin a run that observes each diagnostic group through the given callback.

Parameters

Closure $callback

Return Value

PendingRun

at line 145
PendingRun fixUsing(Closure $callback)

Begin a run that applies fixes approved by the given callback.

Parameters

Closure $callback

Return Value

PendingRun

at line 156
PendingRun beforeRerun(Closure $callback)

Begin a run that invokes the given callback when applied fixes require the diagnostics to be re-run.

Parameters

Closure $callback

Return Value

PendingRun

at line 164
protected PendingRun pendingRun()

Begin a new pending diagnostic run.

Return Value

PendingRun

at line 172
protected DiagnosticSelection defaultSelection()

Get the diagnostic selection configured for the application.

Return Value

DiagnosticSelection

at line 183
DiagnosticOutcome check(Diagnostic $diagnostic)

Run a single diagnostic.

Parameters

Diagnostic $diagnostic

Return Value

DiagnosticOutcome

at line 202
DiagnosticFixOutcome fix(DiagnosticOutcome $outcome, string|null $option = null)

Run the fix for a diagnostic outcome.

Parameters

DiagnosticOutcome $outcome
string|null $option

Return Value

DiagnosticFixOutcome

at line 248
array selectedByGroup(DiagnosticSelection|null $selection = null)

Get the selected diagnostics grouped by diagnostic group.

Parameters

DiagnosticSelection|null $selection

Return Value

array

at line 261
protected array selected(DiagnosticSelection|null $selection = null)

Get the selected diagnostic instances in registration order.

Parameters

DiagnosticSelection|null $selection

Return Value

array