]> granicus.if.org Git - php/commitdiff
Add stubs for filter extension
authorHenrique Duarte <henrique.duarte@convenia.com.br>
Thu, 15 Aug 2019 17:45:22 +0000 (14:45 -0300)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 20 Aug 2019 09:04:25 +0000 (11:04 +0200)
Closes GH-4542.

ext/filter/filter.c
ext/filter/filter.stub.php [new file with mode: 0644]
ext/filter/filter_arginfo.h [new file with mode: 0644]

index a38aafcf365e3f3d96c6efc58101edfb2d53c65b..46acfab029eac704b58a68bcde4527fc071f9134 100644 (file)
@@ -28,6 +28,7 @@
 ZEND_DECLARE_MODULE_GLOBALS(filter)
 
 #include "filter_private.h"
+#include "filter_arginfo.h"
 
 typedef struct filter_list_entry {
        const char *name;
@@ -80,45 +81,6 @@ static const filter_list_entry filter_list[] = {
 static unsigned int php_sapi_filter(int arg, char *var, char **val, size_t val_len, size_t *new_val_len);
 static unsigned int php_sapi_filter_init(void);
 
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input, 0, 0, 2)
-       ZEND_ARG_INFO(0, type)
-       ZEND_ARG_INFO(0, variable_name)
-       ZEND_ARG_INFO(0, filter)
-       ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var, 0, 0, 1)
-       ZEND_ARG_INFO(0, variable)
-       ZEND_ARG_INFO(0, filter)
-       ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input_array, 0, 0, 1)
-       ZEND_ARG_INFO(0, type)
-       ZEND_ARG_INFO(0, definition)
-       ZEND_ARG_INFO(0, add_empty)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var_array, 0, 0, 1)
-       ZEND_ARG_INFO(0, data)
-       ZEND_ARG_INFO(0, definition)
-       ZEND_ARG_INFO(0, add_empty)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_filter_list, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_has_var, 0, 0, 2)
-       ZEND_ARG_INFO(0, type)
-       ZEND_ARG_INFO(0, variable_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_id, 0, 0, 1)
-       ZEND_ARG_INFO(0, filtername)
-ZEND_END_ARG_INFO()
-/* }}} */
-
 /* {{{ filter_functions[]
  */
 static const zend_function_entry filter_functions[] = {
diff --git a/ext/filter/filter.stub.php b/ext/filter/filter.stub.php
new file mode 100644 (file)
index 0000000..a4b15cd
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+function filter_has_var(int $type, string $variable_name): bool {}
+
+/**
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_input(int $type, string $variable_name, int $filter = FILTER_DEFAULT, $options = NULL) {}
+
+/**
+ * @param mixed $variable
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_var($variable, int $filter = FILTER_DEFAULT, $options = NULL) {}
+
+/**
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_input_array(int $type, $options = NULL, bool $add_empty = true) {}
+
+/**
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_var_array(array $data, $options = NULL, bool $add_empty = true) {}
+
+function filter_list(): array {}
+
+/**
+ * @return int|false
+ */
+function filter_id(string $filtername) {}
diff --git a/ext/filter/filter_arginfo.h b/ext/filter/filter_arginfo.h
new file mode 100644 (file)
index 0000000..f5ed690
--- /dev/null
@@ -0,0 +1,38 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_has_var, 0, 2, _IS_BOOL, 0)
+       ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO(0, variable_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input, 0, 0, 2)
+       ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO(0, variable_name, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO(0, filter, IS_LONG, 0)
+       ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var, 0, 0, 1)
+       ZEND_ARG_INFO(0, variable)
+       ZEND_ARG_TYPE_INFO(0, filter, IS_LONG, 0)
+       ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input_array, 0, 0, 1)
+       ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+       ZEND_ARG_INFO(0, options)
+       ZEND_ARG_TYPE_INFO(0, add_empty, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var_array, 0, 0, 1)
+       ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+       ZEND_ARG_INFO(0, options)
+       ZEND_ARG_TYPE_INFO(0, add_empty, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_list, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_id, 0, 0, 1)
+       ZEND_ARG_TYPE_INFO(0, filtername, IS_STRING, 0)
+ZEND_END_ARG_INFO()