@@ -1118,6 +1118,10 @@ public function getDeclarationClassName(): string {
11181118 return implode ('_ ' , $ this ->className ->getParts ());
11191119 }
11201120
1121+ public function getDeclarationName (): string {
1122+ return "{$ this ->getDeclarationClassName ()}_ {$ this ->methodName }" ;
1123+ }
1124+
11211125 public function getDeclaration (): string {
11221126 return "ZEND_METHOD( {$ this ->getDeclarationClassName ()}, $ this ->methodName ); \n" ;
11231127 }
@@ -1126,6 +1130,10 @@ public function getArgInfoName(): string {
11261130 return "arginfo_class_ {$ this ->getDeclarationClassName ()}_ {$ this ->methodName }" ;
11271131 }
11281132
1133+ public function getFramelessFunctionInfosName (): string {
1134+ return "frameless_function_infos_ {$ this ->className }_ {$ this ->methodName }" ;
1135+ }
1136+
11291137 public function getMethodSynopsisFilename (): string
11301138 {
11311139 $ parts = [...$ this ->className ->getParts (), ltrim ($ this ->methodName , '_ ' )];
@@ -1396,12 +1404,12 @@ public function getFramelessDeclaration(FuncInfo $funcInfo): ?string {
13961404 }
13971405
13981406 foreach ($ this ->framelessFunctionInfos as $ framelessFunctionInfo ) {
1399- $ code .= "ZEND_FRAMELESS_FUNCTION( {$ this ->name ->getFunctionName ()}, {$ framelessFunctionInfo ->arity }); \n" ;
1407+ $ code .= "ZEND_FRAMELESS_FUNCTION( {$ this ->name ->getDeclarationName ()}, {$ framelessFunctionInfo ->arity }); \n" ;
14001408 }
14011409
14021410 $ code .= 'static const zend_frameless_function_info ' . $ this ->getFramelessFunctionInfosName () . "[] = { \n" ;
14031411 foreach ($ this ->framelessFunctionInfos as $ framelessFunctionInfo ) {
1404- $ code .= "\t{ ZEND_FRAMELESS_FUNCTION_NAME( {$ this ->name ->getFunctionName ()}, {$ framelessFunctionInfo ->arity }), {$ framelessFunctionInfo ->arity } }, \n" ;
1412+ $ code .= "\t{ ZEND_FRAMELESS_FUNCTION_NAME( {$ this ->name ->getDeclarationName ()}, {$ framelessFunctionInfo ->arity }), {$ framelessFunctionInfo ->arity } }, \n" ;
14051413 }
14061414 $ code .= "\t{ 0 }, \n" ;
14071415 $ code .= "}; \n" ;
@@ -1427,10 +1435,10 @@ public function getFunctionEntry(): string {
14271435 $ functionEntryCode = null ;
14281436
14291437 if (!empty ($ this ->framelessFunctionInfos )) {
1430- if ($ this ->isMethod ()) {
1431- throw new Exception ('Frameless methods are not supported yet ' );
1438+ if ($ this ->isMethod () && !( $ this -> flags & Modifiers:: STATIC ) ) {
1439+ throw new Exception ('Frameless methods must be static ' );
14321440 }
1433- if ($ this ->name ->getNamespace ()) {
1441+ if (! $ this -> isMethod () && $ this ->name ->getNamespace ()) {
14341442 throw new Exception ('Namespaced direct calls to frameless functions are not supported yet ' );
14351443 }
14361444 if ($ this ->alias ) {
@@ -5161,7 +5169,7 @@ function findEquivalentFuncInfo(array $generatedFuncInfos, FuncInfo $funcInfo):
51615169function generateCodeWithConditions(
51625170 iterable $infos, string $separator, Closure $codeGenerator, ?string $parentCond = null): string {
51635171 $code = "";
5164-
5172+
51655173 // For combining the conditional blocks of the infos with the same condition
51665174 $openCondition = null;
51675175 foreach ($infos as $info) {
0 commit comments