@@ -383,10 +383,10 @@ protected function addCondition($condition, array $params, array &$conditions, a
383383
384384 if ($ arg !== null ) {
385385 if (!$ arg ) {
386- $ hasBrackets = strpos ($ condition , '( ' ) !== false ;
386+ $ hasBrackets = str_contains ($ condition , '( ' );
387387 $ hasOperators = preg_match ('#AND|OR# ' , $ condition );
388- $ hasNot = strpos ($ condition , 'NOT ' ) !== false ;
389- $ hasPrefixNot = strpos ($ match [2 ][0 ], 'NOT ' ) !== false ;
388+ $ hasNot = str_contains ($ condition , 'NOT ' );
389+ $ hasPrefixNot = str_contains ($ match [2 ][0 ], 'NOT ' );
390390 if (!$ hasBrackets && ($ hasOperators || ($ hasNot && !$ hasPrefixNot ))) {
391391 throw new Nette \InvalidArgumentException ('Possible SQL query corruption. Add parentheses around operators. ' );
392392 }
@@ -807,7 +807,7 @@ private function getConditionHash($condition, array $parameters): string
807807 $ parameter = $ this ->getConditionHash ($ parameter ->getSql (), $ parameter ->getSqlBuilder ()->getParameters ());
808808 } elseif ($ parameter instanceof SqlLiteral) {
809809 $ parameter = $ this ->getConditionHash ($ parameter ->__toString (), $ parameter ->getParameters ());
810- } elseif (is_object ( $ parameter) && method_exists ( $ parameter , ' __toString ' ) ) {
810+ } elseif ($ parameter instanceof \Stringable ) {
811811 $ parameter = $ parameter ->__toString ();
812812 } elseif (is_array ($ parameter ) || $ parameter instanceof \ArrayAccess) {
813813 $ parameter = $ this ->getConditionHash ($ key , $ parameter );
0 commit comments