@@ -774,12 +774,12 @@ public function toTypeMask(): string {
774
774
}
775
775
776
776
class ArgInfo {
777
- const SEND_BY_VAL = 0 ;
778
- const SEND_BY_REF = 1 ;
779
- const SEND_PREFER_REF = 2 ;
777
+ const SEND_BY_VAL = " 0 " ;
778
+ const SEND_BY_REF = " 1 " ;
779
+ const SEND_PREFER_REF = " ZEND_SEND_PREFER_REF " ;
780
780
781
781
public string $ name ;
782
- public int $ sendBy ;
782
+ public string $ sendBy ;
783
783
public bool $ isVariadic ;
784
784
public ?Type $ type ;
785
785
public ?Type $ phpDocType ;
@@ -792,7 +792,7 @@ class ArgInfo {
792
792
*/
793
793
public function __construct (
794
794
string $ name ,
795
- int $ sendBy ,
795
+ string $ sendBy ,
796
796
bool $ isVariadic ,
797
797
?Type $ type ,
798
798
?Type $ phpDocType ,
@@ -816,18 +816,6 @@ public function equals(ArgInfo $other): bool {
816
816
&& $ this ->defaultValue === $ other ->defaultValue ;
817
817
}
818
818
819
- public function getSendByString (): string {
820
- switch ($ this ->sendBy ) {
821
- case self ::SEND_BY_VAL :
822
- return "0 " ;
823
- case self ::SEND_BY_REF :
824
- return "1 " ;
825
- case self ::SEND_PREFER_REF :
826
- return "ZEND_SEND_PREFER_REF " ;
827
- }
828
- throw new Exception ("Invalid sendBy value " );
829
- }
830
-
831
819
public function getMethodSynopsisType (): Type {
832
820
if ($ this ->type ) {
833
821
return $ this ->type ;
@@ -5038,14 +5026,14 @@ function funcInfoToCode(FileInfo $fileInfo, FuncInfo $funcInfo): string {
5038
5026
if ($simpleArgType->isBuiltin) {
5039
5027
$code .= sprintf(
5040
5028
"\tZEND_%s_TYPE_INFO%s(%s, %s, %s, %d%s)\n",
5041
- $argKind, $argDefaultKind, $argInfo->getSendByString() , $argInfo->name,
5029
+ $argKind, $argDefaultKind, $argInfo->sendBy , $argInfo->name,
5042
5030
$simpleArgType->toTypeCode(), $argType->isNullable(),
5043
5031
$argInfo->hasProperDefaultValue() ? ", " . $argInfo->getDefaultValueAsArginfoString() : ""
5044
5032
);
5045
5033
} else {
5046
5034
$code .= sprintf(
5047
5035
"\tZEND_%s_OBJ_INFO%s(%s, %s, %s, %d%s)\n",
5048
- $argKind,$argDefaultKind, $argInfo->getSendByString() , $argInfo->name,
5036
+ $argKind,$argDefaultKind, $argInfo->sendBy , $argInfo->name,
5049
5037
$simpleArgType->toEscapedName(), $argType->isNullable(),
5050
5038
$argInfo->hasProperDefaultValue() ? ", " . $argInfo->getDefaultValueAsArginfoString() : ""
5051
5039
);
@@ -5055,14 +5043,14 @@ function funcInfoToCode(FileInfo $fileInfo, FuncInfo $funcInfo): string {
5055
5043
if ($arginfoType->hasClassType()) {
5056
5044
$code .= sprintf(
5057
5045
"\tZEND_%s_OBJ_TYPE_MASK(%s, %s, %s, %s%s)\n",
5058
- $argKind, $argInfo->getSendByString() , $argInfo->name,
5046
+ $argKind, $argInfo->sendBy , $argInfo->name,
5059
5047
$arginfoType->toClassTypeString(), $arginfoType->toTypeMask(),
5060
5048
!$argInfo->isVariadic ? ", " . $argInfo->getDefaultValueAsArginfoString() : ""
5061
5049
);
5062
5050
} else {
5063
5051
$code .= sprintf(
5064
5052
"\tZEND_%s_TYPE_MASK(%s, %s, %s, %s)\n",
5065
- $argKind, $argInfo->getSendByString() , $argInfo->name,
5053
+ $argKind, $argInfo->sendBy , $argInfo->name,
5066
5054
$arginfoType->toTypeMask(),
5067
5055
$argInfo->getDefaultValueAsArginfoString()
5068
5056
);
@@ -5071,7 +5059,7 @@ function funcInfoToCode(FileInfo $fileInfo, FuncInfo $funcInfo): string {
5071
5059
} else {
5072
5060
$code .= sprintf(
5073
5061
"\tZEND_%s_INFO%s(%s, %s%s)\n",
5074
- $argKind, $argDefaultKind, $argInfo->getSendByString() , $argInfo->name,
5062
+ $argKind, $argDefaultKind, $argInfo->sendBy , $argInfo->name,
5075
5063
$argInfo->hasProperDefaultValue() ? ", " . $argInfo->getDefaultValueAsArginfoString() : ""
5076
5064
);
5077
5065
}
0 commit comments