From 85b208bb519b18fb9ac9a593b4e683f1b188da1f Mon Sep 17 00:00:00 2001 From: Tetsuro Yoshikawa Date: Sat, 22 May 2021 14:21:56 +0900 Subject: [PATCH 1/4] docs: Fixed problem with string being AST's String class. --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index d3aaec4fa..700777ce5 100644 --- a/src/index.js +++ b/src/index.js @@ -199,8 +199,8 @@ Engine.tokenGetAll = function (buffer, options) { /** * Extract tokens from the specified buffer. * > Note that the output tokens are *STRICLY* similar to PHP function `token_get_all` - * @param {String} buffer - * @return {String[]} - Each item can be a string or an array with following informations [token_name, text, line_number] + * @param {string} buffer + * @return {string[]} - Each item can be a string or an array with following informations [token_name, text, line_number] */ Engine.prototype.tokenGetAll = function (buffer) { this.lexer.mode_eval = false; From 4e6563c8d80e9d251fea5e41043ab2998efc7476 Mon Sep 17 00:00:00 2001 From: Tetsuro Yoshikawa Date: Sat, 22 May 2021 14:22:59 +0900 Subject: [PATCH 2/4] chore: npm run build-types --- types.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types.d.ts b/types.d.ts index d0b17f82a..ab4f2f422 100644 --- a/types.d.ts +++ b/types.d.ts @@ -990,7 +990,7 @@ declare module "php-parser" { * > Note that the output tokens are *STRICLY* similar to PHP function `token_get_all` * @returns - Each item can be a string or an array with following informations [token_name, text, line_number] */ - tokenGetAll(buffer: string): String[]; + tokenGetAll(buffer: string): string[]; lexer: Lexer; parser: Parser; ast: AST; From fa38aac7f036d05e1ea4edba60fd8f3afa0ed93d Mon Sep 17 00:00:00 2001 From: Tetsuro Yoshikawa Date: Sat, 22 May 2021 14:45:22 +0900 Subject: [PATCH 3/4] fix: Fixed to return a string or an array of strings. --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 700777ce5..2233ab106 100644 --- a/src/index.js +++ b/src/index.js @@ -200,7 +200,7 @@ Engine.tokenGetAll = function (buffer, options) { * Extract tokens from the specified buffer. * > Note that the output tokens are *STRICLY* similar to PHP function `token_get_all` * @param {string} buffer - * @return {string[]} - Each item can be a string or an array with following informations [token_name, text, line_number] + * @return {Array} - Each item can be a string or an array with following informations [token_name, text, line_number] */ Engine.prototype.tokenGetAll = function (buffer) { this.lexer.mode_eval = false; From 0600e4ca46b5ec1f064ef0290ac323eef11c9bd4 Mon Sep 17 00:00:00 2001 From: Tetsuro Yoshikawa Date: Sat, 22 May 2021 14:46:16 +0900 Subject: [PATCH 4/4] chore: npm run build-types --- types.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types.d.ts b/types.d.ts index ab4f2f422..cc202d9e2 100644 --- a/types.d.ts +++ b/types.d.ts @@ -990,7 +990,7 @@ declare module "php-parser" { * > Note that the output tokens are *STRICLY* similar to PHP function `token_get_all` * @returns - Each item can be a string or an array with following informations [token_name, text, line_number] */ - tokenGetAll(buffer: string): string[]; + tokenGetAll(buffer: string): (string | string[])[]; lexer: Lexer; parser: Parser; ast: AST;