@@ -370,10 +370,10 @@ protected function addCondition($condition, array $params, array &$conditions, a
370370
371371 if ($ arg !== null ) {
372372 if (!$ arg ) {
373- $ hasBrackets = strpos ($ condition , '( ' ) !== false ;
373+ $ hasBrackets = str_contains ($ condition , '( ' );
374374 $ hasOperators = preg_match ('#AND|OR# ' , $ condition );
375- $ hasNot = strpos ($ condition , 'NOT ' ) !== false ;
376- $ hasPrefixNot = strpos ($ match [2 ][0 ], 'NOT ' ) !== false ;
375+ $ hasNot = str_contains ($ condition , 'NOT ' );
376+ $ hasPrefixNot = str_contains ($ match [2 ][0 ], 'NOT ' );
377377 if (!$ hasBrackets && ($ hasOperators || ($ hasNot && !$ hasPrefixNot ))) {
378378 throw new Nette \InvalidArgumentException ('Possible SQL query corruption. Add parentheses around operators. ' );
379379 }
@@ -794,7 +794,7 @@ private function getConditionHash($condition, array $parameters): string
794794 $ parameter = $ this ->getConditionHash ($ parameter ->getSql (), $ parameter ->getSqlBuilder ()->getParameters ());
795795 } elseif ($ parameter instanceof SqlLiteral) {
796796 $ parameter = $ this ->getConditionHash ($ parameter ->__toString (), $ parameter ->getParameters ());
797- } elseif (is_object ( $ parameter) && method_exists ( $ parameter , ' __toString ' ) ) {
797+ } elseif ($ parameter instanceof \Stringable ) {
798798 $ parameter = $ parameter ->__toString ();
799799 } elseif (is_array ($ parameter ) || $ parameter instanceof \ArrayAccess) {
800800 $ parameter = $ this ->getConditionHash ($ key , $ parameter );
0 commit comments