summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/readline/readline.stub.php2
-rw-r--r--ext/readline/readline_arginfo.h2
-rw-r--r--ext/standard/basic_functions.stub.php2
-rwxr-xr-xscripts/dev/gen_stub.php11
4 files changed, 13 insertions, 4 deletions
diff --git a/ext/readline/readline.stub.php b/ext/readline/readline.stub.php
index 64b433a943..ba157b54e4 100644
--- a/ext/readline/readline.stub.php
+++ b/ext/readline/readline.stub.php
@@ -1,7 +1,7 @@
<?php
/** @return string|false */
-function readline(string $prompt = null) {}
+function readline(?string $prompt = null) {}
/** @return mixed */
function readline_info(string $varname = UNKNOWN, string $newvalue = UNKNOWN) {}
diff --git a/ext/readline/readline_arginfo.h b/ext/readline/readline_arginfo.h
index e9ce57beaa..43c8fbccbd 100644
--- a/ext/readline/readline_arginfo.h
+++ b/ext/readline/readline_arginfo.h
@@ -1,7 +1,7 @@
/* This is a generated file, edit the .stub.php file instead. */
ZEND_BEGIN_ARG_INFO_EX(arginfo_readline, 0, 0, 0)
- ZEND_ARG_TYPE_INFO(0, prompt, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, prompt, IS_STRING, 1)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_info, 0, 0, 0)
diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php
index ea1d99f1d5..0da6f99566 100644
--- a/ext/standard/basic_functions.stub.php
+++ b/ext/standard/basic_functions.stub.php
@@ -356,7 +356,7 @@ function inet_pton (string $ip_address) {}
function metaphone(string $text, int $phones = 0) {}
/* {{{ head.c */
-function header(string $string, bool $replace = true, int $http_response_code = null): void { }
+function header(string $string, bool $replace = true, int $http_response_code = 0): void { }
function header_remove(string $name = UNKNOWN): void { }
diff --git a/scripts/dev/gen_stub.php b/scripts/dev/gen_stub.php
index 47ff115da1..9fa14fc662 100755
--- a/scripts/dev/gen_stub.php
+++ b/scripts/dev/gen_stub.php
@@ -2,6 +2,7 @@
<?php declare(strict_types=1);
use PhpParser\Node;
+use PhpParser\Node\Expr;
use PhpParser\Node\Stmt;
error_reporting(E_ALL);
@@ -38,7 +39,7 @@ function processStubFile(string $stubFile) {
$arginfoCode = generateArgInfoCode($funcInfos);
file_put_contents($arginfoFile, $arginfoCode);
} catch (Exception $e) {
- echo "Caught {$e->getMessage()} while processing $stubFile\n";
+ echo "In $stubFile:\n{$e->getMessage()}\n";
exit(1);
}
}
@@ -230,6 +231,14 @@ function parseFunctionLike(string $name, Node\FunctionLike $func, ?string $cond)
throw new Exception("Error in function $name: only the last parameter can be variadic");
}
+ if ($param->default instanceof Expr\ConstFetch &&
+ $param->default->name->toLowerString() === "null" &&
+ $param->type && !($param->type instanceof Node\NullableType)
+ ) {
+ throw new Exception(
+ "Parameter $varName of function $name has null default, but is not nullable");
+ }
+
$foundVariadic = $param->variadic;
$args[] = new ArgInfo(