Skip to content

Commit 1a4ebc6

Browse files
committed
Don't call ->objectType if we don't have anything defined.
1 parent a4c30f7 commit 1a4ebc6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/GraphQL.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ public function schema($schema = null): Schema
8282
'name' => 'Query',
8383
]);
8484

85-
$mutation = $this->objectType($schemaMutation, [
86-
'name' => 'Mutation',
87-
]);
85+
$mutation = $schemaMutation
86+
? $this->objectType($schemaMutation, ['name' => 'Mutation'])
87+
: null;
8888

89-
$subscription = $this->objectType($schemaSubscription, [
90-
'name' => 'Subscription',
91-
]);
89+
$subscription = $schemaSubscription
90+
? $this->objectType($schemaSubscription, ['name' => 'Subscription'])
91+
: null;
9292

9393
return new Schema([
9494
'query' => $query,
95-
'mutation' => !empty($schemaMutation) ? $mutation : null,
96-
'subscription' => !empty($schemaSubscription) ? $subscription : null,
95+
'mutation' => $mutation,
96+
'subscription' => $subscription,
9797
'types' => function () {
9898
$types = [];
9999

0 commit comments

Comments
 (0)