Skip to content

Commit

Permalink
#2272 - Minor refactor in MethodDocBlock:parseMethodParameters()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Oct 4, 2021
1 parent 6c41587 commit 771e1e5
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Library/Stubs/MethodDocBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,31 +247,28 @@ private function appendReturnLine(): void
}
}

private function parseMethodParameters(ClassMethod $method)
private function parseMethodParameters(ClassMethod $method): void
{
$parameters = $method->getParameters();
$aliasManager = $method->getClassDefinition()->getAliasManager();

if (!$parameters) {
if ($parameters === null) {
return;
}

foreach ($method->getParameters() as $parameter) {
foreach ($parameters as $parameter) {
if (isset($parameter['cast'])) {
if ($aliasManager->isAlias($parameter['cast']['value'])) {
$type = '\\'.$aliasManager->getAlias($parameter['cast']['value']);
} else {
$type = $parameter['cast']['value'];
}
} elseif (isset($parameter['data-type'])) {
if ('variable' == $parameter['data-type']) {
$type = 'mixed';
} else {
$type = $parameter['data-type'];
}
$type = 'variable' === $parameter['data-type'] ? 'mixed' : $parameter['data-type'];
} else {
$type = 'mixed';
}

$this->parameters['$'.trim($parameter['name'], '$')] = [$type, ''];
}
}
Expand Down

0 comments on commit 771e1e5

Please sign in to comment.