diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-04-13 10:41:23 +0200 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-04-14 14:38:45 +0200 |
commit | 1f48feebb9be61cfd613f8fc62af87fa53bc741b (patch) | |
tree | dbe03782c5638e3f6de9f1eb287cbb724b432c1d /ext/tokenizer | |
parent | 11c5c78401b803a8292958731a66ba39528fee0f (diff) | |
download | php-git-1f48feebb9be61cfd613f8fc62af87fa53bc741b.tar.gz |
Improve some TypeError and ValueError messages
Closes GH-5377
Diffstat (limited to 'ext/tokenizer')
-rw-r--r-- | ext/tokenizer/tests/PhpToken_methods.phpt | 4 | ||||
-rw-r--r-- | ext/tokenizer/tokenizer.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/ext/tokenizer/tests/PhpToken_methods.phpt b/ext/tokenizer/tests/PhpToken_methods.phpt index 9429cea7ed..3e08f3c39e 100644 --- a/ext/tokenizer/tests/PhpToken_methods.phpt +++ b/ext/tokenizer/tests/PhpToken_methods.phpt @@ -108,8 +108,8 @@ bool(false) bool(false) Error: -Kind must be of type int, string or array -Kind array must have elements of type int or string +PhpToken::is(): Argument #1 ($kind) must be of type string|int|array, float given +PhpToken::is(): Argument #1 ($kind) must only have elements of type string|int, float given Typed property PhpToken::$id must not be accessed before initialization Typed property PhpToken::$text must not be accessed before initialization Typed property PhpToken::$id must not be accessed before initialization diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index f07a839bb6..db57323223 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -192,13 +192,13 @@ PHP_METHOD(PhpToken, is) RETURN_TRUE; } } else { - zend_type_error("Kind array must have elements of type int or string"); + zend_argument_type_error(1, "must only have elements of type string|int, %s given", zend_zval_type_name(entry)); RETURN_THROWS(); } } ZEND_HASH_FOREACH_END(); RETURN_FALSE; } else { - zend_type_error("Kind must be of type int, string or array"); + zend_argument_type_error(1, "must be of type string|int|array, %s given", zend_zval_type_name(kind)); RETURN_THROWS(); } } |