Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions docs/class-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,6 @@ function getQuery()
/**
* @param MaybeLazyObjectType $query
*
* @throws InvariantViolation
*
* @api
*/
function setQuery($query): self
Expand All @@ -768,8 +766,6 @@ function getMutation()
/**
* @param MaybeLazyObjectType $mutation
*
* @throws InvariantViolation
*
* @api
*/
function setMutation($mutation): self
Expand All @@ -788,8 +784,6 @@ function getSubscription()
/**
* @param MaybeLazyObjectType $subscription
*
* @throws InvariantViolation
*
* @api
*/
function setSubscription($subscription): self
Expand Down
27 changes: 0 additions & 27 deletions src/Type/SchemaConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,10 @@ public function getQuery()
/**
* @param MaybeLazyObjectType $query
*
* @throws InvariantViolation
*
* @api
*/
public function setQuery($query): self
{
$this->assertMaybeLazyObjectType($query);
$this->query = $query;

return $this;
Expand All @@ -169,13 +166,10 @@ public function getMutation()
/**
* @param MaybeLazyObjectType $mutation
*
* @throws InvariantViolation
*
* @api
*/
public function setMutation($mutation): self
{
$this->assertMaybeLazyObjectType($mutation);
$this->mutation = $mutation;

return $this;
Expand All @@ -194,13 +188,10 @@ public function getSubscription()
/**
* @param MaybeLazyObjectType $subscription
*
* @throws InvariantViolation
*
* @api
*/
public function setSubscription($subscription): self
{
$this->assertMaybeLazyObjectType($subscription);
$this->subscription = $subscription;

return $this;
Expand Down Expand Up @@ -315,22 +306,4 @@ public function setExtensionASTNodes(array $extensionASTNodes): self

return $this;
}

/**
* @param mixed $maybeLazyObjectType Should be MaybeLazyObjectType
*
* @throws InvariantViolation
*/
protected function assertMaybeLazyObjectType($maybeLazyObjectType): void
{
if ($maybeLazyObjectType instanceof ObjectType || is_callable($maybeLazyObjectType) || is_null($maybeLazyObjectType)) {
return;
}

$notMaybeLazyObjectType = is_object($maybeLazyObjectType)
? get_class($maybeLazyObjectType)
: gettype($maybeLazyObjectType);
$objectTypeClass = ObjectType::class;
throw new InvariantViolation("Expected instanceof {$objectTypeClass}, a callable that returns such an instance, or null, got: {$notMaybeLazyObjectType}.");
}
}
Loading