generated from spawnia/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include client directives when inlining fragments (#78)
- Loading branch information
Showing
56 changed files
with
621 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
examples/simple/expected/Operations/ClientDirectiveFragmentSpreadQuery.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spawnia\Sailor\Simple\Operations; | ||
|
||
/** | ||
* @extends \Spawnia\Sailor\Operation<\Spawnia\Sailor\Simple\Operations\ClientDirectiveFragmentSpreadQuery\ClientDirectiveFragmentSpreadQueryResult> | ||
*/ | ||
class ClientDirectiveFragmentSpreadQuery extends \Spawnia\Sailor\Operation | ||
{ | ||
/** | ||
* @param bool $value | ||
*/ | ||
public static function execute($value): ClientDirectiveFragmentSpreadQuery\ClientDirectiveFragmentSpreadQueryResult | ||
{ | ||
return self::executeOperation( | ||
$value, | ||
); | ||
} | ||
|
||
protected static function converters(): array | ||
{ | ||
static $converters; | ||
|
||
return $converters ??= [ | ||
['value', new \Spawnia\Sailor\Convert\NonNullConverter(new \Spawnia\Sailor\Convert\BooleanConverter)], | ||
]; | ||
} | ||
|
||
public static function document(): string | ||
{ | ||
return /* @lang GraphQL */ 'query ClientDirectiveFragmentSpreadQuery($value: Boolean!) { | ||
__typename | ||
... on Query @skip(if: $value) { | ||
twoArgs | ||
} | ||
}'; | ||
} | ||
|
||
public static function endpoint(): string | ||
{ | ||
return 'simple'; | ||
} | ||
|
||
public static function config(): string | ||
{ | ||
return \Safe\realpath(__DIR__ . '/../../sailor.php'); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...cted/Operations/ClientDirectiveFragmentSpreadQuery/ClientDirectiveFragmentSpreadQuery.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spawnia\Sailor\Simple\Operations\ClientDirectiveFragmentSpreadQuery; | ||
|
||
/** | ||
* @property string $__typename | ||
* @property string|null $twoArgs | ||
*/ | ||
class ClientDirectiveFragmentSpreadQuery extends \Spawnia\Sailor\ObjectLike | ||
{ | ||
/** | ||
* @param string|null $twoArgs | ||
*/ | ||
public static function make($twoArgs = 'Special default value that allows Sailor to differentiate between explicitly passing null and not passing a value at all.'): self | ||
{ | ||
$instance = new self; | ||
|
||
$instance->__typename = 'Query'; | ||
if ($twoArgs !== self::UNDEFINED) { | ||
$instance->twoArgs = $twoArgs; | ||
} | ||
|
||
return $instance; | ||
} | ||
|
||
protected function converters(): array | ||
{ | ||
static $converters; | ||
|
||
return $converters ??= [ | ||
'__typename' => new \Spawnia\Sailor\Convert\NonNullConverter(new \Spawnia\Sailor\Convert\StringConverter), | ||
'twoArgs' => new \Spawnia\Sailor\Convert\NullConverter(new \Spawnia\Sailor\Convert\IDConverter), | ||
]; | ||
} | ||
|
||
public static function endpoint(): string | ||
{ | ||
return 'simple'; | ||
} | ||
|
||
public static function config(): string | ||
{ | ||
return \Safe\realpath(__DIR__ . '/../../../sailor.php'); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
.../ClientDirectiveFragmentSpreadQuery/ClientDirectiveFragmentSpreadQueryErrorFreeResult.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spawnia\Sailor\Simple\Operations\ClientDirectiveFragmentSpreadQuery; | ||
|
||
class ClientDirectiveFragmentSpreadQueryErrorFreeResult extends \Spawnia\Sailor\ErrorFreeResult | ||
{ | ||
public ClientDirectiveFragmentSpreadQuery $data; | ||
|
||
public static function endpoint(): string | ||
{ | ||
return 'simple'; | ||
} | ||
|
||
public static function config(): string | ||
{ | ||
return \Safe\realpath(__DIR__ . '/../../../sailor.php'); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...perations/ClientDirectiveFragmentSpreadQuery/ClientDirectiveFragmentSpreadQueryResult.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spawnia\Sailor\Simple\Operations\ClientDirectiveFragmentSpreadQuery; | ||
|
||
class ClientDirectiveFragmentSpreadQueryResult extends \Spawnia\Sailor\Result | ||
{ | ||
public ?ClientDirectiveFragmentSpreadQuery $data = null; | ||
|
||
protected function setData(\stdClass $data): void | ||
{ | ||
$this->data = ClientDirectiveFragmentSpreadQuery::fromStdClass($data); | ||
} | ||
|
||
/** | ||
* Useful for instantiation of successful mocked results. | ||
* | ||
* @return static | ||
*/ | ||
public static function fromData(ClientDirectiveFragmentSpreadQuery $data): self | ||
{ | ||
$instance = new static; | ||
$instance->data = $data; | ||
|
||
return $instance; | ||
} | ||
|
||
public function errorFree(): ClientDirectiveFragmentSpreadQueryErrorFreeResult | ||
{ | ||
return ClientDirectiveFragmentSpreadQueryErrorFreeResult::fromResult($this); | ||
} | ||
|
||
public static function endpoint(): string | ||
{ | ||
return 'simple'; | ||
} | ||
|
||
public static function config(): string | ||
{ | ||
return \Safe\realpath(__DIR__ . '/../../../sailor.php'); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
examples/simple/expected/Operations/ClientDirectiveInlineFragmentQuery.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spawnia\Sailor\Simple\Operations; | ||
|
||
/** | ||
* @extends \Spawnia\Sailor\Operation<\Spawnia\Sailor\Simple\Operations\ClientDirectiveInlineFragmentQuery\ClientDirectiveInlineFragmentQueryResult> | ||
*/ | ||
class ClientDirectiveInlineFragmentQuery extends \Spawnia\Sailor\Operation | ||
{ | ||
/** | ||
* @param bool $value | ||
*/ | ||
public static function execute($value): ClientDirectiveInlineFragmentQuery\ClientDirectiveInlineFragmentQueryResult | ||
{ | ||
return self::executeOperation( | ||
$value, | ||
); | ||
} | ||
|
||
protected static function converters(): array | ||
{ | ||
static $converters; | ||
|
||
return $converters ??= [ | ||
['value', new \Spawnia\Sailor\Convert\NonNullConverter(new \Spawnia\Sailor\Convert\BooleanConverter)], | ||
]; | ||
} | ||
|
||
public static function document(): string | ||
{ | ||
return /* @lang GraphQL */ 'query ClientDirectiveInlineFragmentQuery($value: Boolean!) { | ||
__typename | ||
... on Query @skip(if: $value) { | ||
twoArgs | ||
} | ||
}'; | ||
} | ||
|
||
public static function endpoint(): string | ||
{ | ||
return 'simple'; | ||
} | ||
|
||
public static function config(): string | ||
{ | ||
return \Safe\realpath(__DIR__ . '/../../sailor.php'); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...cted/Operations/ClientDirectiveInlineFragmentQuery/ClientDirectiveInlineFragmentQuery.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spawnia\Sailor\Simple\Operations\ClientDirectiveInlineFragmentQuery; | ||
|
||
/** | ||
* @property string $__typename | ||
* @property string|null $twoArgs | ||
*/ | ||
class ClientDirectiveInlineFragmentQuery extends \Spawnia\Sailor\ObjectLike | ||
{ | ||
/** | ||
* @param string|null $twoArgs | ||
*/ | ||
public static function make($twoArgs = 'Special default value that allows Sailor to differentiate between explicitly passing null and not passing a value at all.'): self | ||
{ | ||
$instance = new self; | ||
|
||
$instance->__typename = 'Query'; | ||
if ($twoArgs !== self::UNDEFINED) { | ||
$instance->twoArgs = $twoArgs; | ||
} | ||
|
||
return $instance; | ||
} | ||
|
||
protected function converters(): array | ||
{ | ||
static $converters; | ||
|
||
return $converters ??= [ | ||
'__typename' => new \Spawnia\Sailor\Convert\NonNullConverter(new \Spawnia\Sailor\Convert\StringConverter), | ||
'twoArgs' => new \Spawnia\Sailor\Convert\NullConverter(new \Spawnia\Sailor\Convert\IDConverter), | ||
]; | ||
} | ||
|
||
public static function endpoint(): string | ||
{ | ||
return 'simple'; | ||
} | ||
|
||
public static function config(): string | ||
{ | ||
return \Safe\realpath(__DIR__ . '/../../../sailor.php'); | ||
} | ||
} |
Oops, something went wrong.