@@ -422,7 +422,7 @@ function parseDocComment(DocComment $comment): array {
422
422
$ commentText = substr ($ comment ->getText (), 2 , -2 );
423
423
$ tags = [];
424
424
foreach (explode ("\n" , $ commentText ) as $ commentLine ) {
425
- $ regex = '/^\*\s*@([a-z-]+)(?:\s+(.+))$/ ' ;
425
+ $ regex = '/^\*\s*@([a-z-]+)(?:\s+(.+))? $/ ' ;
426
426
if (preg_match ($ regex , trim ($ commentLine ), $ matches , PREG_UNMATCHED_AS_NULL )) {
427
427
$ tags [] = new DocCommentTag ($ matches [1 ], $ matches [2 ]);
428
428
}
@@ -743,6 +743,7 @@ function generateCodeWithConditions(
743
743
}
744
744
745
745
function generateArgInfoCode (FileInfo $ fileInfo ): string {
746
+ $ generatedDeclarations = [];
746
747
$ funcInfos = $ fileInfo ->funcInfos ;
747
748
748
749
$ code = "/* This is a generated file, edit the .stub.php file instead. */ \n" ;
@@ -767,22 +768,15 @@ function(FuncInfo $funcInfo) use(&$generatedFuncInfos) {
767
768
768
769
if ($ fileInfo ->generateFunctionEntries ) {
769
770
$ 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 ;
781
776
}
782
777
783
- $ result .= "ZEND_FUNCTION( $ funcInfo ->name ); \n" ;
784
-
785
- return $ result ;
778
+ $ generatedDeclarations [$ key ] = true ;
779
+ return "ZEND_FUNCTION( $ name); \n" ;
786
780
});
787
781
788
782
$ code .= "\n\nstatic const zend_function_entry ext_functions[] = { \n" ;
0 commit comments