ScannedType
One class-like declaration, as read out of its source file by the tokenizer.
This is what SourceScanner produces before any autoloading happens. The fully-qualified name here is the one the file actually declares, not one derived from the file’s path, which is the distinction that makes it safe to reflect.
Synopsis
Section titled “Synopsis”final class ScannedType
| Source | Scan/ScannedType.php |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
$absolutePath | string | readonly. |
$baseDir | string | readonly. |
$fqcn | string | readonly. |
$imports | array | readonly. |
$kind | string | readonly. |
$namespace | string | readonly. |
$shortName | string | readonly. |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(string $fqcn, string $shortName, string $namespace, 'class'|'interface'|'trait'|'enum' $kind, string $absolutePath, string $baseDir, array<string, string> $imports): mixed
Alias (lowercased) => fully-qualified name, from the
file’s top-level use statements. Needed to resolve
the unqualified Foo docblock references that
reflection alone cannot.
| Parameter | Type | Description |
|---|---|---|
$fqcn | string | |
$shortName | string | |
$namespace | string | |
$kind | `‘class’“ | 'interface' |
$absolutePath | string | |
$baseDir | string | |
$imports | array``<``string``, ``string``> | Alias (lowercased) => fully-qualified name, from the file’s top-level use statements. Needed to resolve the unqualified Foo docblock references that reflection alone cannot. |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
relativePath(): string | Returns the path of this file relative to the PSR-4 base directory it was found under. |
resolveImport(string $alias): ?string | Resolves an alias used in this file to its fully-qualified name, or null when unimported. |
relativePath()
Section titled “relativePath()”public function relativePath(): string
Returns the path of this file relative to the PSR-4 base directory it was found under.
Source links are built from this rather than from ReflectionClass::getFileName(), which resolves symlinks: the monorepo’s vendor entries are symlinks into packages/, so the same class reports a different absolute path in a checkout than in a published install.
Returns string
resolveImport()
Section titled “resolveImport()”public function resolveImport(string $alias): ?string
Resolves an alias used in this file to its fully-qualified name, or null when unimported.
| Parameter | Type | Description |
|---|---|---|
$alias | string |
Returns ?``string