class DiagnosticSource

Methods

__construct(string|null $package, string|null $file, string|null $relativeFile, bool $application)

Create a new diagnostic source instance.

resolve(string $class)

Resolve the source metadata for the given diagnostic class.

for(Diagnostic $diagnostic)

Resolve the source metadata for the given diagnostic instance.

string
label()

Get the user-facing source label.

resolveSource(string $class)

Resolve the source metadata for the given diagnostic class.

static string|null
classFile(string $class)

Resolve the file path for the given class.

static bool
isApplicationSource(string $class, string|null $package)

Determine whether a diagnostic class belongs to the application.

static string|null
installedPackageForFile(string $file)

Find the installed Composer package that contains a file.

static string|null
packagePath(string $package)

Get the installation path for a Composer package.

static string|null
rootPackageName()

Get the root Composer package name.

static string
relativePath(string $directory, string $file)

Get the file path relative to its package root.

static bool
contains(string $directory, string $file)

Determine whether a directory contains a file.

static void
flushState()

Flush all static state.

Details

at line 22
__construct(string|null $package, string|null $file, string|null $relativeFile, bool $application)

Create a new diagnostic source instance.

Parameters

string|null $package
string|null $file
string|null $relativeFile
bool $application

at line 35
static DiagnosticSource resolve(string $class)

Resolve the source metadata for the given diagnostic class.

Parameters

string $class

Return Value

DiagnosticSource

at line 47
static DiagnosticSource for(Diagnostic $diagnostic)

Resolve the source metadata for the given diagnostic instance.

Parameters

Diagnostic $diagnostic

Return Value

DiagnosticSource

at line 67
string label()

Get the user-facing source label.

Return Value

string

at line 77
static protected DiagnosticSource resolveSource(string $class)

Resolve the source metadata for the given diagnostic class.

Parameters

string $class

Return Value

DiagnosticSource

at line 106
static protected string|null classFile(string $class)

Resolve the file path for the given class.

Parameters

string $class

Return Value

string|null

at line 128
static protected bool isApplicationSource(string $class, string|null $package)

Determine whether a diagnostic class belongs to the application.

Parameters

string $class
string|null $package

Return Value

bool

at line 142
static protected string|null installedPackageForFile(string $file)

Find the installed Composer package that contains a file.

Parameters

string $file

Return Value

string|null

at line 178
static protected string|null packagePath(string $package)

Get the installation path for a Composer package.

Parameters

string $package

Return Value

string|null

at line 198
static protected string|null rootPackageName()

Get the root Composer package name.

Return Value

string|null

at line 210
static protected string relativePath(string $directory, string $file)

Get the file path relative to its package root.

Parameters

string $directory
string $file

Return Value

string

at line 222
static protected bool contains(string $directory, string $file)

Determine whether a directory contains a file.

Parameters

string $directory
string $file

Return Value

bool

at line 230
static void flushState()

Flush all static state.

Return Value

void