Skip to content

Commit 833ca56

Browse files
authored
Apply suggestions from code review
1 parent dbfacc0 commit 833ca56

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

system/Database/BaseBuilder.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,8 +2529,8 @@ protected function isLiteral(string $str): bool
25292529
return true;
25302530
}
25312531

2532-
if (empty($this->isLiteralStr)) {
2533-
$this->isLiteralStr = ($this->db->escapeChar !== '"') ? ['"', "'"] : ["'"];
2532+
if ($this->isLiteralStr === []) {
2533+
$this->isLiteralStr = $this->db->escapeChar !== '"' ? ['"', "'"] : ["'"];
25342534
}
25352535

25362536
return in_array($str[0], $this->isLiteralStr, true);
@@ -2612,10 +2612,10 @@ protected function resetWrite()
26122612
*/
26132613
protected function hasOperator(string $str): bool
26142614
{
2615-
return (bool) preg_match(
2615+
return preg_match(
26162616
'/(<|>|!|=|\sIS NULL|\sIS NOT NULL|\sEXISTS|\sBETWEEN|\sLIKE|\sIN\s*\(|\s)/i',
26172617
trim($str)
2618-
);
2618+
) === 1;
26192619
}
26202620

26212621
/**
@@ -2625,8 +2625,8 @@ protected function hasOperator(string $str): bool
26252625
*/
26262626
protected function getOperator(string $str, bool $list = false)
26272627
{
2628-
if (empty($this->pregOperators)) {
2629-
$_les = ($this->db->likeEscapeStr !== '')
2628+
if ($this->pregOperators === []) {
2629+
$_les = $this->db->likeEscapeStr !== ''
26302630
? '\s+' . preg_quote(trim(sprintf($this->db->likeEscapeStr, $this->db->likeEscapeChar)), '/')
26312631
: '';
26322632
$this->pregOperators = [

0 commit comments

Comments
 (0)