summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-03-30 16:06:41 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-03-30 16:15:12 +0200
commit50d07ff28c9e91f310bf6145b657fccd17b09bec (patch)
treec212faee882b2fd805db7c36736fca7b67ea5ff9 /scripts
parent47ddd95836142a5bea28abab26999e72d5f85493 (diff)
downloadphp-git-50d07ff28c9e91f310bf6145b657fccd17b09bec.tar.gz
mb_detect_encoding(): Use proper array|string parameter
Needed to add support for nullabiltiy in some places.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dev/gen_stub.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/dev/gen_stub.php b/scripts/dev/gen_stub.php
index 253c188b2a..f3a9a492b0 100755
--- a/scripts/dev/gen_stub.php
+++ b/scripts/dev/gen_stub.php
@@ -373,9 +373,10 @@ function parseFunctionLike(string $name, Node\FunctionLike $func, ?string $cond)
throw new Exception("Error in function $name: only the last parameter can be variadic");
}
+ $type = $param->type ? Type::fromNode($param->type) : null;
if ($param->default instanceof Expr\ConstFetch &&
$param->default->name->toLowerString() === "null" &&
- $param->type && !($param->type instanceof Node\NullableType)
+ $type && !$type->isNullable()
) {
throw new Exception(
"Parameter $varName of function $name has null default, but is not nullable");
@@ -387,7 +388,7 @@ function parseFunctionLike(string $name, Node\FunctionLike $func, ?string $cond)
$varName,
$sendBy,
$param->variadic,
- $param->type ? Type::fromNode($param->type) : null
+ $type
);
if (!$param->default && !$param->variadic) {
$numRequiredArgs = $i + 1;