Browse Source

feat: add stub PHP functions (#10)

Kévin Dunglas 2 years ago
parent
commit
46ec897d2e
3 changed files with 27 additions and 15 deletions
  1. 7 15
      frankenphp.c
  2. 5 0
      frankenphp.stub.php
  3. 15 0
      frankenphp_arginfo.h

+ 7 - 15
frankenphp.c

@@ -16,6 +16,7 @@
 #include "C-Thread-Pool/thpool.h"
 #include "C-Thread-Pool/thpool.c"
 
+#include "frankenphp_arginfo.h"
 #include "_cgo_export.h"
 
 #if defined(PHP_WIN32) && defined(ZTS)
@@ -118,10 +119,6 @@ int frankenphp_worker_request_startup() {
 	return retval;
 }
 
-ZEND_BEGIN_ARG_INFO_EX(arginfo_frankenphp_handle_request, 0, 0, 1)
-    ZEND_ARG_CALLABLE_INFO(false, handler, false)
-ZEND_END_ARG_INFO()
-
 PHP_FUNCTION(frankenphp_handle_request) {
 	zend_fcall_info fci;
 	zend_fcall_info_cache fcc;
@@ -193,20 +190,15 @@ PHP_FUNCTION(frankenphp_handle_request) {
 	RETURN_TRUE;
 }
 
-static const zend_function_entry frankenphp_ext_functions[] = {
-    PHP_FE(frankenphp_handle_request, arginfo_frankenphp_handle_request)
-    PHP_FE_END
-};
-
 static zend_module_entry frankenphp_module = {
     STANDARD_MODULE_HEADER,
     "frankenphp",
-    frankenphp_ext_functions,	/* function table */
-    NULL,						/* initialization */
-    NULL,						/* shutdown */
-    NULL,						/* request initialization */
-    NULL,						/* request shutdown */
-    NULL,						/* information */
+    ext_functions,	/* function table */
+    NULL,			/* initialization */
+    NULL,			/* shutdown */
+    NULL,			/* request initialization */
+    NULL,			/* request shutdown */
+    NULL,			/* information */
     "dev",
     STANDARD_MODULE_PROPERTIES
 };

+ 5 - 0
frankenphp.stub.php

@@ -0,0 +1,5 @@
+<?php
+
+/** @generate-class-entries */
+
+function frankenphp_handle_request(callable $callback): bool {}

+ 15 - 0
frankenphp_arginfo.h

@@ -0,0 +1,15 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: f2e8375a3acb3080fc6c329eafc47155f0702c85 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_frankenphp_handle_request, 0, 1, _IS_BOOL, 0)
+	ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
+ZEND_END_ARG_INFO()
+
+
+ZEND_FUNCTION(frankenphp_handle_request);
+
+
+static const zend_function_entry ext_functions[] = {
+	ZEND_FE(frankenphp_handle_request, arginfo_frankenphp_handle_request)
+	ZEND_FE_END
+};