GenerateProxies
class GenerateProxies
Generate AOP proxy classes for registered aspects.
Runs after all service providers have been registered (so all aspects() calls have executed) and before boot() (so no targeted classes have been instantiated yet). No-ops when no aspects are registered.
Properties
| static protected null|array<string, string> | $sourceClassMap | The source class map used for proxy generation. |
Methods
Build a class map that includes both Composer's static class map and any PSR-4 classes referenced by exact aspect rules.
Merge Composer's current class map into the proxy source map.
Flush the captured source class map.
Details
at line 34
void
bootstrap(Application $app)
Bootstrap the AOP proxy generation.
at line 65
protected array
buildClassMap()
Build a class map that includes both Composer's static class map and any PSR-4 classes referenced by exact aspect rules.
Composer's getClassMap() only contains explicitly mapped classes, not PSR-4 classes resolved at runtime. For exact class rules (no wildcards), we resolve the file path via findFile() so that PSR-4 classes are eligible for proxying.
Wildcard rules only match against the existing class map.
at line 104
protected array
mergeSourceClassMap(array $classMap)
Merge Composer's current class map into the proxy source map.
Runtime class-map overrides are legitimate source entries and may be registered after the first application boot. Generated proxy paths are excluded because they point at boot artifacts, not source files.
at line 128
static void
flushState()
Flush the captured source class map.
Tests only. This is for tests that swap Composer's loader before proxy generation; do not register it with the global after-test subscriber because normal test cleanup runs after proxy paths have already been added to the loader. Flushing mid-worker loses accumulated findFile() resolutions for already-proxied PSR-4 classes, so those classes are skipped from regeneration until the loader is swapped or the process restarts.