Skip to content

Commit e28fd8c

Browse files
author
Sander De la Marche
committed
Fix imports and newlines
1 parent 4aed958 commit e28fd8c

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/Pagination/Paginator.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@
55
use Doctrine\ORM\QueryBuilder as DoctrineQueryBuilder;
66
use Doctrine\ORM\Tools\Pagination\CountWalker;
77
use Doctrine\ORM\Tools\Pagination\Paginator as DoctrinePaginator;
8+
use ArrayIterator;
9+
use IteratorAggregate;
810
use Traversable;
11+
use Countable;
12+
use Iterator;
913

10-
class Paginator implements \Countable, \IteratorAggregate
14+
class Paginator implements Countable, IteratorAggregate
1115
{
1216
public const PAGE_SIZE = 30;
1317

@@ -35,13 +39,13 @@ public function paginate(int $page = 1): self
3539
->setMaxResults($this->pageSize)
3640
->getQuery();
3741

38-
if (0 === \count($this->queryBuilder->getDQLPart('join'))) {
42+
if (0 === count($this->queryBuilder->getDQLPart('join'))) {
3943
$query->setHint(CountWalker::HINT_DISTINCT, false);
4044
}
4145

4246
$paginator = new DoctrinePaginator($query, true);
4347

44-
$useOutputWalkers = \count($this->queryBuilder->getDQLPart('having') ?: []) > 0;
48+
$useOutputWalkers = count($this->queryBuilder->getDQLPart('having') ?: []) > 0;
4549
$paginator->setUseOutputWalkers($useOutputWalkers);
4650

4751
$this->results = $paginator->getIterator();
@@ -135,15 +139,15 @@ public function getIterator(): Traversable
135139
{
136140
$results = $this->getResults();
137141

138-
if ($results instanceof \Iterator) {
142+
if ($results instanceof Iterator) {
139143
return $results;
140144
}
141145

142-
if ($results instanceof \IteratorAggregate) {
146+
if ($results instanceof IteratorAggregate) {
143147
return $results->getIterator();
144148
}
145149

146-
return new \ArrayIterator($results);
150+
return new ArrayIterator($results);
147151
}
148152

149153
public function calculateStartAndEndPage(): void
@@ -184,4 +188,4 @@ private function calculateStartPageForEndPageOverflow($startPage, $endPage): int
184188
{
185189
return max($startPage - ($endPage - $this->getNumberOfPages()), 1);
186190
}
187-
}
191+
}

src/Twig/PaginatorExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ public function getFunctions(): array
1313
new TwigFunction('pagination', [PaginatorRuntime::class, 'renderPagination'], ['is_safe' => ['html']]),
1414
];
1515
}
16-
}
16+
}

src/Twig/PaginatorRuntime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ private function getRequest(): ?Request
5252
{
5353
return $this->requestStack->getCurrentRequest();
5454
}
55-
}
55+
}

0 commit comments

Comments
 (0)