Skip to content

Commit 9369f72

Browse files
committed
fix php-cs-fixer
1 parent 74244cf commit 9369f72

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/Bridge/Doctrine/Orm/Filter/SearchFilter.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,29 +133,29 @@ protected function filterProperty(string $property, $value, QueryBuilder $queryB
133133
$wrapCase = $this->createWrapCase($caseSensitive);
134134
$valueParameter = $queryNameGenerator->generateParameterName($field);
135135

136-
/**
137-
* If field type is string/float, Doctrine does not call convertToDatabaseValueSQL() because it
136+
/*
137+
* If field type is string/float, Doctrine does not call convertToDatabaseValueSQL() because it
138138
* does not know it needs conversion.
139139
* This would lead to incorrect values for Ramsey\Uuid\Doctrine\UuidBinaryType for example.
140-
* The only fix is to provide field type to doctrine ...
141-
* BUT it is not possible with setParameter(), as third arg can only be
140+
* The only fix is to provide field type to doctrine ...
141+
* BUT it is not possible with setParameter(), as third arg can only be
142142
* \Doctrine\DBAL\Connection::PARAM_STR_ARRAY
143-
*
144-
* The only way to do this will be to rewrite the IN() statement to multiple values,
143+
*
144+
* The only way to do this will be to rewrite the IN() statement to multiple values,
145145
* each provided as a single setParameter()
146-
**/
146+
*/
147147

148148
// let's do a very simple query if we don't need the complex one (99% of time)
149-
if (in_array($metadata->getTypeOfField($field), ['string', 'integer'])) {
149+
if (\in_array($metadata->getTypeOfField($field), ['string', 'integer'], true)) {
150150
$queryBuilder
151151
->andWhere(sprintf($wrapCase('%s.%s').' IN (:%s)', $alias, $field, $valueParameter))
152152
->setParameter($valueParameter, $caseSensitive ? $values : array_map('strtolower', $values));
153153
} else {
154154
$inQuery = [];
155-
$args = [];
155+
$args = [];
156156
$type = $metadata->getTypeOfField($field);
157157

158-
for ($i = 0; $i<count($values); $i++) {
158+
for ($i = 0; $i< \count($values); $i++) {
159159
$inQuery[] = ':filterproperty'.$i;
160160
$args[] = new Parameter('filterproperty'.$i, $caseSensitive ? $values[$i] : strtolower($values[$i]), $type);
161161
}
@@ -169,7 +169,6 @@ protected function filterProperty(string $property, $value, QueryBuilder $queryB
169169
->andWhere(sprintf($wrapCase('%s.%s').' IN (%s)', $alias, $field, implode(',', $inQuery)))
170170
->setParameters($parameters);
171171
}
172-
173172
}
174173

175174
// metadata doesn't have the field, nor an association on the field
@@ -232,7 +231,6 @@ protected function addWhereByStrategy(string $strategy, QueryBuilder $queryBuild
232231
}
233232
$wrapCase = $this->createWrapCase($caseSensitive);
234233
$valueParameter = $queryNameGenerator->generateParameterName($field);
235-
236234

237235
switch ($strategy) {
238236
case null:

0 commit comments

Comments
 (0)