Skip to content

Commit

Permalink
refactor(graphql)!: Added TypeSource::isUnion().
Browse files Browse the repository at this point in the history
  • Loading branch information
LastDragon-ru committed Sep 18, 2023
1 parent 06ad9be commit 026f118
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/graphql/src/Builder/Contracts/TypeSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ public function getTypeDefinition(): TypeDefinitionNode|Type;
public function isNullable(): bool;

public function isList(): bool;

public function isUnion(): bool;
}
4 changes: 4 additions & 0 deletions packages/graphql/src/Builder/Sources/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public function isList(): bool {
return $this->getManipulator()->isList($this->getType());
}

public function isUnion(): bool {
return $this->getManipulator()->isUnion($this->getType());
}

public function __toString(): string {
return $this->getManipulator()->getTypeFullName($this->getType());
}
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/src/Builder/Types/InputObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected function isFieldConvertable(
}

// Union?
if ($manipulator->isUnion($field->getType())) {
if ($field->isUnion()) {
return false;
}

Expand Down

0 comments on commit 026f118

Please sign in to comment.