Skip to content

Commit 8c74012

Browse files
committed
Fix type handling in buildDescription method to ensure compatibility with non-string descriptions
1 parent e17f675 commit 8c74012

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/Plugin/GraphQL/Traits/DescribablePluginTrait.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ trait DescribablePluginTrait {
1111
*/
1212
protected function buildDescription($definition) {
1313
if (!empty($definition['description']) && !is_null($definition['description'])) {
14-
return (string) ($definition['description']);
14+
try {
15+
return (string) ($definition['description']);
16+
}
17+
catch (\TypeError $e) {
18+
return '';
19+
}
1520
}
1621

17-
return NULL;
22+
return '';
1823
}
1924

2025
}

0 commit comments

Comments
 (0)