From 47ef51cb45cbd40d307328709dc06a2233a973d5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 5 Oct 2020 15:47:26 +0200 Subject: [PATCH] Add @generate-legacy-arginfo tag --- build/gen_stub.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/gen_stub.php b/build/gen_stub.php index fba1b0a94e..41542cf97b 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -49,7 +49,7 @@ function processStubFile(string $stubFile, Context $context) { echo "Saved $arginfoFile\n"; } - if (file_exists($legacyFile)) { + if ($fileInfo->generateLegacyArginfo) { foreach ($fileInfo->getAllFuncInfos() as $funcInfo) { $funcInfo->discardInfoForOldPhpVersions(); } @@ -633,6 +633,8 @@ class FileInfo { public $generateFunctionEntries = false; /** @var string */ public $declarationPrefix = ""; + /** @var bool */ + public $generateLegacyArginfo = false; /** * @return iterable @@ -955,6 +957,8 @@ function parseStubFile(string $code): FileInfo { if ($tag->name === 'generate-function-entries') { $fileInfo->generateFunctionEntries = true; $fileInfo->declarationPrefix = $tag->value ? $tag->value . " " : ""; + } else if ($tag->name === 'generate-legacy-arginfo') { + $fileInfo->generateLegacyArginfo = true; } } } -- 2.40.0