summaryrefslogtreecommitdiff
path: root/ext/tokenizer
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tokenizer')
-rw-r--r--ext/tokenizer/php_tokenizer.h2
-rw-r--r--ext/tokenizer/tests/001.phpt8
-rw-r--r--ext/tokenizer/tests/003.phpt7
-rw-r--r--ext/tokenizer/tokenizer.c14
-rw-r--r--ext/tokenizer/tokenizer.stub.php6
-rw-r--r--ext/tokenizer/tokenizer_arginfo.h10
-rw-r--r--ext/tokenizer/tokenizer_data.c2
-rwxr-xr-xext/tokenizer/tokenizer_data_gen.sh2
8 files changed, 17 insertions, 34 deletions
diff --git a/ext/tokenizer/php_tokenizer.h b/ext/tokenizer/php_tokenizer.h
index f6b431d038..32a6203276 100644
--- a/ext/tokenizer/php_tokenizer.h
+++ b/ext/tokenizer/php_tokenizer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/tokenizer/tests/001.phpt b/ext/tokenizer/tests/001.phpt
index 4c6295cdf8..8e58c81891 100644
--- a/ext/tokenizer/tests/001.phpt
+++ b/ext/tokenizer/tests/001.phpt
@@ -126,8 +126,6 @@ echo token_name(T_HALT_COMPILER), "\n";
echo token_name(-1), "\n";
echo token_name(0x8000000F), "\n";
-echo token_name("string"), "\n";
-echo token_name(array()), "\n";
echo "Done\n";
?>
@@ -251,10 +249,4 @@ T_CLONE
T_HALT_COMPILER
UNKNOWN
UNKNOWN
-
-Warning: token_name() expects parameter 1 to be int, string given in %s on line %d
-
-
-Warning: token_name() expects parameter 1 to be int, array given in %s on line %d
-
Done
diff --git a/ext/tokenizer/tests/003.phpt b/ext/tokenizer/tests/003.phpt
index 3ba6d594df..6c3cc4c559 100644
--- a/ext/tokenizer/tests/003.phpt
+++ b/ext/tokenizer/tests/003.phpt
@@ -5,8 +5,6 @@ token_get_all() and wrong parameters
--FILE--
<?php
-var_dump(token_get_all(array()));
-var_dump(token_get_all(new stdClass));
var_dump(token_get_all(""));
var_dump(token_get_all(0));
var_dump(token_get_all(-1));
@@ -14,11 +12,6 @@ var_dump(token_get_all(-1));
echo "Done\n";
?>
--EXPECTF--
-Warning: token_get_all() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: token_get_all() expects parameter 1 to be string, object given in %s on line %d
-NULL
array(0) {
}
array(1) {
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index 3d343fec4d..cf5be94226 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,6 +22,7 @@
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_tokenizer.h"
+#include "tokenizer_arginfo.h"
#include "zend.h"
#include "zend_exceptions.h"
@@ -42,17 +41,6 @@ void tokenizer_token_get_all_register_constants(INIT_FUNC_ARGS) {
REGISTER_LONG_CONSTANT("TOKEN_PARSE", TOKEN_PARSE, CONST_CS|CONST_PERSISTENT);
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_token_get_all, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_token_name, 0, 0, 1)
- ZEND_ARG_INFO(0, token)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ tokenizer_functions[]
*
* Every user visible function must have an entry in tokenizer_functions[].
diff --git a/ext/tokenizer/tokenizer.stub.php b/ext/tokenizer/tokenizer.stub.php
new file mode 100644
index 0000000000..8abcd37811
--- /dev/null
+++ b/ext/tokenizer/tokenizer.stub.php
@@ -0,0 +1,6 @@
+<?php
+
+/** @return array|false */
+function token_get_all(string $source, int $flags = 0) {}
+
+function token_name(int $token): string {}
diff --git a/ext/tokenizer/tokenizer_arginfo.h b/ext/tokenizer/tokenizer_arginfo.h
new file mode 100644
index 0000000000..f1b601358e
--- /dev/null
+++ b/ext/tokenizer/tokenizer_arginfo.h
@@ -0,0 +1,10 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_token_get_all, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_token_name, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, token, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c
index cc3a1f939f..414202ff3b 100644
--- a/ext/tokenizer/tokenizer_data.c
+++ b/ext/tokenizer/tokenizer_data.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/tokenizer/tokenizer_data_gen.sh b/ext/tokenizer/tokenizer_data_gen.sh
index 979ecb983c..4d5e97ddde 100755
--- a/ext/tokenizer/tokenizer_data_gen.sh
+++ b/ext/tokenizer/tokenizer_data_gen.sh
@@ -18,8 +18,6 @@ fi
echo '/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |