Skip to content

Commit 4af64fd

Browse files
DanielEScherzerkocsismate
authored andcommitted
gen_stub: convert parseFramelessFunctionInfo() to a constructor
Also mark `FramelessFunctionInfo::$arity` readonly
1 parent 9da6050 commit 4af64fd

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

build/gen_stub.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4238,15 +4238,14 @@ function parseDocComment(DocComment $comment): array {
42384238
}
42394239

42404240
class FramelessFunctionInfo {
4241-
public int $arity;
4242-
}
4241+
public /* readonly */ int $arity;
4242+
4243+
public function __construct(string $json) {
4244+
// FIXME: Should have some validation
4245+
$json = json_decode($json, true);
42434246

4244-
function parseFramelessFunctionInfo(string $json): FramelessFunctionInfo {
4245-
// FIXME: Should have some validation
4246-
$json = json_decode($json, true);
4247-
$framelessFunctionInfo = new FramelessFunctionInfo();
4248-
$framelessFunctionInfo->arity = $json["arity"];
4249-
return $framelessFunctionInfo;
4247+
$this->arity = $json["arity"];
4248+
}
42504249
}
42514250

42524251
function parseFunctionLike(
@@ -4330,7 +4329,7 @@ function parseFunctionLike(
43304329
break;
43314330

43324331
case 'frameless-function':
4333-
$framelessFunctionInfos[] = parseFramelessFunctionInfo($tag->getValue());
4332+
$framelessFunctionInfos[] = new FramelessFunctionInfo($tag->getValue());
43344333
break;
43354334
}
43364335
}

0 commit comments

Comments
 (0)