Skip to content

Commit

Permalink
Fixed type hints for scalar arguments for PHP < 7.2
Browse files Browse the repository at this point in the history
Refs:
- #1658
  • Loading branch information
sergeyklay committed Nov 25, 2018
1 parent ca70d72 commit 4c101c7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Library/ArgInfoDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ private function renderEnd()

case '1:bool':
case '1:boolean':
$this->codePrinter->output('#if PHP_VERSION_ID >= 70200');
$this->codePrinter->output(
sprintf(
"\tZEND_ARG_TYPE_INFO(%d, %s, %s, %d)",
Expand All @@ -227,12 +228,18 @@ private function renderEnd()
(int) $this->allowNull($parameter)
)
);
$this->codePrinter->output('#else');
$this->codePrinter->output(
sprintf("\tZEND_ARG_INFO(%d, %s)", $this->passByReference($parameter), $parameter['name'])
);
$this->codePrinter->output('#endif');
break;
case '1:uchar':
case '1:int':
case '1:uint':
case '1:long':
case '1:ulong':
$this->codePrinter->output('#if PHP_VERSION_ID >= 70200');
$this->codePrinter->output(
sprintf(
"\tZEND_ARG_TYPE_INFO(%d, %s, IS_LONG, %d)",
Expand All @@ -241,8 +248,14 @@ private function renderEnd()
(int) $this->allowNull($parameter)
)
);
$this->codePrinter->output('#else');
$this->codePrinter->output(
sprintf("\tZEND_ARG_INFO(%d, %s)", $this->passByReference($parameter), $parameter['name'])
);
$this->codePrinter->output('#endif');
break;
case '1:double':
$this->codePrinter->output('#if PHP_VERSION_ID >= 70200');
$this->codePrinter->output(
sprintf(
"\tZEND_ARG_TYPE_INFO(%d, %s, IS_DOUBLE, %d)",
Expand All @@ -251,9 +264,15 @@ private function renderEnd()
(int) $this->allowNull($parameter)
)
);
$this->codePrinter->output('#else');
$this->codePrinter->output(
sprintf("\tZEND_ARG_INFO(%d, %s)", $this->passByReference($parameter), $parameter['name'])
);
$this->codePrinter->output('#endif');
break;
case '1:char':
case '1:string':
$this->codePrinter->output('#if PHP_VERSION_ID >= 70200');
$this->codePrinter->output(
sprintf(
"\tZEND_ARG_TYPE_INFO(%d, %s, IS_STRING, %d)",
Expand All @@ -262,6 +281,11 @@ private function renderEnd()
(int) $this->allowNull($parameter)
)
);
$this->codePrinter->output('#else');
$this->codePrinter->output(
sprintf("\tZEND_ARG_INFO(%d, %s)", $this->passByReference($parameter), $parameter['name'])
);
$this->codePrinter->output('#endif');
break;
default:
$this->codePrinter->output(
Expand Down

0 comments on commit 4c101c7

Please sign in to comment.