diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index 24e1cddc..cc728114 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -960,11 +960,6 @@ parameters:
count: 1
path: src/Utils/Query.php
- -
- message: "#^Parameter \\#1 \\$str of function strtoupper expects string, mixed given\\.$#"
- count: 1
- path: src/Utils/Query.php
-
-
message: "#^Cannot access offset 'value' on mixed\\.$#"
count: 3
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index ed08d689..7854c67b 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -1336,6 +1336,9 @@
! ($statement instanceof SelectStatement)
+
+ $tables[$thisDb][$expr->table]
+
$tables[$thisDb]
@@ -1348,9 +1351,10 @@
$expr
$expr->function
-
+
$clauses[$token->keyword]
$clauses[$token->keyword]
+ $tableAliases[$expr->table]
$clauses[$token->keyword]
diff --git a/src/Components/Condition.php b/src/Components/Condition.php
index e29684ae..38174570 100644
--- a/src/Components/Condition.php
+++ b/src/Components/Condition.php
@@ -146,7 +146,10 @@ public static function parse(Parser $parser, TokensList $list, array $options =
}
// Conditions are delimited by logical operators.
- if (in_array($token->value, static::$DELIMITERS, true)) {
+ if (
+ ($token->type === Token::TYPE_KEYWORD || $token->type === Token::TYPE_OPERATOR)
+ && in_array($token->value, static::$DELIMITERS, true)
+ ) {
if ($betweenBefore && ($token->value === 'AND')) {
// The syntax of keyword `BETWEEN` is hard-coded.
$betweenBefore = false;
diff --git a/tests/Components/ConditionTest.php b/tests/Components/ConditionTest.php
index 909e4d1c..4ff86093 100644
--- a/tests/Components/ConditionTest.php
+++ b/tests/Components/ConditionTest.php
@@ -26,4 +26,16 @@ public function testParseBetween(): void
$this->assertEquals($component[1]->expr, 'OR');
$this->assertEquals($component[2]->expr, '(id BETWEEN 30 AND 40)');
}
+
+ public function testParseAnd(): void
+ {
+ $component = Condition::parse(
+ new Parser(),
+ $this->getTokensList("`col` LIKE 'AND'")
+ );
+ $this->assertEquals(
+ "`col` LIKE 'AND'",
+ Condition::build($component)
+ );
+ }
}