getContainer()->get('test.client'); if (!$testClient instanceof Client) { throw new \RuntimeException(sprintf( 'Expected service "test.client" to be an instance of "%s", got "%s" instead.', Client::class, \is_object($testClient) ? \get_class($testClient) : \gettype($testClient) )); } parent::__construct($testClient, $baseUrl); } }