Problem
AspectKernel is a classic singleton (protected static ?self $instance, final protected function __construct() — src/Core/AspectKernel.php:74,94-101), and five runtime classes statically pull the container out of it:
src/Aop/Framework/InterceptorInjector.php:31,137-141
src/Aop/Framework/AbstractInterceptor.php:145
src/Aop/Pointcut/PointcutReference.php:61
src/Instrument/Transformer/FilterInjectorTransformer.php:88
src/Instrument/Transformer/MagicConstantTransformer.php:86
This blocks parallel kernels, embedding (e.g. a Symfony bundle with its own lifecycle), and test isolation.
Proposed design (for discussion)
- Introduce an explicit
Go\Core\Runtime holder bound once at kernel boot; woven code and runtime classes receive it (or the container) by injection instead of AspectKernel::getInstance()->getContainer().
- Keep
getInstance() as a thin deprecated BC shim delegating to the bound runtime.
- Decide the woven-code contract carefully: generated proxies reference these entry points by name, so the static surface that cached files call must stay stable across a cache warm.
Effort L, risk med-high (public API + woven code shape). Needs design discussion before implementation. Related: the advisor-cache RFC removes two of these call sites on its own.
Problem
AspectKernelis a classic singleton (protected static ?self $instance,final protected function __construct()—src/Core/AspectKernel.php:74,94-101), and five runtime classes statically pull the container out of it:src/Aop/Framework/InterceptorInjector.php:31,137-141src/Aop/Framework/AbstractInterceptor.php:145src/Aop/Pointcut/PointcutReference.php:61src/Instrument/Transformer/FilterInjectorTransformer.php:88src/Instrument/Transformer/MagicConstantTransformer.php:86This blocks parallel kernels, embedding (e.g. a Symfony bundle with its own lifecycle), and test isolation.
Proposed design (for discussion)
Go\Core\Runtimeholder bound once at kernel boot; woven code and runtime classes receive it (or the container) by injection instead ofAspectKernel::getInstance()->getContainer().getInstance()as a thin deprecated BC shim delegating to the bound runtime.Effort L, risk med-high (public API + woven code shape). Needs design discussion before implementation. Related: the advisor-cache RFC removes two of these call sites on its own.