Skip to content

Commit ef714db

Browse files
committed
Remove the unused WP_MySQL_Lexer::get_token_id()
Nothing calls it, and it resolves only the named token constants, not keywords, so it is not the inverse of get_token_name(). Keyword ids are available via WP_MySQL_Lexer::KEYWORDS.
1 parent 4536cfa commit ef714db

1 file changed

Lines changed: 0 additions & 17 deletions

File tree

‎packages/mysql-parser/src/class-wp-mysql-lexer.php‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -549,23 +549,6 @@ public function is_sql_mode_active( int $mode ): bool {
549549
return ( $this->sql_modes & $mode ) !== 0;
550550
}
551551

552-
/**
553-
* Get the numeric token ID for a given token name.
554-
*
555-
* @param string $token_name The name of the token.
556-
* @return int|null The token ID for the given token name; null when not found.
557-
*/
558-
public static function get_token_id( string $token_name ): ?int {
559-
// Token constants share the class with the lexer's own constants, so
560-
// resolve only the grammar tokens: non-negative ints, never an SQL mode.
561-
$constant_name = self::class . '::' . $token_name;
562-
if ( 0 === strpos( $token_name, 'SQL_MODE_' ) || ! defined( $constant_name ) ) {
563-
return null;
564-
}
565-
$value = constant( $constant_name );
566-
return is_int( $value ) && $value >= 0 ? $value : null;
567-
}
568-
569552
/**
570553
* Get the name of a token for a given token ID.
571554
*

0 commit comments

Comments
 (0)