Skip to content

Commit

Permalink
fixed an issue with dual types such as 'string|int'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kharhamel committed Jun 21, 2019
1 parent 4e84d0d commit ad716dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions generator/src/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion generator/src/WritePhpFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 .= '?';
}
Expand Down

0 comments on commit ad716dc

Please # to comment.