Skip to content

Commit 167e26e

Browse files
authored
Updated docs for union types (#499)
1 parent 470572d commit 167e26e

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

website/docs/type-mapping.mdx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ in the **ISO8601** format (aka ATOM format).
383383

384384
## Union types
385385

386-
You can create a GraphQL union type *on the fly* using the pipe `|` operator in the PHPDoc:
386+
Union types for return are supported in GraphQLite as of version 6.0:
387387

388388
<Tabs
389389
defaultValue="php8"
@@ -394,11 +394,8 @@ You can create a GraphQL union type *on the fly* using the pipe `|` operator in
394394
<TabItem value="php8">
395395

396396
```php
397-
/**
398-
* @return Company|Contact <== can return a company OR a contact.
399-
*/
400397
#[Query]
401-
public function companyOrContact(int $id)
398+
public function companyOrContact(int $id): Company|Contact
402399
{
403400
// Some code that returns a company or a contact.
404401
}
@@ -410,7 +407,7 @@ public function companyOrContact(int $id)
410407
```php
411408
/**
412409
* @Query
413-
* @return Company|Contact <== can return a company OR a contact.
410+
* @return Company|Contact
414411
*/
415412
public function companyOrContact(int $id)
416413
{

website/versioned_docs/version-6.0/type-mapping.mdx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ in the **ISO8601** format (aka ATOM format).
383383

384384
## Union types
385385

386-
You can create a GraphQL union type *on the fly* using the pipe `|` operator in the PHPDoc:
386+
Union types for return are supported in GraphQLite as of version 6.0:
387387

388388
<Tabs
389389
defaultValue="php8"
@@ -394,11 +394,8 @@ You can create a GraphQL union type *on the fly* using the pipe `|` operator in
394394
<TabItem value="php8">
395395

396396
```php
397-
/**
398-
* @return Company|Contact <== can return a company OR a contact.
399-
*/
400397
#[Query]
401-
public function companyOrContact(int $id)
398+
public function companyOrContact(int $id): Company|Contact
402399
{
403400
// Some code that returns a company or a contact.
404401
}
@@ -410,7 +407,7 @@ public function companyOrContact(int $id)
410407
```php
411408
/**
412409
* @Query
413-
* @return Company|Contact <== can return a company OR a contact.
410+
* @return Company|Contact
414411
*/
415412
public function companyOrContact(int $id)
416413
{

0 commit comments

Comments
 (0)