Skip to content

Declare ext/tokenizer constants in stubs #9148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/verify-generated-files/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ runs:
scripts/dev/credits
scripts/dev/genfiles
Zend/zend_vm_gen.php
ext/tokenizer/tokenizer_data_gen.php
build/gen_stub.php -f
build/gen_stub.php --generate-optimizer-info
ext/tokenizer/tokenizer_data_gen.php
git add . -N && git diff --exit-code
3 changes: 2 additions & 1 deletion ext/tokenizer/php_tokenizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ extern zend_module_entry tokenizer_module_entry;
#include "php_version.h"
#define PHP_TOKENIZER_VERSION PHP_VERSION

#define TOKEN_PARSE (1 << 0)

#ifdef ZTS
#include "TSRM.h"
#endif

void tokenizer_register_constants(INIT_FUNC_ARGS);
char *get_token_type_name(int token_type);


Expand Down
14 changes: 5 additions & 9 deletions ext/tokenizer/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_tokenizer.h"
#include "tokenizer_arginfo.h"

#include "zend.h"
#include "zend_exceptions.h"
Expand All @@ -31,19 +30,16 @@
#include <zend_language_parser.h>
#include "zend_interfaces.h"

#include "tokenizer_data_arginfo.h"
#include "tokenizer_arginfo.h"

#define zendtext LANG_SCNG(yy_text)
#define zendleng LANG_SCNG(yy_leng)
#define zendcursor LANG_SCNG(yy_cursor)
#define zendlimit LANG_SCNG(yy_limit)

#define TOKEN_PARSE (1 << 0)

zend_class_entry *php_token_ce;

void tokenizer_token_get_all_register_constants(INIT_FUNC_ARGS) {
REGISTER_LONG_CONSTANT("TOKEN_PARSE", TOKEN_PARSE, CONST_CS|CONST_PERSISTENT);
}

/* {{{ tokenizer_module_entry */
zend_module_entry tokenizer_module_entry = {
STANDARD_MODULE_HEADER,
Expand Down Expand Up @@ -251,8 +247,8 @@ PHP_METHOD(PhpToken, __toString)
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(tokenizer)
{
tokenizer_register_constants(INIT_FUNC_ARGS_PASSTHRU);
tokenizer_token_get_all_register_constants(INIT_FUNC_ARGS_PASSTHRU);
register_tokenizer_data_symbols(module_number);
register_tokenizer_symbols(module_number);
php_token_ce = register_class_PhpToken(zend_ce_stringable);

return SUCCESS;
Expand Down
6 changes: 6 additions & 0 deletions ext/tokenizer/tokenizer.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

/** @generate-class-entries */

/**
* @var int
* @cvalue TOKEN_PARSE
*/
const TOKEN_PARSE = UNKNOWN;

function token_get_all(string $code, int $flags = 0): array {}

function token_name(int $id): string {}
Expand Down
7 changes: 6 additions & 1 deletion ext/tokenizer/tokenizer_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

151 changes: 0 additions & 151 deletions ext/tokenizer/tokenizer_data.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading