mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 12:56:05 +03:00
Fix CS in src
This commit is contained in:
parent
07c070d795
commit
73e75b6314
@ -4,11 +4,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace GraphQL;
|
namespace GraphQL;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use GraphQL\Executor\Promise\Adapter\SyncPromise;
|
use GraphQL\Executor\Promise\Adapter\SyncPromise;
|
||||||
|
use SplQueue;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
class Deferred
|
class Deferred
|
||||||
{
|
{
|
||||||
/** @var \SplQueue */
|
/** @var SplQueue */
|
||||||
private static $queue;
|
private static $queue;
|
||||||
|
|
||||||
/** @var callable */
|
/** @var callable */
|
||||||
@ -19,7 +22,7 @@ class Deferred
|
|||||||
|
|
||||||
public static function getQueue()
|
public static function getQueue()
|
||||||
{
|
{
|
||||||
return self::$queue ?: self::$queue = new \SplQueue();
|
return self::$queue ?: self::$queue = new SplQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function runQueue()
|
public static function runQueue()
|
||||||
@ -49,9 +52,9 @@ class Deferred
|
|||||||
try {
|
try {
|
||||||
$cb = $this->callback;
|
$cb = $this->callback;
|
||||||
$this->promise->resolve($cb());
|
$this->promise->resolve($cb());
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->promise->reject($e);
|
$this->promise->reject($e);
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$this->promise->reject($e);
|
$this->promise->reject($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,12 +64,13 @@ class GraphQL
|
|||||||
* Empty array would allow to skip query validation (may be convenient for persisted
|
* Empty array would allow to skip query validation (may be convenient for persisted
|
||||||
* queries which are validated before persisting and assumed valid during execution)
|
* queries which are validated before persisting and assumed valid during execution)
|
||||||
*
|
*
|
||||||
* @api
|
|
||||||
* @param string|DocumentNode $source
|
* @param string|DocumentNode $source
|
||||||
* @param mixed $rootValue
|
* @param mixed $rootValue
|
||||||
* @param mixed $context
|
* @param mixed $context
|
||||||
* @param mixed[]|null $variableValues
|
* @param mixed[]|null $variableValues
|
||||||
* @param ValidationRule[] $validationRules
|
* @param ValidationRule[] $validationRules
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
public static function executeQuery(
|
public static function executeQuery(
|
||||||
SchemaType $schema,
|
SchemaType $schema,
|
||||||
@ -102,12 +103,13 @@ class GraphQL
|
|||||||
* Same as executeQuery(), but requires PromiseAdapter and always returns a Promise.
|
* Same as executeQuery(), but requires PromiseAdapter and always returns a Promise.
|
||||||
* Useful for Async PHP platforms.
|
* Useful for Async PHP platforms.
|
||||||
*
|
*
|
||||||
* @api
|
|
||||||
* @param string|DocumentNode $source
|
* @param string|DocumentNode $source
|
||||||
* @param mixed $rootValue
|
* @param mixed $rootValue
|
||||||
* @param mixed $context
|
* @param mixed $context
|
||||||
* @param mixed[]|null $variableValues
|
* @param mixed[]|null $variableValues
|
||||||
* @param ValidationRule[]|null $validationRules
|
* @param ValidationRule[]|null $validationRules
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
public static function promiseToExecute(
|
public static function promiseToExecute(
|
||||||
PromiseAdapter $promiseAdapter,
|
PromiseAdapter $promiseAdapter,
|
||||||
@ -174,6 +176,7 @@ class GraphQL
|
|||||||
* @param mixed $rootValue
|
* @param mixed $rootValue
|
||||||
* @param mixed $contextValue
|
* @param mixed $contextValue
|
||||||
* @param mixed[]|null $variableValues
|
* @param mixed[]|null $variableValues
|
||||||
|
*
|
||||||
* @return Promise|mixed[]
|
* @return Promise|mixed[]
|
||||||
*/
|
*/
|
||||||
public static function execute(
|
public static function execute(
|
||||||
@ -203,7 +206,7 @@ class GraphQL
|
|||||||
if ($promiseAdapter instanceof SyncPromiseAdapter) {
|
if ($promiseAdapter instanceof SyncPromiseAdapter) {
|
||||||
$result = $promiseAdapter->wait($result)->toArray();
|
$result = $promiseAdapter->wait($result)->toArray();
|
||||||
} else {
|
} else {
|
||||||
$result = $result->then(function (ExecutionResult $r) {
|
$result = $result->then(static function (ExecutionResult $r) {
|
||||||
return $r->toArray();
|
return $r->toArray();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -255,8 +258,9 @@ class GraphQL
|
|||||||
/**
|
/**
|
||||||
* Returns directives defined in GraphQL spec
|
* Returns directives defined in GraphQL spec
|
||||||
*
|
*
|
||||||
* @api
|
|
||||||
* @return Directive[]
|
* @return Directive[]
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
public static function getStandardDirectives() : array
|
public static function getStandardDirectives() : array
|
||||||
{
|
{
|
||||||
@ -266,8 +270,9 @@ class GraphQL
|
|||||||
/**
|
/**
|
||||||
* Returns types defined in GraphQL spec
|
* Returns types defined in GraphQL spec
|
||||||
*
|
*
|
||||||
* @api
|
|
||||||
* @return Type[]
|
* @return Type[]
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
public static function getStandardTypes() : array
|
public static function getStandardTypes() : array
|
||||||
{
|
{
|
||||||
@ -277,8 +282,9 @@ class GraphQL
|
|||||||
/**
|
/**
|
||||||
* Returns standard validation rules implementing GraphQL spec
|
* Returns standard validation rules implementing GraphQL spec
|
||||||
*
|
*
|
||||||
* @api
|
|
||||||
* @return ValidationRule[]
|
* @return ValidationRule[]
|
||||||
|
*
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
public static function getStandardValidationRules() : array
|
public static function getStandardValidationRules() : array
|
||||||
{
|
{
|
||||||
@ -299,6 +305,7 @@ class GraphQL
|
|||||||
* Returns directives defined in GraphQL spec
|
* Returns directives defined in GraphQL spec
|
||||||
*
|
*
|
||||||
* @deprecated Renamed to getStandardDirectives
|
* @deprecated Renamed to getStandardDirectives
|
||||||
|
*
|
||||||
* @return Directive[]
|
* @return Directive[]
|
||||||
*/
|
*/
|
||||||
public static function getInternalDirectives() : array
|
public static function getInternalDirectives() : array
|
||||||
|
Loading…
Reference in New Issue
Block a user