Skip to content

Commit

Permalink
Replace "switch" statement with "if"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Jul 17, 2022
1 parent 2ffe25c commit 2e1344f
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions Library/ArgInfoDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,23 +332,19 @@ private function renderEnd(): void
case '0:variable':
case '1:variable':
if (isset($parameter['cast'])) {
switch ($parameter['cast']['type']) {
case 'variable':
$value = $parameter['cast']['value'];
$this->codePrinter->output(
sprintf(
"\tZEND_ARG_OBJ_INFO(%d, %s, %s, %d)",
$this->passByReference($parameter),
$parameter['name'],
escape_class($this->compilationContext->getFullName($value)),
(int) $this->allowNull($parameter)
)
);
break;

default:
throw new Exception('Unexpected exception');
if ($parameter['cast']['type'] !== 'variable') {
throw new Exception('Unexpected exception');
}

$this->codePrinter->output(
sprintf(
"\tZEND_ARG_OBJ_INFO(%d, %s, %s, %d)",
$this->passByReference($parameter),
$parameter['name'],
escape_class($this->compilationContext->getFullName($parameter['cast']['value'])),
(int) $this->allowNull($parameter)
)
);
} else {
$this->codePrinter->output(
sprintf(
Expand Down

0 comments on commit 2e1344f

Please sign in to comment.