Skip to content

Commit 8a40689

Browse files
committed
Clarify that token_get_all() never returns false
It can only fail in TOKEN_PARSE mode, in which case it will throw.
1 parent 95ea8b0 commit 8a40689

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

ext/tokenizer/tokenizer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,9 @@ PHP_FUNCTION(token_get_all)
274274
zend_clear_exception();
275275
}
276276

277-
if (!success) RETURN_FALSE;
277+
if (!success) {
278+
RETURN_THROWS();
279+
}
278280
}
279281
/* }}} */
280282

ext/tokenizer/tokenizer.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22

3-
function token_get_all(string $source, int $flags = 0): array|false {}
3+
function token_get_all(string $source, int $flags = 0): array {}
44

55
function token_name(int $token): string {}

ext/tokenizer/tokenizer_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* This is a generated file, edit the .stub.php file instead. */
22

3-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_token_get_all, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
3+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_token_get_all, 0, 1, IS_ARRAY, 0)
44
ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
55
ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
66
ZEND_END_ARG_INFO()

0 commit comments

Comments
 (0)