@@ -2468,13 +2468,21 @@ public function ConditionalPrimary(): AST\ConditionalPrimary
24682468 return $ condPrimary ;
24692469 }
24702470
2471- /**
2472- * SimpleConditionalExpression ::=
2473- * ComparisonExpression | BetweenExpression | LikeExpression |
2474- * InExpression | NullComparisonExpression | ExistsExpression |
2475- * EmptyCollectionComparisonExpression | CollectionMemberExpression |
2476- * InstanceOfExpression
2477- */
2471+ /**
2472+ * SimpleConditionalExpression ::=
2473+ * ComparisonExpression | BetweenExpression | LikeExpression |
2474+ * InExpression | NullComparisonExpression | ExistsExpression |
2475+ * EmptyCollectionComparisonExpression | CollectionMemberExpression |
2476+ * InstanceOfExpression
2477+ *
2478+ * InExpression ::= ArithmeticExpression ["NOT"] "IN" "(" (InParameter {"," InParameter}* | Subselect) ")"
2479+ *
2480+ * Note: ArithmeticExpression includes CaseExpression (CASE/COALESCE/NULLIF) and
2481+ * parenthesized expressions, allowing constructs like:
2482+ * - CASE WHEN ... END IN (...)
2483+ * - COALESCE(...) IN (...)
2484+ * - (u.id + 1) IN (...)
2485+ */
24782486 public function SimpleConditionalExpression (): AST \ExistsExpression |AST \BetweenExpression |AST \LikeExpression |AST \InListExpression |AST \InSubselectExpression |AST \InstanceOfExpression |AST \CollectionMemberExpression |AST \NullComparisonExpression |AST \EmptyCollectionComparisonExpression |AST \ComparisonExpression
24792487 {
24802488 assert ($ this ->lexer ->lookahead !== null );
@@ -2496,7 +2504,6 @@ public function SimpleConditionalExpression(): AST\ExistsExpression|AST\BetweenE
24962504 // Handle conditional and null-handling expressions (CASE, COALESCE, NULLIF) by peeking ahead in the token stream
24972505 if ($ token ->type === TokenType::T_CASE || $ token ->type === TokenType::T_COALESCE || $ token ->type === TokenType::T_NULLIF ) {
24982506 if ($ token ->type === TokenType::T_CASE ) {
2499-
25002507 // For CASE expressions, peek beyond the matching END keyword
25012508 $ nestingDepth = 1 ;
25022509
0 commit comments