Skip to content

Commit 517ac20

Browse files
committed
Remove special handling of exit/die in stubs
PHP-Parser 5.3.1 allows these as function names to allow direct use in stubs.
1 parent 8ca1313 commit 517ac20

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

build/gen_stub.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,9 @@ function processStubFile(string $stubFile, Context $context, bool $includeOnly =
8383
}
8484
}
8585

86-
/* Because exit() and die() are proper token/keywords we need to hack-around */
87-
$hasSpecialExitAsFunctionHandling = str_ends_with($stubFile, 'zend_builtin_functions.stub.php');
8886
if (!$fileInfo = $context->parsedFiles[$stubFile] ?? null) {
8987
initPhpParser();
9088
$stubContent = $stubCode ?? file_get_contents($stubFile);
91-
if ($hasSpecialExitAsFunctionHandling) {
92-
$stubContent = str_replace(['exit', 'die'], ['exit_dummy', 'die_dummy'], $stubContent);
93-
}
9489
$fileInfo = parseStubFile($stubContent);
9590
$context->parsedFiles[$stubFile] = $fileInfo;
9691

@@ -124,9 +119,6 @@ function processStubFile(string $stubFile, Context $context, bool $includeOnly =
124119
$context->allConstInfos,
125120
$stubHash
126121
);
127-
if ($hasSpecialExitAsFunctionHandling) {
128-
$arginfoCode = str_replace(['exit_dummy', 'die_dummy'], ['exit', 'die'], $arginfoCode);
129-
}
130122
if (($context->forceRegeneration || $stubHash !== $oldStubHash) && file_put_contents($arginfoFile, $arginfoCode)) {
131123
echo "Saved $arginfoFile\n";
132124
}
@@ -6152,7 +6144,7 @@ function initPhpParser() {
61526144
}
61536145

61546146
$isInitialized = true;
6155-
$version = "5.0.0";
6147+
$version = "5.3.1";
61566148
$phpParserDir = __DIR__ . "/PHP-Parser-$version";
61576149
if (!is_dir($phpParserDir)) {
61586150
installPhpParser($version, $phpParserDir);

0 commit comments

Comments
 (0)