Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit 58be8fb

Browse files
committed
Add sprintf versions of script-related functions
1 parent 566da96 commit 58be8fb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/CodegenFile.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,13 @@ public function setShebangLine(string $shebang): this {
253253
return $this;
254254
}
255255

256+
public function setShebangLinef(
257+
SprintfFormatString $format,
258+
mixed ...$args
259+
): this {
260+
return $this->setShebangLine(vsprintf($format, $args));
261+
}
262+
256263
/**
257264
* Use to execute code before declarations.
258265
*
@@ -264,6 +271,13 @@ public function setPseudoMainHeader(string $code): this {
264271
return $this;
265272
}
266273

274+
public function setPseudoMainHeaderf(
275+
SprintfFormatString $format,
276+
mixed ...$args
277+
): this {
278+
return $this->setPseudoMainHeader(vsprintf($format, $args));
279+
}
280+
267281
/**
268282
* Use to execute code after declarations.
269283
*
@@ -275,6 +289,13 @@ public function setPseudoMainFooter(string $code): this {
275289
return $this;
276290
}
277291

292+
public function setPseudoMainFooterf(
293+
SprintfFormatString $format,
294+
mixed ...$args
295+
): this {
296+
return $this->setPseudoMainFooter(vsprintf($format, $args));
297+
}
298+
278299
private function assertNotHackStrictForExecutable(): void {
279300
invariant(
280301
$this->fileType !== CodegenFileType::HACK_STRICT,

0 commit comments

Comments
 (0)