Skip to content

Commit 50a90f1

Browse files
committed
Address code review comments
1 parent 96c9743 commit 50a90f1

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

build/gen_stub.php

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ function parseDocComment(DocComment $comment): array {
422422
$commentText = substr($comment->getText(), 2, -2);
423423
$tags = [];
424424
foreach (explode("\n", $commentText) as $commentLine) {
425-
$regex = '/^\*\s*@([a-z-]+)(?:\s+(.+))$/';
425+
$regex = '/^\*\s*@([a-z-]+)(?:\s+(.+))?$/';
426426
if (preg_match($regex, trim($commentLine), $matches, PREG_UNMATCHED_AS_NULL)) {
427427
$tags[] = new DocCommentTag($matches[1], $matches[2]);
428428
}
@@ -743,6 +743,7 @@ function generateCodeWithConditions(
743743
}
744744

745745
function generateArgInfoCode(FileInfo $fileInfo): string {
746+
$generatedDeclarations = [];
746747
$funcInfos = $fileInfo->funcInfos;
747748

748749
$code = "/* This is a generated file, edit the .stub.php file instead. */\n";
@@ -767,22 +768,15 @@ function(FuncInfo $funcInfo) use(&$generatedFuncInfos) {
767768

768769
if ($fileInfo->generateFunctionEntries) {
769770
$code .= "\n\n";
770-
$code .= generateCodeWithConditions($funcInfos, "", function(FuncInfo $funcInfo) use ($funcInfos) {
771-
$result = "";
772-
773-
if ($funcInfo->alias) {
774-
foreach ($funcInfos as $info) {
775-
if ($info->name === $funcInfo->alias) {
776-
return null;
777-
}
778-
}
779-
780-
$result .= "ZEND_FUNCTION($funcInfo->alias);\n";
771+
$code .= generateCodeWithConditions($funcInfos, "", function(FuncInfo $funcInfo) use (&$generatedDeclarations) {
772+
$name = $funcInfo->alias ?? $funcInfo->name;
773+
$key = "$name|$funcInfo->cond";
774+
if (isset($generatedDeclarations[$key])) {
775+
return null;
781776
}
782777

783-
$result .= "ZEND_FUNCTION($funcInfo->name);\n";
784-
785-
return $result;
778+
$generatedDeclarations[$key] = true;
779+
return "ZEND_FUNCTION($name);\n";
786780
});
787781

788782
$code .= "\n\nstatic const zend_function_entry ext_functions[] = {\n";

ext/bz2/bz2_arginfo.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,8 @@ ZEND_END_ARG_INFO()
4949
ZEND_FUNCTION(bzopen);
5050
ZEND_FUNCTION(bzread);
5151
ZEND_FUNCTION(fwrite);
52-
ZEND_FUNCTION(bzwrite);
5352
ZEND_FUNCTION(fflush);
54-
ZEND_FUNCTION(bzflush);
5553
ZEND_FUNCTION(fclose);
56-
ZEND_FUNCTION(bzclose);
5754
ZEND_FUNCTION(bzerrno);
5855
ZEND_FUNCTION(bzerrstr);
5956
ZEND_FUNCTION(bzerror);

ext/zend_test/test.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function zend_test_nullable_array_return(): ?array {}
1818

1919
function zend_test_void_return(): void {}
2020

21-
/** @deprecated since 5.0 */
21+
/** @deprecated */
2222
function zend_test_deprecated(): void {}
2323

2424
function zend_create_unterminated_string(string $str): string {}

0 commit comments

Comments
 (0)