@@ -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,14 @@ 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
+ if (array_key_exists ($ name , $ generatedDeclarations ) && $ generatedDeclarations [$ name ] === $ funcInfo ->cond ) {
774
+ return null ;
781
775
}
782
776
783
- $ result .= "ZEND_FUNCTION( $ funcInfo ->name ); \n" ;
784
-
785
- return $ result ;
777
+ $ generatedDeclarations [$ name ] = $ funcInfo ->cond ;
778
+ return "ZEND_FUNCTION( $ name); \n" ;
786
779
});
787
780
788
781
$ code .= "\n\nstatic const zend_function_entry ext_functions[] = { \n" ;
0 commit comments