ClassMapManager
class ClassMapManager
Keep package class replacements separate from the application's Composer map.
Allows packages to replace classes at the autoloader level, so the replacement file is loaded instead of the original. Already-loaded targets can only be registered again from the same source.
Properties
| static protected array<class-string, string> | $entries | ||
| static protected ClassLoader|null | $loader | ||
| static protected bool | $sealed |
Methods
Add class map entries and apply them to the Composer autoloader.
Close class map registration after application proxy generation.
Reopen class map registration while retaining the registered overrides.
Publish generated replacements with the lifetime of their source overrides.
Determine if any class map entries have been registered.
Get all registered class map entries.
Flush all static state.
Details
at line 43
static void
add(array $map)
Add class map entries and apply them to the Composer autoloader.
Each entry maps an original class name to the path of its replacement file. Fails if a target is already loaded from a different source.
Class-map overrides mutate the worker's Composer autoloader and must be registered before application proxy generation and target loading.
at line 87
static void
seal()
Close class map registration after application proxy generation.
Later registrations in this worker are rejected.
at line 99
static void
unseal()
Reopen class map registration while retaining the registered overrides.
This permits worker-wide autoloader changes for a new application bootstrap; already-loaded classes cannot be replaced.
at line 112
static void
applyProxies(array $proxies)
Publish generated replacements with the lifetime of their source overrides.
These autoload entries affect every request in the worker.
at line 121
static bool
hasEntries()
Determine if any class map entries have been registered.
at line 131
static array
getEntries()
Get all registered class map entries.
at line 139
static void
flushState()
Flush all static state.