generator = new LazyLoadingValueHolderGenerator(); } /** * @param array $proxyOptions * @psalm-param class-string $className * @psalm-param Closure( * RealObjectType|null=, * RealObjectType&ValueHolderInterface&VirtualProxyInterface=, * string=, * array=, * ?Closure= * ) : bool $initializer * @psalm-param array{skipDestructor?: bool, fluentSafe?: bool} $proxyOptions * * @psalm-return RealObjectType&ValueHolderInterface&VirtualProxyInterface * * @psalm-template RealObjectType of object * @psalm-suppress MixedInferredReturnType We ignore type checks here, since `staticProxyConstructor` is not * interfaced (by design) */ public function createProxy( string $className, Closure $initializer, array $proxyOptions = [] ): VirtualProxyInterface { $proxyClassName = $this->generateProxy($className, $proxyOptions); /** * We ignore type checks here, since `staticProxyConstructor` is not interfaced (by design) * * @psalm-suppress MixedMethodCall * @psalm-suppress MixedReturnStatement */ return $proxyClassName::staticProxyConstructor($initializer); } protected function getGenerator(): ProxyGeneratorInterface { return $this->generator; } }