Skip to content

Commit 2706f87

Browse files
committed
trying to trick PHPStan
1 parent 6a3783e commit 2706f87

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/QueryDataTable.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,16 @@ public function prepareCountQuery(): QueryBuilder
164164
$builder = clone $this->query;
165165

166166
if ($this->isComplexQuery($builder)) {
167-
$builder->select(DB::raw('1'));
167+
$query_without_selects = clone $this->query;
168+
$query_without_selects->select(DB::raw('1'));
168169

169-
if ($this->ignoreSelectInCountQuery || ! $this->isComplexQuery($builder)) {
170+
if ($this->ignoreSelectInCountQuery || ! $this->isComplexQuery($query_without_selects)) {
170171
return $this->getConnection()
171172
->query()
172-
->fromRaw('('.$builder->toSql().') count_row_table')
173-
->setBindings($builder->getBindings());
173+
->fromRaw('('.$query_without_selects->toSql().') count_row_table')
174+
->setBindings($query_without_selects->getBindings());
174175
}
175176

176-
$builder = clone $this->query;
177-
178177
return $this->getConnection()
179178
->query()
180179
->fromRaw('('.$builder->toSql().') count_row_table')

0 commit comments

Comments
 (0)