summaryrefslogtreecommitdiff
path: root/ext/tokenizer
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-02-14 16:49:43 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-02-14 16:50:12 +0100
commit8a4068988b26e5411edfad6ceeb14cda3b9245e8 (patch)
treee8ef636466de8a65f42d288d125010a65821a9bc /ext/tokenizer
parent95ea8b08b85336ec00615984e19b7b4bbfb4af1a (diff)
downloadphp-git-8a4068988b26e5411edfad6ceeb14cda3b9245e8.tar.gz
Clarify that token_get_all() never returns false
It can only fail in TOKEN_PARSE mode, in which case it will throw.
Diffstat (limited to 'ext/tokenizer')
-rw-r--r--ext/tokenizer/tokenizer.c4
-rw-r--r--ext/tokenizer/tokenizer.stub.php2
-rw-r--r--ext/tokenizer/tokenizer_arginfo.h2
3 files changed, 5 insertions, 3 deletions
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index cf5be94226..1ac5275ff0 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -274,7 +274,9 @@ PHP_FUNCTION(token_get_all)
zend_clear_exception();
}
- if (!success) RETURN_FALSE;
+ if (!success) {
+ RETURN_THROWS();
+ }
}
/* }}} */
diff --git a/ext/tokenizer/tokenizer.stub.php b/ext/tokenizer/tokenizer.stub.php
index f42825d7dc..63a6c2e72c 100644
--- a/ext/tokenizer/tokenizer.stub.php
+++ b/ext/tokenizer/tokenizer.stub.php
@@ -1,5 +1,5 @@
<?php
-function token_get_all(string $source, int $flags = 0): array|false {}
+function token_get_all(string $source, int $flags = 0): array {}
function token_name(int $token): string {}
diff --git a/ext/tokenizer/tokenizer_arginfo.h b/ext/tokenizer/tokenizer_arginfo.h
index 4cf8c65fe3..d777535a48 100644
--- a/ext/tokenizer/tokenizer_arginfo.h
+++ b/ext/tokenizer/tokenizer_arginfo.h
@@ -1,6 +1,6 @@
/* This is a generated file, edit the .stub.php file instead. */
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_token_get_all, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_token_get_all, 0, 1, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
ZEND_END_ARG_INFO()