diff --git a/generator/src/Parameter.php b/generator/src/Parameter.php index 24ff990d..a32eb13b 100644 --- a/generator/src/Parameter.php +++ b/generator/src/Parameter.php @@ -157,4 +157,9 @@ private function getInnerXml(\SimpleXMLElement $SimpleXMLElement): string $inner_xml = trim($inner_xml); return $inner_xml; } + + public function isTypeable(): bool + { + return $this->getType() !== 'mixed' && $this->getType() !== 'resource' && \count(\explode("|", $this->getType())) < 2; + } } diff --git a/generator/src/WritePhpFunction.php b/generator/src/WritePhpFunction.php index 4399bf5b..47acd58f 100644 --- a/generator/src/WritePhpFunction.php +++ b/generator/src/WritePhpFunction.php @@ -142,7 +142,7 @@ private function displayParamsWithType(array $params): string foreach ($params as $param) { $paramAsString = ''; - if ($param->getType() !== 'mixed' && $param->getType() !== 'resource') { + if ($param->isTypeable()) { if ($param->isNullable()) { $paramAsString .= '?'; }