]> granicus.if.org Git - php/commitdiff
Add stubs for SAPIs
authorMáté Kocsis <kocsismate@woohoolabs.com>
Wed, 25 Mar 2020 10:53:06 +0000 (11:53 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 10 Jul 2020 12:20:18 +0000 (14:20 +0200)
Closes GH-5295.

sapi/cgi/cgi_main.c
sapi/cgi/cgi_main.stub.php [new file with mode: 0644]
sapi/cgi/cgi_main_arginfo.h [new file with mode: 0644]
sapi/cli/php_cli.c
sapi/cli/php_cli_process_title.h
sapi/cli/php_cli_process_title.stub.php [new file with mode: 0644]
sapi/cli/php_cli_process_title_arginfo.h [new file with mode: 0644]
sapi/cli/php_cli_server.c
sapi/cli/php_cli_server.stub.php [new file with mode: 0644]
sapi/cli/php_cli_server_arginfo.h [new file with mode: 0644]
sapi/embed/php_embed.c

index acbe69a7a922805a2f2518eca65106958b2899b8..8048085ebe0ee0853967931a3857715858177497 100644 (file)
@@ -63,6 +63,7 @@
 #include "fopen_wrappers.h"
 #include "http_status_codes.h"
 #include "ext/standard/php_standard.h"
+#include "ext/standard/dl_arginfo.h"
 #include "ext/standard/url.h"
 
 #ifdef PHP_WIN32
@@ -83,6 +84,7 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS;
 #include "php_getopt.h"
 
 #include "fastcgi.h"
+#include "cgi_main_arginfo.h"
 
 #if defined(PHP_WIN32) && defined(HAVE_OPENSSL)
 # include "openssl/applink.c"
@@ -1006,12 +1008,6 @@ static sapi_module_struct cgi_sapi_module = {
 };
 /* }}} */
 
-/* {{{ arginfo ext/standard/dl.c */
-ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
-       ZEND_ARG_INFO(0, extension_filename)
-ZEND_END_ARG_INFO()
-/* }}} */
-
 static const zend_function_entry additional_functions[] = {
        ZEND_FE(dl, arginfo_dl)
        PHP_FE_END
@@ -1704,21 +1700,10 @@ PHP_FUNCTION(apache_response_headers) /* {{{ */
 }
 /* }}} */
 
-ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0)
-ZEND_END_ARG_INFO()
-
-static const zend_function_entry cgi_functions[] = {
-       PHP_FE(apache_child_terminate, arginfo_no_args)
-       PHP_FE(apache_request_headers, arginfo_no_args)
-       PHP_FE(apache_response_headers, arginfo_no_args)
-       PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
-       PHP_FE_END
-};
-
 static zend_module_entry cgi_module_entry = {
        STANDARD_MODULE_HEADER,
        "cgi-fcgi",
-       cgi_functions,
+       ext_functions,
        PHP_MINIT(cgi),
        PHP_MSHUTDOWN(cgi),
        NULL,
diff --git a/sapi/cgi/cgi_main.stub.php b/sapi/cgi/cgi_main.stub.php
new file mode 100644 (file)
index 0000000..8273cff
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+/** @generate-function-entries */
+
+function apache_child_terminate(): void {}
+
+function apache_request_headers(): array {}
+
+/** @alias apache_request_headers */
+function getallheaders(): array {}
+
+function apache_response_headers(): array {}
diff --git a/sapi/cgi/cgi_main_arginfo.h b/sapi/cgi/cgi_main_arginfo.h
new file mode 100644 (file)
index 0000000..2eaab87
--- /dev/null
@@ -0,0 +1,26 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: ccb32ad91944af15fe1fcb44b97c28a79c1aad86 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_child_terminate, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_getallheaders arginfo_apache_request_headers
+
+#define arginfo_apache_response_headers arginfo_apache_request_headers
+
+
+ZEND_FUNCTION(apache_child_terminate);
+ZEND_FUNCTION(apache_request_headers);
+ZEND_FUNCTION(apache_response_headers);
+
+
+static const zend_function_entry ext_functions[] = {
+       ZEND_FE(apache_child_terminate, arginfo_apache_child_terminate)
+       ZEND_FE(apache_request_headers, arginfo_apache_request_headers)
+       ZEND_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
+       ZEND_FE(apache_response_headers, arginfo_apache_response_headers)
+       ZEND_FE_END
+};
index 9972b0f7a74129548db5c481164a30426becf64b..845312e9c682e7ce01e7dc88bce06bf7ec259854 100644 (file)
@@ -54,6 +54,7 @@
 #include "php_main.h"
 #include "fopen_wrappers.h"
 #include "ext/standard/php_standard.h"
+#include "ext/standard/dl_arginfo.h"
 #include "cli.h"
 #ifdef PHP_WIN32
 #include <io.h>
@@ -78,6 +79,7 @@
 
 #include "ps_title.h"
 #include "php_cli_process_title.h"
+#include "php_cli_process_title_arginfo.h"
 
 #ifndef PHP_WIN32
 # define php_select(m, r, w, e, t)     select(m, r, w, e, t)
@@ -457,12 +459,6 @@ static sapi_module_struct cli_sapi_module = {
 };
 /* }}} */
 
-/* {{{ arginfo ext/standard/dl.c */
-ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
-       ZEND_ARG_INFO(0, extension_filename)
-ZEND_END_ARG_INFO()
-/* }}} */
-
 static const zend_function_entry additional_functions[] = {
        ZEND_FE(dl, arginfo_dl)
        PHP_FE(cli_set_process_title,        arginfo_cli_set_process_title)
index 74766491d726fdf11ea5c45aaf08f2e5367d3933..c286f401c7d9fa926824724794fd7f51151b03da 100644 (file)
 #ifndef PHP_PS_TITLE_HEADER
 #define PHP_PS_TITLE_HEADER
 
-ZEND_BEGIN_ARG_INFO(arginfo_cli_set_process_title, 0)
-    ZEND_ARG_INFO(0, title)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_cli_get_process_title, 0)
-ZEND_END_ARG_INFO()
-
 PHP_FUNCTION(cli_set_process_title);
 PHP_FUNCTION(cli_get_process_title);
 
diff --git a/sapi/cli/php_cli_process_title.stub.php b/sapi/cli/php_cli_process_title.stub.php
new file mode 100644 (file)
index 0000000..97dc8b2
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+
+function cli_set_process_title(string $title): bool {}
+
+function cli_get_process_title(): ?string {}
diff --git a/sapi/cli/php_cli_process_title_arginfo.h b/sapi/cli/php_cli_process_title_arginfo.h
new file mode 100644 (file)
index 0000000..9318640
--- /dev/null
@@ -0,0 +1,9 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: ee776e0c54fe4b66a98b3a0203af11c5f3082e38 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cli_set_process_title, 0, 1, _IS_BOOL, 0)
+       ZEND_ARG_TYPE_INFO(0, title, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cli_get_process_title, 0, 0, IS_STRING, 1)
+ZEND_END_ARG_INFO()
index 59929f21c99b8482f0b9649e0421c354e896eddd..b385f877e5bda58da93fe427b3d728792b7801ce 100644 (file)
 
 #include "php_http_parser.h"
 #include "php_cli_server.h"
+#include "php_cli_server_arginfo.h"
 #include "mime_type_map.h"
 
 #include "php_cli_process_title.h"
+#include "php_cli_process_title_arginfo.h"
 
 #define OUTPUT_NOT_CHECKED -1
 #define OUTPUT_IS_TTY 1
@@ -479,15 +481,12 @@ zend_module_entry cli_server_module_entry = {
 };
 /* }}} */
 
-ZEND_BEGIN_ARG_INFO(arginfo_no_args, 0)
-ZEND_END_ARG_INFO()
-
 const zend_function_entry server_additional_functions[] = {
-       PHP_FE(cli_set_process_title,        arginfo_cli_set_process_title)
-       PHP_FE(cli_get_process_title,        arginfo_cli_get_process_title)
-       PHP_FE(apache_request_headers, arginfo_no_args)
-       PHP_FE(apache_response_headers, arginfo_no_args)
-       PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
+       PHP_FE(cli_set_process_title,   arginfo_cli_set_process_title)
+       PHP_FE(cli_get_process_title,   arginfo_cli_get_process_title)
+       PHP_FE(apache_request_headers,  arginfo_apache_request_headers)
+       PHP_FE(apache_response_headers, arginfo_apache_response_headers)
+       PHP_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
        PHP_FE_END
 };
 
diff --git a/sapi/cli/php_cli_server.stub.php b/sapi/cli/php_cli_server.stub.php
new file mode 100644 (file)
index 0000000..59706ba
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+
+function apache_request_headers(): array {}
+
+function apache_response_headers(): array {}
+
+function getallheaders(): array {}
diff --git a/sapi/cli/php_cli_server_arginfo.h b/sapi/cli/php_cli_server_arginfo.h
new file mode 100644 (file)
index 0000000..eb113ae
--- /dev/null
@@ -0,0 +1,9 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: 60cd531d36a34fe7c51982e9ec40b45d2a2a4ce7 */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_apache_response_headers arginfo_apache_request_headers
+
+#define arginfo_getallheaders arginfo_apache_request_headers
index 184445e380ceae3fa5af72d6450bab4122345e1d..b510d5105e5f62874be5ff788b743ec1dfa8a635 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "php_embed.h"
 #include "ext/standard/php_standard.h"
+#include "ext/standard/dl_arginfo.h"
 
 #ifdef PHP_WIN32
 #include <io.h>
@@ -142,12 +143,6 @@ EMBED_SAPI_API sapi_module_struct php_embed_module = {
 };
 /* }}} */
 
-/* {{{ arginfo ext/standard/dl.c */
-ZEND_BEGIN_ARG_INFO(arginfo_dl, 0)
-       ZEND_ARG_INFO(0, extension_filename)
-ZEND_END_ARG_INFO()
-/* }}} */
-
 static const zend_function_entry additional_functions[] = {
        ZEND_FE(dl, arginfo_dl)
        ZEND_FE_END