diff --git a/docs/class-reference.md b/docs/class-reference.md index e9fd2ed9d..fda7f50f9 100644 --- a/docs/class-reference.md +++ b/docs/class-reference.md @@ -748,8 +748,6 @@ function getQuery() /** * @param MaybeLazyObjectType $query * - * @throws InvariantViolation - * * @api */ function setQuery($query): self @@ -768,8 +766,6 @@ function getMutation() /** * @param MaybeLazyObjectType $mutation * - * @throws InvariantViolation - * * @api */ function setMutation($mutation): self @@ -788,8 +784,6 @@ function getSubscription() /** * @param MaybeLazyObjectType $subscription * - * @throws InvariantViolation - * * @api */ function setSubscription($subscription): self diff --git a/src/Type/SchemaConfig.php b/src/Type/SchemaConfig.php index d82c164d9..77a3a4c65 100644 --- a/src/Type/SchemaConfig.php +++ b/src/Type/SchemaConfig.php @@ -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; @@ -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; @@ -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; @@ -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}."); - } }