From 4334aee80adf0ab903473523e9df6f71b676ce76 Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Mon, 4 Mar 2024 20:45:27 +0100 Subject: [PATCH] phpstan: add a few more phpdoc types Sneak peak into phpstan level 9 --- src/GraphQL.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/GraphQL.php b/src/GraphQL.php index 5f1856d1..69c55763 100644 --- a/src/GraphQL.php +++ b/src/GraphQL.php @@ -72,6 +72,7 @@ public function __construct(Container $app, Repository $config) public function schema(?string $schemaName = null): Schema { + /** @var string $schemaName */ $schemaName = $schemaName ?? $this->config->get('graphql.default_schema', 'default'); if (isset($this->schemas[$schemaName])) { @@ -108,6 +109,7 @@ public function query(string $query, ?array $variables = null, array $opts = []) public function queryAndReturnResult(string $query, ?array $variables = null, array $opts = []): ExecutionResult { $context = $opts['context'] ?? null; + /** @var string $schemaName */ $schemaName = $opts['schema'] ?? $this->config->get('graphql.default_schema', 'default'); $operationName = $opts['operationName'] ?? null; $rootValue = $opts['rootValue'] ?? null; @@ -159,6 +161,7 @@ protected function executeAndReturnResult(string $schemaName, Schema $schema, Op */ protected function executeViaMiddleware(array $middleware, string $schemaName, Schema $schema, OperationParams $params, $rootValue = null, $contextValue = null): ExecutionResult { + /** @var ExecutionResult */ return $this->app->make(Pipeline::class) ->send([$schemaName, $schema, $params, $rootValue, $contextValue]) ->through($middleware) @@ -385,6 +388,7 @@ public function buildSchemaFromConfig(array $schemaConfig): Schema $schemaQuery = $schemaConfig['query'] ?? []; $schemaMutation = $schemaConfig['mutation'] ?? []; $schemaSubscription = $schemaConfig['subscription'] ?? []; + /** @var array $schemaTypes */ $schemaTypes = $schemaConfig['types'] ?? []; $schemaDirectives = $schemaConfig['directives'] ?? [];