@@ -8,23 +8,23 @@ public function test_tokenize_valid_input(): void {
8
8
9
9
// SELECT
10
10
$ this ->assertTrue ( $ lexer ->next_token () );
11
- $ this ->assertSame ( WP_MySQL_Lexer::SELECT_SYMBOL , $ lexer ->get_token ()->get_type () );
11
+ $ this ->assertSame ( WP_MySQL_Lexer::SELECT_SYMBOL , $ lexer ->get_token ()->id );
12
12
13
13
// id
14
14
$ this ->assertTrue ( $ lexer ->next_token () );
15
- $ this ->assertSame ( WP_MySQL_Lexer::IDENTIFIER , $ lexer ->get_token ()->get_type () );
15
+ $ this ->assertSame ( WP_MySQL_Lexer::IDENTIFIER , $ lexer ->get_token ()->id );
16
16
17
17
// FROM
18
18
$ this ->assertTrue ( $ lexer ->next_token () );
19
- $ this ->assertSame ( WP_MySQL_Lexer::FROM_SYMBOL , $ lexer ->get_token ()->get_type () );
19
+ $ this ->assertSame ( WP_MySQL_Lexer::FROM_SYMBOL , $ lexer ->get_token ()->id );
20
20
21
21
// users
22
22
$ this ->assertTrue ( $ lexer ->next_token () );
23
- $ this ->assertSame ( WP_MySQL_Lexer::IDENTIFIER , $ lexer ->get_token ()->get_type () );
23
+ $ this ->assertSame ( WP_MySQL_Lexer::IDENTIFIER , $ lexer ->get_token ()->id );
24
24
25
25
// EOF
26
26
$ this ->assertTrue ( $ lexer ->next_token () );
27
- $ this ->assertSame ( WP_MySQL_Lexer::EOF , $ lexer ->get_token ()->get_type () );
27
+ $ this ->assertSame ( WP_MySQL_Lexer::EOF , $ lexer ->get_token ()->id );
28
28
29
29
// No more tokens.
30
30
$ this ->assertFalse ( $ lexer ->next_token () );
@@ -40,7 +40,7 @@ public function test_tokenize_invalid_input(): void {
40
40
41
41
// SELECT
42
42
$ this ->assertTrue ( $ lexer ->next_token () );
43
- $ this ->assertSame ( WP_MySQL_Lexer::SELECT_SYMBOL , $ lexer ->get_token ()->get_type () );
43
+ $ this ->assertSame ( WP_MySQL_Lexer::SELECT_SYMBOL , $ lexer ->get_token ()->id );
44
44
45
45
// Invalid input.
46
46
$ this ->assertFalse ( $ lexer ->next_token () );
@@ -66,7 +66,7 @@ public function test_identifier_utf8_range(): void {
66
66
$ lexer = new WP_MySQL_Lexer ( $ value );
67
67
$ this ->assertTrue ( $ lexer ->next_token () );
68
68
69
- $ type = $ lexer ->get_token ()->get_type () ;
69
+ $ type = $ lexer ->get_token ()->id ;
70
70
$ is_valid = preg_match ( '/^[\x{0080}-\x{ffff}]$/u ' , $ value );
71
71
if ( $ is_valid ) {
72
72
$ this ->assertSame ( WP_MySQL_Lexer::IDENTIFIER , $ type );
@@ -95,7 +95,7 @@ public function test_identifier_utf8_two_byte_sequences(): void {
95
95
$ is_valid = preg_match ( '/^[\x{0080}-\x{ffff}]$/u ' , $ value );
96
96
if ( $ is_valid ) {
97
97
$ this ->assertTrue ( $ result );
98
- $ this ->assertSame ( WP_MySQL_Lexer::IDENTIFIER , $ token ->get_type () );
98
+ $ this ->assertSame ( WP_MySQL_Lexer::IDENTIFIER , $ token ->id );
99
99
} else {
100
100
$ this ->assertFalse ( $ result );
101
101
$ this ->assertNull ( $ token );
@@ -125,7 +125,7 @@ public function test_identifier_utf8_three_byte_sequences(): void {
125
125
$ is_valid = preg_match ( '/^[\x{0080}-\x{ffff}]$/u ' , $ value );
126
126
if ( $ is_valid ) {
127
127
$ this ->assertTrue ( $ result );
128
- $ this ->assertSame ( WP_MySQL_Lexer::IDENTIFIER , $ token ->get_type () );
128
+ $ this ->assertSame ( WP_MySQL_Lexer::IDENTIFIER , $ token ->id );
129
129
} else {
130
130
$ this ->assertFalse ( $ result );
131
131
$ this ->assertNull ( $ token );
@@ -141,7 +141,7 @@ public function test_identifier_utf8_three_byte_sequences(): void {
141
141
public function test_integer_types ( $ input , $ expected ): void {
142
142
$ lexer = new WP_MySQL_Lexer ( $ input );
143
143
$ this ->assertTrue ( $ lexer ->next_token () );
144
- $ this ->assertSame ( $ expected , $ lexer ->get_token ()->get_type () );
144
+ $ this ->assertSame ( $ expected , $ lexer ->get_token ()->id );
145
145
}
146
146
147
147
public function data_integer_types (): array {
@@ -185,7 +185,7 @@ public function test_identifier_or_number( $input, $expected ): void {
185
185
$ lexer = new WP_MySQL_Lexer ( $ input );
186
186
$ actual = array_map (
187
187
function ( $ token ) {
188
- return $ token ->get_type () ;
188
+ return $ token ->id ;
189
189
},
190
190
$ lexer ->remaining_tokens ()
191
191
);
0 commit comments