adapter = $adapter; $this->generator = new RemoteObjectGenerator(); } /** * @psalm-param RealObjectType|class-string $instanceOrClassName * * @psalm-return RealObjectType&RemoteObjectInterface * * @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($instanceOrClassName): RemoteObjectInterface { $proxyClassName = $this->generateProxy( is_object($instanceOrClassName) ? get_class($instanceOrClassName) : $instanceOrClassName ); /** * We ignore type checks here, since `staticProxyConstructor` is not interfaced (by design) * * @psalm-suppress MixedMethodCall * @psalm-suppress MixedReturnStatement */ return $proxyClassName::staticProxyConstructor($this->adapter); } protected function getGenerator(): ProxyGeneratorInterface { return $this->generator ?? $this->generator = new RemoteObjectGenerator(); } }