diff --git a/src/Schema/AST/ASTBuilder.php b/src/Schema/AST/ASTBuilder.php index 0aa6bf53b8..61bde930f4 100644 --- a/src/Schema/AST/ASTBuilder.php +++ b/src/Schema/AST/ASTBuilder.php @@ -243,8 +243,8 @@ protected function applyArgManipulators(): void } } } - } - + } + /** Apply directives on input fields that can manipulate the AST. */ protected function applyInputFieldManipulators(): void { diff --git a/src/Schema/Types/LaravelEnumType.php b/src/Schema/Types/LaravelEnumType.php index 7f6ee7b6a2..2458f919e8 100644 --- a/src/Schema/Types/LaravelEnumType.php +++ b/src/Schema/Types/LaravelEnumType.php @@ -151,4 +151,13 @@ public function serialize($value): string return $key; } + + public function parseValue($value) + { + if ($value instanceof $this->enumClass) { + return $value; + } + + return parent::parseValue($value); + } } diff --git a/src/Tracing/FederatedTracing/Proto/ContextualizedQueryLatencyStats.php b/src/Tracing/FederatedTracing/Proto/ContextualizedQueryLatencyStats.php index 245301a968..d3cdb9263e 100644 --- a/src/Tracing/FederatedTracing/Proto/ContextualizedQueryLatencyStats.php +++ b/src/Tracing/FederatedTracing/Proto/ContextualizedQueryLatencyStats.php @@ -23,8 +23,8 @@ class ContextualizedQueryLatencyStats extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @var QueryLatencyStats $query_latency_stats - * @var StatsContext $context + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\QueryLatencyStats $query_latency_stats + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\StatsContext $context * } */ public function __construct($data = null) @@ -36,7 +36,7 @@ public function __construct($data = null) /** * Generated from protobuf field .QueryLatencyStats query_latency_stats = 1 [json_name = "queryLatencyStats"];. * - * @return QueryLatencyStats|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\QueryLatencyStats|null */ public function getQueryLatencyStats() { @@ -56,7 +56,7 @@ public function clearQueryLatencyStats() /** * Generated from protobuf field .QueryLatencyStats query_latency_stats = 1 [json_name = "queryLatencyStats"];. * - * @param QueryLatencyStats $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\QueryLatencyStats $var * * @return $this */ @@ -71,7 +71,7 @@ public function setQueryLatencyStats($var) /** * Generated from protobuf field .StatsContext context = 2 [json_name = "context"];. * - * @return StatsContext|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\StatsContext|null */ public function getContext() { @@ -91,7 +91,7 @@ public function clearContext() /** * Generated from protobuf field .StatsContext context = 2 [json_name = "context"];. * - * @param StatsContext $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\StatsContext $var * * @return $this */ diff --git a/src/Tracing/FederatedTracing/Proto/ContextualizedStats.php b/src/Tracing/FederatedTracing/Proto/ContextualizedStats.php index a29e2c8b9c..260fdbbcdc 100644 --- a/src/Tracing/FederatedTracing/Proto/ContextualizedStats.php +++ b/src/Tracing/FederatedTracing/Proto/ContextualizedStats.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -31,8 +32,8 @@ class ContextualizedStats extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @var StatsContext $context - * @var QueryLatencyStats $query_latency_stats + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\StatsContext $context + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\QueryLatencyStats $query_latency_stats * @var array|\Google\Protobuf\Internal\MapField $per_type_stat * Key is type name. This structure provides data for the count and latency of individual * field executions and thus only reflects operations for which field-level tracing occurred. @@ -47,7 +48,7 @@ public function __construct($data = null) /** * Generated from protobuf field .StatsContext context = 1 [json_name = "context"];. * - * @return StatsContext|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\StatsContext|null */ public function getContext() { @@ -67,7 +68,7 @@ public function clearContext() /** * Generated from protobuf field .StatsContext context = 1 [json_name = "context"];. * - * @param StatsContext $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\StatsContext $var * * @return $this */ @@ -82,7 +83,7 @@ public function setContext($var) /** * Generated from protobuf field .QueryLatencyStats query_latency_stats = 2 [json_name = "queryLatencyStats"];. * - * @return QueryLatencyStats|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\QueryLatencyStats|null */ public function getQueryLatencyStats() { @@ -102,7 +103,7 @@ public function clearQueryLatencyStats() /** * Generated from protobuf field .QueryLatencyStats query_latency_stats = 2 [json_name = "queryLatencyStats"];. * - * @param QueryLatencyStats $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\QueryLatencyStats $var * * @return $this */ @@ -139,7 +140,7 @@ public function getPerTypeStat() */ public function setPerTypeStat($var) { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, TypeStat::class); + $arr = GPBUtil::checkMapField($var, GPBType::STRING, GPBType::MESSAGE, TypeStat::class); $this->per_type_stat = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/ContextualizedTypeStats.php b/src/Tracing/FederatedTracing/Proto/ContextualizedTypeStats.php index 4c6df35781..68e2306020 100644 --- a/src/Tracing/FederatedTracing/Proto/ContextualizedTypeStats.php +++ b/src/Tracing/FederatedTracing/Proto/ContextualizedTypeStats.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -23,7 +24,7 @@ class ContextualizedTypeStats extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @var StatsContext $context + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\StatsContext $context * @var array|\Google\Protobuf\Internal\MapField $per_type_stat * } */ @@ -36,7 +37,7 @@ public function __construct($data = null) /** * Generated from protobuf field .StatsContext context = 1 [json_name = "context"];. * - * @return StatsContext|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\StatsContext|null */ public function getContext() { @@ -56,7 +57,7 @@ public function clearContext() /** * Generated from protobuf field .StatsContext context = 1 [json_name = "context"];. * - * @param StatsContext $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\StatsContext $var * * @return $this */ @@ -87,7 +88,7 @@ public function getPerTypeStat() */ public function setPerTypeStat($var) { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, TypeStat::class); + $arr = GPBUtil::checkMapField($var, GPBType::STRING, GPBType::MESSAGE, TypeStat::class); $this->per_type_stat = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/FieldStat.php b/src/Tracing/FederatedTracing/Proto/FieldStat.php index 42c091bc74..e189b9c251 100644 --- a/src/Tracing/FederatedTracing/Proto/FieldStat.php +++ b/src/Tracing/FederatedTracing/Proto/FieldStat.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -89,7 +90,7 @@ class FieldStat extends \Google\Protobuf\Internal\Message * field_execution_weight). * @var int|string $observed_execution_count * Number of times that the resolver for this field is directly observed being - * executed + * executed. * @var int|string $estimated_execution_count * Same as `observed_execution_count` but potentially scaled upwards if the server was only * performing field-level instrumentation on a sampling of operations. For @@ -327,7 +328,7 @@ public function getLatencyCount() */ public function setLatencyCount($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::SINT64); + $arr = GPBUtil::checkRepeatedField($var, GPBType::SINT64); $this->latency_count = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/PathErrorStats.php b/src/Tracing/FederatedTracing/Proto/PathErrorStats.php index 59d6b95983..71de5d9814 100644 --- a/src/Tracing/FederatedTracing/Proto/PathErrorStats.php +++ b/src/Tracing/FederatedTracing/Proto/PathErrorStats.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -56,7 +57,7 @@ public function getChildren() */ public function setChildren($var) { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, PathErrorStats::class); + $arr = GPBUtil::checkMapField($var, GPBType::STRING, GPBType::MESSAGE, PathErrorStats::class); $this->children = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/QueryLatencyStats.php b/src/Tracing/FederatedTracing/Proto/QueryLatencyStats.php index a2f5223706..7fb49e3c03 100644 --- a/src/Tracing/FederatedTracing/Proto/QueryLatencyStats.php +++ b/src/Tracing/FederatedTracing/Proto/QueryLatencyStats.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -106,8 +107,8 @@ class QueryLatencyStats extends \Google\Protobuf\Internal\Message * @var int|string $persisted_query_misses * @var array|array|\Google\Protobuf\Internal\RepeatedField $cache_latency_count * This array includes the latency buckets for all operations included in cache_hits - * See comment on latency_count for details - * @var PathErrorStats $root_error_stats + * See comment on latency_count for details. + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\PathErrorStats $root_error_stats * Paths and counts for each error. The total number of requests with errors within this object should be the same as * requests_with_errors_count below. * @var int|string $requests_with_errors_count @@ -159,7 +160,7 @@ public function getLatencyCount() */ public function setLatencyCount($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::SINT64); + $arr = GPBUtil::checkRepeatedField($var, GPBType::SINT64); $this->latency_count = $arr; return $this; @@ -298,7 +299,7 @@ public function getCacheLatencyCount() */ public function setCacheLatencyCount($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::SINT64); + $arr = GPBUtil::checkRepeatedField($var, GPBType::SINT64); $this->cache_latency_count = $arr; return $this; @@ -310,7 +311,7 @@ public function setCacheLatencyCount($var) * * Generated from protobuf field .PathErrorStats root_error_stats = 7 [json_name = "rootErrorStats"]; * - * @return PathErrorStats|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\PathErrorStats|null */ public function getRootErrorStats() { @@ -333,7 +334,7 @@ public function clearRootErrorStats() * * Generated from protobuf field .PathErrorStats root_error_stats = 7 [json_name = "rootErrorStats"]; * - * @param PathErrorStats $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\PathErrorStats $var * * @return $this */ @@ -393,7 +394,7 @@ public function getPublicCacheTtlCount() */ public function setPublicCacheTtlCount($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::SINT64); + $arr = GPBUtil::checkRepeatedField($var, GPBType::SINT64); $this->public_cache_ttl_count = $arr; return $this; @@ -418,7 +419,7 @@ public function getPrivateCacheTtlCount() */ public function setPrivateCacheTtlCount($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::SINT64); + $arr = GPBUtil::checkRepeatedField($var, GPBType::SINT64); $this->private_cache_ttl_count = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/ReferencedFieldsForType.php b/src/Tracing/FederatedTracing/Proto/ReferencedFieldsForType.php index 21cfe1f6f6..5c52f4d118 100644 --- a/src/Tracing/FederatedTracing/Proto/ReferencedFieldsForType.php +++ b/src/Tracing/FederatedTracing/Proto/ReferencedFieldsForType.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -66,7 +67,7 @@ public function getFieldNames() */ public function setFieldNames($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $arr = GPBUtil::checkRepeatedField($var, GPBType::STRING); $this->field_names = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/Report.php b/src/Tracing/FederatedTracing/Proto/Report.php index da81b96e01..8c79ee8cd3 100644 --- a/src/Tracing/FederatedTracing/Proto/Report.php +++ b/src/Tracing/FederatedTracing/Proto/Report.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -76,7 +77,7 @@ class Report extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @var ReportHeader $header + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\ReportHeader $header * @var array|\Google\Protobuf\Internal\MapField $traces_per_query * If QueryMetadata isn't provided, this key should be a statsReportKey (# operationName\nsignature). If the operation * name, signature, and persisted query IDs are provided in the QueryMetadata, and this operation was requested via a @@ -110,7 +111,7 @@ public function __construct($data = null) /** * Generated from protobuf field .ReportHeader header = 1 [json_name = "header"];. * - * @return ReportHeader|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\ReportHeader|null */ public function getHeader() { @@ -130,7 +131,7 @@ public function clearHeader() /** * Generated from protobuf field .ReportHeader header = 1 [json_name = "header"];. * - * @param ReportHeader $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\ReportHeader $var * * @return $this */ @@ -169,7 +170,7 @@ public function getTracesPerQuery() */ public function setTracesPerQuery($var) { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, TracesAndStats::class); + $arr = GPBUtil::checkMapField($var, GPBType::STRING, GPBType::MESSAGE, TracesAndStats::class); $this->traces_per_query = $arr; return $this; @@ -278,7 +279,7 @@ public function getOperationCountByType() */ public function setOperationCountByType($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, Report\OperationCountByType::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, Report\OperationCountByType::class); $this->operation_count_by_type = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/Trace.php b/src/Tracing/FederatedTracing/Proto/Trace.php index 79f98bc6fb..3af1446ad7 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace.php +++ b/src/Tracing/FederatedTracing/Proto/Trace.php @@ -170,15 +170,15 @@ class Trace extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @var \Google\Protobuf\Timestamp $start_time - * Wallclock time when the trace began + * Wallclock time when the trace began. * @var \Google\Protobuf\Timestamp $end_time - * Wallclock time when the trace ended + * Wallclock time when the trace ended. * @var int|string $duration_ns * High precision duration of the trace; may not equal end_time-start_time - * (eg, if your machine's clock changed during the trace) - * @var Trace\Node $root + * (eg, if your machine's clock changed during the trace). + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\Node $root * A tree containing information about all resolvers run directly by this - * service, including errors + * service, including errors. * @var bool $is_incomplete * If this is true, the trace is potentially missing some nodes that were * present on the query plan. This can happen if the trace span buffer used @@ -201,16 +201,16 @@ class Trace extends \Google\Protobuf\Internal\Message * @var string $unexecutedOperationBody * Optional: when GraphQL parsing or validation against the GraphQL schema fails, these fields * can include reference to the operation being sent for users to dig into the set of operations - * that are failing validation + * that are failing validation. * @var string $unexecutedOperationName - * @var Trace\Details $details + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\Details $details * @var string $client_name * @var string $client_version * @var string $operation_type * @var string $operation_subtype - * @var Trace\HTTP $http - * @var Trace\CachePolicy $cache_policy - * @var Trace\QueryPlanNode $query_plan + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\HTTP $http + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\CachePolicy $cache_policy + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode $query_plan * If this Trace was created by a Router/Gateway, this is the query plan, including * sub-Traces for subgraphs. Note that the 'root' tree on the * top-level Trace won't contain any resolvers (though it could contain errors @@ -358,7 +358,7 @@ public function setDurationNs($var) * * Generated from protobuf field .Trace.Node root = 14 [json_name = "root"]; * - * @return Trace\Node|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\Node|null */ public function getRoot() { @@ -381,7 +381,7 @@ public function clearRoot() * * Generated from protobuf field .Trace.Node root = 14 [json_name = "root"]; * - * @param Trace\Node $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\Node $var * * @return $this */ @@ -542,7 +542,7 @@ public function setUnexecutedOperationName($var) /** * Generated from protobuf field .Trace.Details details = 6 [json_name = "details"];. * - * @return Trace\Details|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\Details|null */ public function getDetails() { @@ -562,7 +562,7 @@ public function clearDetails() /** * Generated from protobuf field .Trace.Details details = 6 [json_name = "details"];. * - * @param Trace\Details $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\Details $var * * @return $this */ @@ -677,7 +677,7 @@ public function setOperationSubtype($var) /** * Generated from protobuf field .Trace.HTTP http = 10 [json_name = "http"];. * - * @return Trace\HTTP|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\HTTP|null */ public function getHttp() { @@ -697,7 +697,7 @@ public function clearHttp() /** * Generated from protobuf field .Trace.HTTP http = 10 [json_name = "http"];. * - * @param Trace\HTTP $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\HTTP $var * * @return $this */ @@ -712,7 +712,7 @@ public function setHttp($var) /** * Generated from protobuf field .Trace.CachePolicy cache_policy = 18 [json_name = "cachePolicy"];. * - * @return Trace\CachePolicy|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\CachePolicy|null */ public function getCachePolicy() { @@ -732,7 +732,7 @@ public function clearCachePolicy() /** * Generated from protobuf field .Trace.CachePolicy cache_policy = 18 [json_name = "cachePolicy"];. * - * @param Trace\CachePolicy $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\CachePolicy $var * * @return $this */ @@ -752,7 +752,7 @@ public function setCachePolicy($var) * * Generated from protobuf field .Trace.QueryPlanNode query_plan = 26 [json_name = "queryPlan"]; * - * @return Trace\QueryPlanNode|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode|null */ public function getQueryPlan() { @@ -777,7 +777,7 @@ public function clearQueryPlan() * * Generated from protobuf field .Trace.QueryPlanNode query_plan = 26 [json_name = "queryPlan"]; * - * @param Trace\QueryPlanNode $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode $var * * @return $this */ diff --git a/src/Tracing/FederatedTracing/Proto/Trace/Details.php b/src/Tracing/FederatedTracing/Proto/Trace/Details.php index 17f52859ec..29b7dfd763 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/Details.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/Details.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -82,7 +83,7 @@ public function getVariablesJson() */ public function setVariablesJson($var) { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $arr = GPBUtil::checkMapField($var, GPBType::STRING, GPBType::STRING); $this->variables_json = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/Trace/Error.php b/src/Tracing/FederatedTracing/Proto/Trace/Error.php index 99506dd0f0..d837dca589 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/Error.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/Error.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -94,7 +95,7 @@ public function getLocation() */ public function setLocation($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, Location::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, Location::class); $this->location = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/Trace/HTTP.php b/src/Tracing/FederatedTracing/Proto/Trace/HTTP.php index 20e070bc50..81aa241954 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/HTTP.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/HTTP.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -94,7 +95,7 @@ public function getRequestHeaders() */ public function setRequestHeaders($var) { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, HTTP\Values::class); + $arr = GPBUtil::checkMapField($var, GPBType::STRING, GPBType::MESSAGE, HTTP\Values::class); $this->request_headers = $arr; return $this; @@ -119,7 +120,7 @@ public function getResponseHeaders() */ public function setResponseHeaders($var) { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, HTTP\Values::class); + $arr = GPBUtil::checkMapField($var, GPBType::STRING, GPBType::MESSAGE, HTTP\Values::class); $this->response_headers = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/Trace/HTTP/Values.php b/src/Tracing/FederatedTracing/Proto/Trace/HTTP/Values.php index bfef7f64fa..13a41ff44f 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/HTTP/Values.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/HTTP/Values.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\HTTP; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -48,7 +49,7 @@ public function getValue() */ public function setValue($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $arr = GPBUtil::checkRepeatedField($var, GPBType::STRING); $this->value = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/Trace/Node.php b/src/Tracing/FederatedTracing/Proto/Trace/Node.php index 1b065ecbfe..c8e93bc5bf 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/Node.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/Node.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -72,7 +73,7 @@ class Node extends \Google\Protobuf\Internal\Message * The field's return type; e.g. "String!" for User.email:String! * @var string $parent_type * The field's parent type; e.g. "User" for User.email:String! - * @var CachePolicy $cache_policy + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\CachePolicy $cache_policy * @var int|string $start_time * relative to the trace's start_time, in ns * @var int|string $end_time @@ -233,7 +234,7 @@ public function setParentType($var) /** * Generated from protobuf field .Trace.CachePolicy cache_policy = 5 [json_name = "cachePolicy"];. * - * @return CachePolicy|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\CachePolicy|null */ public function getCachePolicy() { @@ -253,7 +254,7 @@ public function clearCachePolicy() /** * Generated from protobuf field .Trace.CachePolicy cache_policy = 5 [json_name = "cachePolicy"];. * - * @param CachePolicy $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\CachePolicy $var * * @return $this */ @@ -342,7 +343,7 @@ public function getError() */ public function setError($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, Error::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, Error::class); $this->error = $arr; return $this; @@ -367,7 +368,7 @@ public function getChild() */ public function setChild($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, Node::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, Node::class); $this->child = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode.php b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode.php index 43a5407c4c..6fa1ad23d2 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode.php @@ -24,12 +24,12 @@ class QueryPlanNode extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @var QueryPlanNode\SequenceNode $sequence - * @var QueryPlanNode\ParallelNode $parallel - * @var QueryPlanNode\FetchNode $fetch - * @var QueryPlanNode\FlattenNode $flatten - * @var QueryPlanNode\DeferNode $defer - * @var QueryPlanNode\ConditionNode $condition + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\SequenceNode $sequence + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\ParallelNode $parallel + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\FetchNode $fetch + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\FlattenNode $flatten + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\DeferNode $defer + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\ConditionNode $condition * } */ public function __construct($data = null) @@ -41,7 +41,7 @@ public function __construct($data = null) /** * Generated from protobuf field .Trace.QueryPlanNode.SequenceNode sequence = 1 [json_name = "sequence"];. * - * @return QueryPlanNode\SequenceNode|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\SequenceNode|null */ public function getSequence() { @@ -56,7 +56,7 @@ public function hasSequence() /** * Generated from protobuf field .Trace.QueryPlanNode.SequenceNode sequence = 1 [json_name = "sequence"];. * - * @param QueryPlanNode\SequenceNode $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\SequenceNode $var * * @return $this */ @@ -71,7 +71,7 @@ public function setSequence($var) /** * Generated from protobuf field .Trace.QueryPlanNode.ParallelNode parallel = 2 [json_name = "parallel"];. * - * @return QueryPlanNode\ParallelNode|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\ParallelNode|null */ public function getParallel() { @@ -86,7 +86,7 @@ public function hasParallel() /** * Generated from protobuf field .Trace.QueryPlanNode.ParallelNode parallel = 2 [json_name = "parallel"];. * - * @param QueryPlanNode\ParallelNode $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\ParallelNode $var * * @return $this */ @@ -101,7 +101,7 @@ public function setParallel($var) /** * Generated from protobuf field .Trace.QueryPlanNode.FetchNode fetch = 3 [json_name = "fetch"];. * - * @return QueryPlanNode\FetchNode|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\FetchNode|null */ public function getFetch() { @@ -116,7 +116,7 @@ public function hasFetch() /** * Generated from protobuf field .Trace.QueryPlanNode.FetchNode fetch = 3 [json_name = "fetch"];. * - * @param QueryPlanNode\FetchNode $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\FetchNode $var * * @return $this */ @@ -131,7 +131,7 @@ public function setFetch($var) /** * Generated from protobuf field .Trace.QueryPlanNode.FlattenNode flatten = 4 [json_name = "flatten"];. * - * @return QueryPlanNode\FlattenNode|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\FlattenNode|null */ public function getFlatten() { @@ -146,7 +146,7 @@ public function hasFlatten() /** * Generated from protobuf field .Trace.QueryPlanNode.FlattenNode flatten = 4 [json_name = "flatten"];. * - * @param QueryPlanNode\FlattenNode $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\FlattenNode $var * * @return $this */ @@ -161,7 +161,7 @@ public function setFlatten($var) /** * Generated from protobuf field .Trace.QueryPlanNode.DeferNode defer = 5 [json_name = "defer"];. * - * @return QueryPlanNode\DeferNode|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\DeferNode|null */ public function getDefer() { @@ -176,7 +176,7 @@ public function hasDefer() /** * Generated from protobuf field .Trace.QueryPlanNode.DeferNode defer = 5 [json_name = "defer"];. * - * @param QueryPlanNode\DeferNode $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\DeferNode $var * * @return $this */ @@ -191,7 +191,7 @@ public function setDefer($var) /** * Generated from protobuf field .Trace.QueryPlanNode.ConditionNode condition = 6 [json_name = "condition"];. * - * @return QueryPlanNode\ConditionNode|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\ConditionNode|null */ public function getCondition() { @@ -206,7 +206,7 @@ public function hasCondition() /** * Generated from protobuf field .Trace.QueryPlanNode.ConditionNode condition = 6 [json_name = "condition"];. * - * @param QueryPlanNode\ConditionNode $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\ConditionNode $var * * @return $this */ diff --git a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/DeferNode.php b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/DeferNode.php index 6f98d789d2..82e29563d6 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/DeferNode.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/DeferNode.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -25,7 +26,7 @@ class DeferNode extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @var DeferNodePrimary $primary + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\DeferNodePrimary $primary * @var array<\Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\DeferredNode>|\Google\Protobuf\Internal\RepeatedField $deferred * } */ @@ -38,7 +39,7 @@ public function __construct($data = null) /** * Generated from protobuf field .Trace.QueryPlanNode.DeferNodePrimary primary = 1 [json_name = "primary"];. * - * @return DeferNodePrimary|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\DeferNodePrimary|null */ public function getPrimary() { @@ -58,7 +59,7 @@ public function clearPrimary() /** * Generated from protobuf field .Trace.QueryPlanNode.DeferNodePrimary primary = 1 [json_name = "primary"];. * - * @param DeferNodePrimary $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode\DeferNodePrimary $var * * @return $this */ @@ -89,7 +90,7 @@ public function getDeferred() */ public function setDeferred($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, DeferredNode::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, DeferredNode::class); $this->deferred = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/DeferredNode.php b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/DeferredNode.php index c91849ea08..464bab61f6 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/DeferredNode.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/DeferredNode.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -60,7 +61,7 @@ public function getDepends() */ public function setDepends($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, DeferredNodeDepends::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, DeferredNodeDepends::class); $this->depends = $arr; return $this; @@ -110,7 +111,7 @@ public function getPath() */ public function setPath($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, ResponsePathElement::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, ResponsePathElement::class); $this->path = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/FetchNode.php b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/FetchNode.php index edc48c8653..f1a4a029fa 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/FetchNode.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/FetchNode.php @@ -66,12 +66,12 @@ class FetchNode extends \Google\Protobuf\Internal\Message * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace $trace * This Trace only contains start_time, end_time, duration_ns, and root; * all timings were calculated **on the subgraph**, and clock skew - * will be handled by the ingress server + * will be handled by the ingress server. * @var int|string $sent_time_offset - * relative to the outer trace's start_time, in ns, measured in the Router/Gateway + * relative to the outer trace's start_time, in ns, measured in the Router/Gateway. * @var \Google\Protobuf\Timestamp $sent_time * Wallclock times measured in the Router/Gateway for when this operation was - * sent and received + * sent and received. * @var \Google\Protobuf\Timestamp $received_time * } */ diff --git a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/FlattenNode.php b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/FlattenNode.php index 827b72c8f1..5cf9373d10 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/FlattenNode.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/FlattenNode.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -55,7 +56,7 @@ public function getResponsePath() */ public function setResponsePath($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, ResponsePathElement::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, ResponsePathElement::class); $this->response_path = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/ParallelNode.php b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/ParallelNode.php index 6940b590ba..472cad00d5 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/ParallelNode.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/ParallelNode.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -50,7 +51,7 @@ public function getNodes() */ public function setNodes($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode::class); $this->nodes = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/SequenceNode.php b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/SequenceNode.php index 8cd7208216..f5d30ff5ca 100644 --- a/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/SequenceNode.php +++ b/src/Tracing/FederatedTracing/Proto/Trace/QueryPlanNode/SequenceNode.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -50,7 +51,7 @@ public function getNodes() */ public function setNodes($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace\QueryPlanNode::class); $this->nodes = $arr; return $this; diff --git a/src/Tracing/FederatedTracing/Proto/TracesAndStats.php b/src/Tracing/FederatedTracing/Proto/TracesAndStats.php index 9f6a4eb100..f4c4c26e82 100644 --- a/src/Tracing/FederatedTracing/Proto/TracesAndStats.php +++ b/src/Tracing/FederatedTracing/Proto/TracesAndStats.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -71,7 +72,7 @@ class TracesAndStats extends \Google\Protobuf\Internal\Message * This field is used to validate that the algorithm used to construct `stats_with_context` * matches similar algorithms in Apollo's servers. It is otherwise ignored and should not * be included in reports. - * @var QueryMetadata $query_metadata + * @var \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\QueryMetadata $query_metadata * This is an optional field that is used to provide more context to the key of this object within the * traces_per_query map. If it's omitted, we assume the key is a standard operation name and signature key. * } @@ -101,7 +102,7 @@ public function getTrace() */ public function setTrace($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, Trace::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, Trace::class); $this->trace = $arr; return $this; @@ -126,7 +127,7 @@ public function getStatsWithContext() */ public function setStatsWithContext($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, ContextualizedStats::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, ContextualizedStats::class); $this->stats_with_context = $arr; return $this; @@ -165,7 +166,7 @@ public function getReferencedFieldsByType() */ public function setReferencedFieldsByType($var) { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, ReferencedFieldsForType::class); + $arr = GPBUtil::checkMapField($var, GPBType::STRING, GPBType::MESSAGE, ReferencedFieldsForType::class); $this->referenced_fields_by_type = $arr; return $this; @@ -198,7 +199,7 @@ public function getInternalTracesContributingToStats() */ public function setInternalTracesContributingToStats($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, Trace::class); + $arr = GPBUtil::checkRepeatedField($var, GPBType::MESSAGE, Trace::class); $this->internal_traces_contributing_to_stats = $arr; return $this; @@ -210,7 +211,7 @@ public function setInternalTracesContributingToStats($var) * * Generated from protobuf field .QueryMetadata query_metadata = 5 [json_name = "queryMetadata"]; * - * @return QueryMetadata|null + * @return \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\QueryMetadata|null */ public function getQueryMetadata() { @@ -233,7 +234,7 @@ public function clearQueryMetadata() * * Generated from protobuf field .QueryMetadata query_metadata = 5 [json_name = "queryMetadata"]; * - * @param QueryMetadata $var + * @param \Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\QueryMetadata $var * * @return $this */ diff --git a/src/Tracing/FederatedTracing/Proto/TypeStat.php b/src/Tracing/FederatedTracing/Proto/TypeStat.php index 052c751faf..22bdafa2ba 100644 --- a/src/Tracing/FederatedTracing/Proto/TypeStat.php +++ b/src/Tracing/FederatedTracing/Proto/TypeStat.php @@ -4,6 +4,7 @@ namespace Nuwave\Lighthouse\Tracing\FederatedTracing\Proto; +use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBUtil; /** @@ -57,7 +58,7 @@ public function getPerFieldStat() */ public function setPerFieldStat($var) { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, FieldStat::class); + $arr = GPBUtil::checkMapField($var, GPBType::STRING, GPBType::MESSAGE, FieldStat::class); $this->per_field_stat = $arr; return $this; diff --git a/tests/Integration/Subscriptions/SubscriptionTest.php b/tests/Integration/Subscriptions/SubscriptionTest.php index 0e0dbae0df..5c343ecc45 100644 --- a/tests/Integration/Subscriptions/SubscriptionTest.php +++ b/tests/Integration/Subscriptions/SubscriptionTest.php @@ -39,14 +39,24 @@ protected function setUp(): void body: String @guard } + enum PostStatus { + PUBLISHED @enum(value: "published") + DELETED @enum(value: "deleted") + } + type Subscription { onPostCreated: Post + onPostUpdated(status: PostStatus!): Post } type Mutation { createPost(title: String!, body: String): Post @mock @broadcast(subscription: "onPostCreated") + + updatePost(post: String!): Post + @mock + @broadcast(subscription: "onPostUpdated") } type Query { @@ -121,7 +131,6 @@ public function testBroadcastSubscriptions(): void '); $broadcastManager = $this->app->make(BroadcastManager::class); - $log = $broadcastManager->driver(); assert($log instanceof LogBroadcaster); @@ -192,6 +201,115 @@ public function testWithoutExcludeEmpty(): void ]); } + public function testSubscriptionWithEnumInputCorrectlyResolves(): void + { + $this->graphQL(/** @lang GraphQL */ ' + subscription { + onPostUpdated(status: DELETED) { + body + } + } + '); + + $this->graphQL(/** @lang GraphQL */ ' + mutation { + updatePost(post: "Foobar") { + body + } + } + '); + + $broadcastManager = $this->app->make(BroadcastManager::class); + $log = $broadcastManager->driver(); + assert($log instanceof LogBroadcaster); + + $this->assertCount(1, $log->broadcasts()); + + $broadcasted = Arr::get(Arr::first($log->broadcasts()), 'data', []); + $this->assertArrayHasKey('onPostUpdated', $broadcasted); + $this->assertSame(['body' => 'Foobar'], $broadcasted['onPostUpdated']); + } + + public function testSubscriptionWithEnumInputVariableCorrectlyResolves(): void + { + $this->postGraphQL([ + 'query' => /** @lang GraphQL */ ' + subscription OnPostUpdated($status: PostStatus!) { + onPostUpdated(status: $status) { + body + } + } + ', + 'variables' => [ + 'status' => 'DELETED', + ], + 'operationName' => 'OnPostUpdated', + ]); + + $this->graphQL(/** @lang GraphQL */ ' + mutation { + updatePost(post: "Foobar") { + body + } + } + '); + + $broadcastManager = $this->app->make(BroadcastManager::class); + $log = $broadcastManager->driver(); + assert($log instanceof LogBroadcaster); + + $this->assertCount(1, $log->broadcasts()); + + $broadcasted = Arr::get(Arr::first($log->broadcasts()), 'data', []); + $this->assertArrayHasKey('onPostUpdated', $broadcasted); + $this->assertSame(['body' => 'Foobar'], $broadcasted['onPostUpdated']); + } + + public function testSubscriptionWithEnumInputCorrectlyResolvesUsingBatchedQuery(): void + { + $this + ->postGraphQL([ + [ + 'query' => /** @lang GraphQL */ ' + { + bar + } + ', + ], + [ + 'query' => /** @lang GraphQL */ ' + subscription OnPostUpdated($status: PostStatus!) { + onPostUpdated(status: $status) { + body + } + } + ', + 'variables' => [ + 'status' => 'DELETED', + ], + 'operationName' => 'OnPostUpdated', + ], + ]); + + $this->graphQL(/** @lang GraphQL */ ' + mutation { + updatePost(post: "Foobar") { + body + } + } + '); + + $broadcastManager = $this->app->make(BroadcastManager::class); + $log = $broadcastManager->driver(); + assert($log instanceof LogBroadcaster); + + $this->assertCount(1, $log->broadcasts()); + + $broadcasted = Arr::get(Arr::first($log->broadcasts()), 'data', []); + $this->assertArrayHasKey('onPostUpdated', $broadcasted); + $this->assertSame(['body' => 'Foobar'], $broadcasted['onPostUpdated']); + } + public function testWithExcludeEmpty(): void { $config = $this->app->make(ConfigRepository::class); @@ -353,11 +471,11 @@ protected function subscribe(): TestResponse * * @return array> */ - protected function buildResponse(string $channelName, string $channel): array + protected function buildResponse(string $fieldName, string $channel): array { return [ 'data' => [ - 'onPostCreated' => null, + $fieldName => null, ], 'extensions' => [ 'lighthouse_subscriptions' => [ diff --git a/tests/Utils/Subscriptions/OnPostUpdated.php b/tests/Utils/Subscriptions/OnPostUpdated.php new file mode 100644 index 0000000000..f7497a5e59 --- /dev/null +++ b/tests/Utils/Subscriptions/OnPostUpdated.php @@ -0,0 +1,22 @@ +