Skip to content

Commit 21e2ced

Browse files
committed
fixed an issue with dual types such as 'string|int'
1 parent d6bf1f3 commit 21e2ced

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

generator/src/Parameter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,9 @@ private function getInnerXml(\SimpleXMLElement $SimpleXMLElement): string
157157
$inner_xml = trim($inner_xml);
158158
return $inner_xml;
159159
}
160+
161+
public function isTypeable(): bool
162+
{
163+
return $this->getType() !== 'mixed' && $this->getType() !== 'resource' && \count(\explode("|", $this->getType())) < 2;
164+
}
160165
}

generator/src/WritePhpFunction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private function displayParamsWithType(array $params): string
142142

143143
foreach ($params as $param) {
144144
$paramAsString = '';
145-
if ($param->getType() !== 'mixed' && $param->getType() !== 'resource') {
145+
if ($param->isTypeable()) {
146146
if ($param->isNullable()) {
147147
$paramAsString .= '?';
148148
}

0 commit comments

Comments
 (0)