generator = new AccessInterceptorValueHolderGenerator(); } /** * @param object $instance the object to be wrapped within the value holder * @param array $prefixInterceptors an array (indexed by method name) of interceptor closures to be called * before method logic is executed * @param array $suffixInterceptors an array (indexed by method name) of interceptor closures to be called * after method logic is executed * @psalm-param RealObjectType $instance * @psalm-param array=, * RealObjectType=, * string=, * array=, * bool= * ) : mixed> $prefixInterceptors * @psalm-param array=, * RealObjectType=, * string=, * array=, * mixed=, * bool= * ) : mixed> $suffixInterceptors * * @psalm-return RealObjectType&AccessInterceptorInterface&ValueHolderInterface&AccessInterceptorValueHolderInterface * * @throws InvalidSignatureException * @throws MissingSignatureException * @throws OutOfBoundsException * * @psalm-template RealObjectType of object * @psalm-suppress MixedInferredReturnType We ignore type checks here, since `staticProxyConstructor` is not * interfaced (by design) */ public function createProxy( $instance, array $prefixInterceptors = [], array $suffixInterceptors = [] ): AccessInterceptorValueHolderInterface { $proxyClassName = $this->generateProxy(get_class($instance)); /** * We ignore type checks here, since `staticProxyConstructor` is not interfaced (by design) * * @psalm-suppress MixedMethodCall * @psalm-suppress MixedReturnStatement */ return $proxyClassName::staticProxyConstructor($instance, $prefixInterceptors, $suffixInterceptors); } protected function getGenerator(): ProxyGeneratorInterface { return $this->generator; } }