Skip to content

Commit

Permalink
remove adapter and interface
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-potts committed Apr 22, 2024
1 parent 8ba21df commit 8969375
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 70 deletions.
2 changes: 1 addition & 1 deletion src/AsyncClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
interface AsyncClient extends Client
{
/** Execute a GraphQL query against an endpoint and return a Response. */
public function requestAsync(string $query, \stdClass $variables = null): PromiseInterface;
public function requestAsync(string $query, \stdClass $variables = null);
}
6 changes: 3 additions & 3 deletions src/Client/Guzzle.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Spawnia\Sailor\Client;

use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\ResponseInterface;
use Spawnia\Sailor\AsyncClient;
use Spawnia\Sailor\PromiseInterface;
use Spawnia\Sailor\Response;

class Guzzle implements AsyncClient
Expand Down Expand Up @@ -42,10 +42,10 @@ public function requestAsync(string $query, \stdClass $variables = null): Promis

$promise = $this->guzzle->postAsync($this->uri, ['json' => $json]);

return new GuzzlePromiseAdapter($promise->then(
return $promise->then(
function (ResponseInterface $response) {
return Response::fromResponseInterface($response);
}
));
);
}
}
54 changes: 0 additions & 54 deletions src/Client/GuzzlePromiseAdapter.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/Codegen/OperationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Nette\PhpGenerator\PhpNamespace;
use Spawnia\Sailor\ObjectLike;
use Spawnia\Sailor\Operation;
use Spawnia\Sailor\PromiseInterface;

/**
* @phpstan-type PropertyArgs array{string, Type, string, string, mixed}
Expand Down Expand Up @@ -71,7 +70,6 @@ public function extendOperation(string $resultClass): void
$this->class->setComment("@extends \\{$operationBaseClass}<\\{$resultClass}>");

$this->execute->setReturnType($resultClass);
$this->executeAsync->setReturnType(PromiseInterface::class);
}

public function storeDocument(string $operationString): void
Expand Down
6 changes: 3 additions & 3 deletions src/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ protected static function fetchResponse(array $args): Response
/**
* @param mixed ...$args type depends on the subclass
*
* @return PromiseInterface
* @return \GuzzleHttp\Promise\PromiseInterface
*/
protected static function executeOperationAsync(...$args): PromiseInterface
protected static function executeOperationAsync(...$args)
{
$mock = self::$mocks[static::class] ?? null;
if ($mock !== null) {
Expand All @@ -120,7 +120,7 @@ function ($response) {
*
* @param array<int, mixed> $args
*/
protected static function fetchResponseAsync(array $args): PromiseInterface
protected static function fetchResponseAsync(array $args)
{
$endpointConfig = Configuration::endpoint(static::config(), static::endpoint());

Expand Down
7 changes: 0 additions & 7 deletions src/PromiseInterface.php

This file was deleted.

0 comments on commit 8969375

Please sign in to comment.