Passed
Push — master ( e14ca2...72264b )
by Eric
01:53
created
tests/PaginatorTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
         ]);
98 98
 
99 99
         $beforeQueryFired = false;
100
-        $paginator->setBeforeQueryCallback(static function () use (&$beforeQueryFired): void {
100
+        $paginator->setBeforeQueryCallback(static function() use (&$beforeQueryFired): void {
101 101
             $beforeQueryFired = true;
102 102
         });
103 103
 
104 104
         $afterQueryFired = false;
105
-        $paginator->setAfterQueryCallback(static function () use (&$afterQueryFired): void {
105
+        $paginator->setAfterQueryCallback(static function() use (&$afterQueryFired): void {
106 106
             $afterQueryFired = true;
107 107
         });
108 108
 
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
         ]);
137 137
 
138 138
         $beforeQueryFired = false;
139
-        $paginator->setBeforeQueryCallback(static function () use (&$beforeQueryFired): void {
139
+        $paginator->setBeforeQueryCallback(static function() use (&$beforeQueryFired): void {
140 140
             $beforeQueryFired = true;
141 141
         });
142 142
 
143 143
         $afterQueryFired = false;
144
-        $paginator->setAfterQueryCallback(static function () use (&$afterQueryFired): void {
144
+        $paginator->setAfterQueryCallback(static function() use (&$afterQueryFired): void {
145 145
             $afterQueryFired = true;
146 146
         });
147 147
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             ->setItemsPerPage(10)
198 198
             ->setPagesInRange(5);
199 199
 
200
-        $paginator->setItemTotalCallback(static function (): int {
200
+        $paginator->setItemTotalCallback(static function(): int {
201 201
             /** @var PDOStatement $result */
202 202
             $result = self::$dbObj->query("SELECT COUNT(*) as totalCount FROM facts");
203 203
             $row    = $result->fetchColumn();
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         });
206 206
 
207 207
         // Pass our slice callback.
208
-        $paginator->setSliceCallback(static function (int $offset, int $length): array {
208
+        $paginator->setSliceCallback(static function(int $offset, int $length): array {
209 209
             /** @var PDOStatement $result */
210 210
             $result     = self::$dbObj->query(sprintf('SELECT name, area FROM facts ORDER BY area DESC LIMIT %d, %d', $offset, $length), PDO::FETCH_ASSOC);
211 211
             $collection = [];
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
 
399 399
         $this->paginator->setItemsPerPage(10)->setPagesInRange(5);
400 400
 
401
-        $this->paginator->setItemTotalCallback(static function (Pagination $pagination) use ($items): int {
401
+        $this->paginator->setItemTotalCallback(static function(Pagination $pagination) use ($items): int {
402 402
             $pagination->setMeta(['meta_3']);
403 403
 
404 404
             return \count($items);
405 405
         });
406 406
 
407
-        $this->paginator->setSliceCallback(static function (int $offset, int $length, Pagination $pagination) use ($items): array {
407
+        $this->paginator->setSliceCallback(static function(int $offset, int $length, Pagination $pagination) use ($items): array {
408 408
             $pagination->setMeta(array_merge($pagination->getMeta(), ['meta_4']));
409 409
 
410 410
             return \array_slice($items, $offset, $length);
@@ -477,13 +477,13 @@  discard block
 block discarded – undo
477 477
 
478 478
         $this->paginator->setItemsPerPage(-1)->setPagesInRange(5);
479 479
 
480
-        $this->paginator->setItemTotalCallback(static function (Pagination $pagination) use ($items): int {
480
+        $this->paginator->setItemTotalCallback(static function(Pagination $pagination) use ($items): int {
481 481
             $pagination->setMeta(['meta_3']);
482 482
 
483 483
             return \count($items);
484 484
         });
485 485
 
486
-        $this->paginator->setSliceCallback(static function (int $offset, int $length, Pagination $pagination) use ($items): array {
486
+        $this->paginator->setSliceCallback(static function(int $offset, int $length, Pagination $pagination) use ($items): array {
487 487
             $pagination->setMeta(array_merge($pagination->getMeta(), ['meta_4']));
488 488
 
489 489
             return \array_slice($items, $offset, $length);
@@ -556,13 +556,13 @@  discard block
 block discarded – undo
556 556
 
557 557
         $this->paginator->setItemsPerPage(10)->setPagesInRange(5);
558 558
 
559
-        $this->paginator->setItemTotalCallback(static function (Pagination $pagination) use ($items): int {
559
+        $this->paginator->setItemTotalCallback(static function(Pagination $pagination) use ($items): int {
560 560
             $pagination->setMeta(['meta_1']);
561 561
 
562 562
             return \count($items);
563 563
         });
564 564
 
565
-        $this->paginator->setSliceCallback(static function (int $offset, int $length, Pagination $pagination) use ($items): array {
565
+        $this->paginator->setSliceCallback(static function(int $offset, int $length, Pagination $pagination) use ($items): array {
566 566
             $pagination->setMeta(array_merge($pagination->getMeta(), ['meta_2']));
567 567
 
568 568
             return \array_slice($items, $offset, $length);
Please login to merge, or discard this patch.
src/Paginator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
             return $this->afterQueryCallback;
337 337
         }
338 338
 
339
-        return static function (): void {};
339
+        return static function(): void {};
340 340
     }
341 341
 
342 342
     /**
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
             return $this->beforeQueryCallback;
352 352
         }
353 353
 
354
-        return static function (): void {};
354
+        return static function(): void {};
355 355
     }
356 356
 
357 357
     /**
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 
432 432
         $config ??= [];
433 433
 
434
-        return array_filter($config, static function (mixed $value, string $key) use ($validKeys): bool {
434
+        return array_filter($config, static function(mixed $value, string $key) use ($validKeys): bool {
435 435
             if (!\in_array($key, $validKeys, true)) {
436 436
                 return false;
437 437
             }
Please login to merge, or discard this patch.