Skip to content

Commit

Permalink
phpstan: add a few more phpdoc types
Browse files Browse the repository at this point in the history
Sneak peak into phpstan level 9
  • Loading branch information
mfn committed Mar 4, 2024
1 parent 1f779a3 commit 4334aee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/GraphQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -385,6 +388,7 @@ public function buildSchemaFromConfig(array $schemaConfig): Schema
$schemaQuery = $schemaConfig['query'] ?? [];
$schemaMutation = $schemaConfig['mutation'] ?? [];
$schemaSubscription = $schemaConfig['subscription'] ?? [];
/** @var array<int|string,string> $schemaTypes */
$schemaTypes = $schemaConfig['types'] ?? [];
$schemaDirectives = $schemaConfig['directives'] ?? [];

Expand Down

0 comments on commit 4334aee

Please sign in to comment.