@@ -122,7 +122,7 @@ public function parseShow(TokenList $tokenList): ShowCommand
122122 $ like = $ where = null ;
123123 if ($ tokenList ->hasKeyword (Keyword::LIKE )) {
124124 $ like = $ tokenList ->expectString ();
125- } elseif ($ tokenList ->expectKeyword (Keyword::WHERE )) {
125+ } elseif ($ tokenList ->hasKeyword (Keyword::WHERE )) {
126126 $ where = $ this ->expressionParser ->parseExpression ($ tokenList );
127127 }
128128 $ tokenList ->expectEnd ();
@@ -133,7 +133,7 @@ public function parseShow(TokenList $tokenList): ShowCommand
133133 $ like = $ where = null ;
134134 if ($ tokenList ->hasKeyword (Keyword::LIKE )) {
135135 $ like = $ tokenList ->expectString ();
136- } elseif ($ tokenList ->expectKeyword (Keyword::WHERE )) {
136+ } elseif ($ tokenList ->hasKeyword (Keyword::WHERE )) {
137137 $ where = $ this ->expressionParser ->parseExpression ($ tokenList );
138138 }
139139 $ tokenList ->expectEnd ();
@@ -209,7 +209,7 @@ public function parseShow(TokenList $tokenList): ShowCommand
209209 $ like = $ where = null ;
210210 if ($ tokenList ->hasKeyword (Keyword::LIKE )) {
211211 $ like = $ tokenList ->expectString ();
212- } elseif ($ tokenList ->expectKeyword (Keyword::WHERE )) {
212+ } elseif ($ tokenList ->hasKeyword (Keyword::WHERE )) {
213213 $ where = $ this ->expressionParser ->parseExpression ($ tokenList );
214214 }
215215 $ tokenList ->expectEnd ();
@@ -272,7 +272,7 @@ public function parseShow(TokenList $tokenList): ShowCommand
272272 $ like = $ where = null ;
273273 if ($ tokenList ->hasKeyword (Keyword::LIKE )) {
274274 $ like = $ tokenList ->expectString ();
275- } elseif ($ tokenList ->expectKeyword (Keyword::WHERE )) {
275+ } elseif ($ tokenList ->hasKeyword (Keyword::WHERE )) {
276276 $ where = $ this ->expressionParser ->parseExpression ($ tokenList );
277277 }
278278 $ tokenList ->expectEnd ();
@@ -295,7 +295,7 @@ public function parseShow(TokenList $tokenList): ShowCommand
295295 }
296296 $ tokenList ->expectEnd ();
297297
298- return new ShowGrantsCommand ($ forUser , $ usingRoles ? : null );
298+ return new ShowGrantsCommand ($ forUser , $ usingRoles !== [] ? $ usingRoles : null );
299299 case Keyword::INDEX :
300300 case Keyword::INDEXES :
301301 case Keyword::KEYS :
@@ -351,7 +351,7 @@ public function parseShow(TokenList $tokenList): ShowCommand
351351 $ like = $ where = null ;
352352 if ($ tokenList ->hasKeyword (Keyword::LIKE )) {
353353 $ like = $ tokenList ->expectString ();
354- } elseif ($ tokenList ->expectKeyword (Keyword::WHERE )) {
354+ } elseif ($ tokenList ->hasKeyword (Keyword::WHERE )) {
355355 $ where = $ this ->expressionParser ->parseExpression ($ tokenList );
356356 }
357357 $ tokenList ->expectEnd ();
@@ -386,7 +386,7 @@ public function parseShow(TokenList $tokenList): ShowCommand
386386
387387 $ types = [];
388388 $ type = $ tokenList ->getAnyKeyword (...array_keys ($ keywords ));
389- if ($ type ) {
389+ if ($ type !== null ) {
390390 $ types [] = ShowProfileType::get ($ continue ($ type ));
391391 }
392392 while ($ tokenList ->hasComma ()) {
@@ -517,7 +517,7 @@ public function parseShow(TokenList $tokenList): ShowCommand
517517 }
518518 $ tokenList ->expectEnd ();
519519
520- return new ShowStatusCommand ($ scope ? Scope::get ($ scope ) : null , $ like , $ where );
520+ return new ShowStatusCommand ($ scope !== null ? Scope::get ($ scope ) : null , $ like , $ where );
521521 } elseif ($ tokenList ->seekKeyword (Keyword::VARIABLES , 2 )) {
522522 // SHOW [GLOBAL | SESSION] VARIABLES [LIKE 'pattern' | WHERE expr]
523523 $ scope = $ tokenList ->getAnyKeyword (Keyword::GLOBAL , Keyword::SESSION );
@@ -530,7 +530,7 @@ public function parseShow(TokenList $tokenList): ShowCommand
530530 }
531531 $ tokenList ->expectEnd ();
532532
533- return new ShowVariablesCommand ($ scope ? Scope::get ($ scope ) : null , $ like , $ where );
533+ return new ShowVariablesCommand ($ scope !== null ? Scope::get ($ scope ) : null , $ like , $ where );
534534 } elseif ($ tokenList ->seekKeyword (Keyword::COLUMNS , 2 )) {
535535 // SHOW [FULL] COLUMNS {FROM | IN} tbl_name [{FROM | IN} db_name] [LIKE 'pattern' | WHERE expr]
536536 $ full = $ tokenList ->hasKeyword (Keyword::FULL );
0 commit comments