Skip to content

Commit

Permalink
remove useless cast
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl committed Oct 8, 2022
1 parent c8889e6 commit 83abcc8
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions lib/Tools/Db/ExtendedQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ public function exprLike(string $field, string $value, string $alias = '', bool

$expr = $this->expr();
if ($cs) {
return (string) $expr->like($field, $this->createNamedParameter($value));
return $expr->like($field, $this->createNamedParameter($value));
} else {
return (string) $expr->iLike($field, $this->createNamedParameter($value));
return $expr->iLike($field, $this->createNamedParameter($value));
}
}

Expand All @@ -418,14 +418,14 @@ public function exprLimit(string $field, string $value, string $alias = '', bool

$expr = $this->expr();
if ($value === '') {
return (string) $expr->emptyString($field);
return $expr->emptyString($field);
}
if ($cs) {
return (string)$expr->eq($field, $this->createNamedParameter($value));
return $expr->eq($field, $this->createNamedParameter($value));
} else {
$func = $this->func();

return (string)$expr->eq($func->lower($field), $func->lower($this->createNamedParameter($value)));
return $expr->eq($func->lower($field), $func->lower($this->createNamedParameter($value)));
}
}

Expand All @@ -436,7 +436,7 @@ public function exprLimitInt(string $field, int $value, string $alias = ''): str

$expr = $this->expr();

return (string)$expr->eq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
return $expr->eq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
}


Expand All @@ -454,7 +454,7 @@ public function exprLimitBool(string $field, bool $value, string $alias = ''): s

$expr = $this->expr();

return (string)$expr->eq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_BOOL));
return $expr->eq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_BOOL));
}

/**
Expand Down Expand Up @@ -555,7 +555,9 @@ public function exprLimitInArray(string $field, array $values, string $alias = '

$expr = $this->expr();

return (string)$expr->in($field, $this->createNamedParameter($values, IQueryBuilder::PARAM_STR_ARRAY));
return $expr->in(
$field, $this->createNamedParameter($values, IQueryBuilder::PARAM_STR_ARRAY)
);
}


Expand All @@ -573,7 +575,7 @@ public function exprLimitBitwise(string $field, int $flag, string $alias = ''):

$expr = $this->expr();

return (string)$expr->gt(
return $expr->gt(
$expr->bitwiseAnd($field, $flag),
$this->createNamedParameter(0, IQueryBuilder::PARAM_INT)
);
Expand All @@ -596,9 +598,9 @@ public function exprLt(string $field, int $value, bool $lte = false, string $ali
$expr = $this->expr();

if ($lte) {
return (string)$expr->lte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
return $expr->lte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
} else {
return (string)$expr->lt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
return $expr->lt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
}
}

Expand All @@ -618,9 +620,9 @@ public function exprGt(string $field, int $value, bool $gte = false, string $ali
$expr = $this->expr();

if ($gte) {
return (string)$expr->gte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
return $expr->gte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
} else {
return (string)$expr->gt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
return $expr->gt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
}
}

Expand Down Expand Up @@ -726,11 +728,11 @@ public function exprUnlike(string $field, string $value, string $alias = '', boo

$expr = $this->expr();
if ($cs) {
return (string) $expr->notLike($field, $this->createNamedParameter($value));
return $expr->notLike($field, $this->createNamedParameter($value));
} else {
$func = $this->func();

return (string) $expr->notLike($func->lower($field), $func->lower($this->createNamedParameter($value)));
return $expr->notLike($func->lower($field), $func->lower($this->createNamedParameter($value)));
}
}

Expand All @@ -750,14 +752,14 @@ public function exprFilter(string $field, string $value, string $alias = '', boo

$expr = $this->expr();
if ($value === '') {
return (string) $expr->nonEmptyString($field);
return $expr->nonEmptyString($field);
}
if ($cs) {
return (string) $expr->neq($field, $this->createNamedParameter($value));
return $expr->neq($field, $this->createNamedParameter($value));
} else {
$func = $this->func();

return (string) $expr->neq($func->lower($field), $func->lower($this->createNamedParameter($value)));
return $expr->neq($func->lower($field), $func->lower($this->createNamedParameter($value)));
}
}

Expand All @@ -776,7 +778,7 @@ public function exprFilterInt(string $field, int $value, string $alias = ''): st

$expr = $this->expr();

return (string) $expr->neq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
return $expr->neq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
}


Expand All @@ -794,7 +796,7 @@ public function exprFilterBool(string $field, bool $value, string $alias = ''):

$expr = $this->expr();

return (string) $expr->neq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_BOOL));
return $expr->neq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_BOOL));
}

/**
Expand Down Expand Up @@ -895,7 +897,7 @@ public function exprFilterInArray(string $field, array $values, string $alias =

$expr = $this->expr();

return (string) $expr->notIn($field, $this->createNamedParameter($values, IQueryBuilder::PARAM_STR_ARRAY));
return $expr->notIn($field, $this->createNamedParameter($values, IQueryBuilder::PARAM_STR_ARRAY));
}


Expand All @@ -913,7 +915,7 @@ public function exprFilterBitwise(string $field, int $flag, string $alias = ''):

$expr = $this->expr();

return (string) $expr->eq(
return $expr->eq(
$expr->bitwiseAnd($field, $flag),
$this->createNamedParameter(0, IQueryBuilder::PARAM_INT)
);
Expand Down

0 comments on commit 83abcc8

Please sign in to comment.