summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/readline/readline.c6
-rw-r--r--ext/readline/readline.stub.php11
-rw-r--r--ext/readline/readline_arginfo.h8
3 files changed, 14 insertions, 11 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index deb55c834e..d9cf8bd8a9 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -147,7 +147,7 @@ PHP_FUNCTION(readline_info)
size_t what_len, oldval;
char *oldstr;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|sz", &what, &what_len, &value) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!z!", &what, &what_len, &value) == FAILURE) {
RETURN_THROWS();
}
@@ -366,7 +366,7 @@ PHP_FUNCTION(readline_read_history)
char *arg = NULL;
size_t arg_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|p", &arg, &arg_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|p!", &arg, &arg_len) == FAILURE) {
RETURN_THROWS();
}
@@ -391,7 +391,7 @@ PHP_FUNCTION(readline_write_history)
char *arg = NULL;
size_t arg_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|p", &arg, &arg_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|p!", &arg, &arg_len) == FAILURE) {
RETURN_THROWS();
}
diff --git a/ext/readline/readline.stub.php b/ext/readline/readline.stub.php
index 7cf2b8b144..a375ef444e 100644
--- a/ext/readline/readline.stub.php
+++ b/ext/readline/readline.stub.php
@@ -4,8 +4,11 @@
function readline(?string $prompt = null): string|false {}
-/** @return mixed */
-function readline_info(string $varname = UNKNOWN, string $newvalue = UNKNOWN) {}
+/**
+ * @param int|string|bool|null $newvalue
+ * @return array|int|string|bool|null
+ */
+function readline_info(?string $varname = null, $newvalue = null): mixed {}
function readline_add_history(string $prompt): bool {}
@@ -15,9 +18,9 @@ function readline_clear_history(): bool {}
function readline_list_history(): array {}
#endif
-function readline_read_history(string $filename = UNKNOWN): bool {}
+function readline_read_history(?string $filename = null): bool {}
-function readline_write_history(string $filename = UNKNOWN): bool {}
+function readline_write_history(?string $filename = null): bool {}
/**
* @param callable $funcname
diff --git a/ext/readline/readline_arginfo.h b/ext/readline/readline_arginfo.h
index 88b286bc37..989163efd5 100644
--- a/ext/readline/readline_arginfo.h
+++ b/ext/readline/readline_arginfo.h
@@ -4,9 +4,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_readline, 0, 0, MAY_BE_STRING|MA
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, prompt, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_info, 0, 0, 0)
- ZEND_ARG_TYPE_INFO(0, varname, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, newvalue, IS_STRING, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_info, 0, 0, IS_MIXED, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, varname, IS_STRING, 1, "null")
+ ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, newvalue, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_add_history, 0, 1, _IS_BOOL, 0)
@@ -22,7 +22,7 @@ ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_read_history, 0, 0, _IS_BOOL, 0)
- ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filename, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_readline_write_history arginfo_readline_read_history