@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | ]); |
79 | 79 | |
80 | 80 | $beforeQueryFired = false; |
81 | - $paginator->setBeforeQueryCallback(static function () use (&$beforeQueryFired): void { |
|
81 | + $paginator->setBeforeQueryCallback(static function() use (&$beforeQueryFired): void { |
|
82 | 82 | $beforeQueryFired = true; |
83 | 83 | }); |
84 | 84 | |
85 | 85 | $afterQueryFired = false; |
86 | - $paginator->setAfterQueryCallback(static function () use (&$afterQueryFired): void { |
|
86 | + $paginator->setAfterQueryCallback(static function() use (&$afterQueryFired): void { |
|
87 | 87 | $afterQueryFired = true; |
88 | 88 | }); |
89 | 89 | |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | ]); |
118 | 118 | |
119 | 119 | $beforeQueryFired = false; |
120 | - $paginator->setBeforeQueryCallback(static function () use (&$beforeQueryFired): void { |
|
120 | + $paginator->setBeforeQueryCallback(static function() use (&$beforeQueryFired): void { |
|
121 | 121 | $beforeQueryFired = true; |
122 | 122 | }); |
123 | 123 | |
124 | 124 | $afterQueryFired = false; |
125 | - $paginator->setAfterQueryCallback(static function () use (&$afterQueryFired): void { |
|
125 | + $paginator->setAfterQueryCallback(static function() use (&$afterQueryFired): void { |
|
126 | 126 | $afterQueryFired = true; |
127 | 127 | }); |
128 | 128 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | ->setItemsPerPage(10) |
178 | 178 | ->setPagesInRange(5); |
179 | 179 | |
180 | - $paginator->setItemTotalCallback(static function (): int { |
|
180 | + $paginator->setItemTotalCallback(static function(): int { |
|
181 | 181 | /** @var PDOStatement $result */ |
182 | 182 | $result = self::$dbObj->query("SELECT COUNT(*) as totalCount FROM facts"); |
183 | 183 | /** @var string $row */ |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | }); |
188 | 188 | |
189 | 189 | // Pass our slice callback. |
190 | - $paginator->setSliceCallback(static function (int $offset, int $length): array { |
|
190 | + $paginator->setSliceCallback(static function(int $offset, int $length): array { |
|
191 | 191 | /** @var PDOStatement $result */ |
192 | 192 | $result = self::$dbObj->query(sprintf('SELECT name, area FROM facts ORDER BY area DESC LIMIT %d, %d', $offset, $length), PDO::FETCH_ASSOC); |
193 | 193 | $collection = []; |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | |
381 | 381 | $this->paginator->setItemsPerPage(10)->setPagesInRange(5); |
382 | 382 | |
383 | - $this->paginator->setItemTotalCallback(static function (Pagination $pagination) use ($items): int { |
|
383 | + $this->paginator->setItemTotalCallback(static function(Pagination $pagination) use ($items): int { |
|
384 | 384 | $pagination->setMeta(['meta_3']); |
385 | 385 | |
386 | 386 | return \count($items); |
387 | 387 | }); |
388 | 388 | |
389 | - $this->paginator->setSliceCallback(static function (int $offset, int $length, Pagination $pagination) use ($items): array { |
|
389 | + $this->paginator->setSliceCallback(static function(int $offset, int $length, Pagination $pagination) use ($items): array { |
|
390 | 390 | $pagination->setMeta(array_merge($pagination->getMeta(), ['meta_4'])); |
391 | 391 | |
392 | 392 | return \array_slice($items, $offset, $length); |
@@ -459,13 +459,13 @@ discard block |
||
459 | 459 | |
460 | 460 | $this->paginator->setItemsPerPage(-1)->setPagesInRange(5); |
461 | 461 | |
462 | - $this->paginator->setItemTotalCallback(static function (Pagination $pagination) use ($items): int { |
|
462 | + $this->paginator->setItemTotalCallback(static function(Pagination $pagination) use ($items): int { |
|
463 | 463 | $pagination->setMeta(['meta_3']); |
464 | 464 | |
465 | 465 | return \count($items); |
466 | 466 | }); |
467 | 467 | |
468 | - $this->paginator->setSliceCallback(static function (int $offset, int $length, Pagination $pagination) use ($items): array { |
|
468 | + $this->paginator->setSliceCallback(static function(int $offset, int $length, Pagination $pagination) use ($items): array { |
|
469 | 469 | $pagination->setMeta(array_merge($pagination->getMeta(), ['meta_4'])); |
470 | 470 | |
471 | 471 | return \array_slice($items, $offset, $length); |
@@ -538,13 +538,13 @@ discard block |
||
538 | 538 | |
539 | 539 | $this->paginator->setItemsPerPage(10)->setPagesInRange(5); |
540 | 540 | |
541 | - $this->paginator->setItemTotalCallback(static function (Pagination $pagination) use ($items): int { |
|
541 | + $this->paginator->setItemTotalCallback(static function(Pagination $pagination) use ($items): int { |
|
542 | 542 | $pagination->setMeta(['meta_1']); |
543 | 543 | |
544 | 544 | return \count($items); |
545 | 545 | }); |
546 | 546 | |
547 | - $this->paginator->setSliceCallback(static function (int $offset, int $length, Pagination $pagination) use ($items): array { |
|
547 | + $this->paginator->setSliceCallback(static function(int $offset, int $length, Pagination $pagination) use ($items): array { |
|
548 | 548 | $pagination->setMeta(array_merge($pagination->getMeta(), ['meta_2'])); |
549 | 549 | |
550 | 550 | return \array_slice($items, $offset, $length); |
@@ -27,4 +27,6 @@ |
||
27 | 27 | * Class CallbackInvalidException. |
28 | 28 | * @psalm-api |
29 | 29 | */ |
30 | -class CallbackInvalidException extends RuntimeException {} |
|
30 | +class CallbackInvalidException extends RuntimeException |
|
31 | +{ |
|
32 | +} |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
107 | - $this->setItemTotalCallback($config['itemTotalCallback'] ?? static function (): void {}); |
|
108 | - $this->setSliceCallback($config['sliceCallback'] ?? static function (): void {}); |
|
107 | + $this->setItemTotalCallback($config['itemTotalCallback'] ?? static function(): void {}); |
|
108 | + $this->setSliceCallback($config['sliceCallback'] ?? static function(): void {}); |
|
109 | 109 | $this->setItemsPerPage($config['itemsPerPage'] ?? 10); |
110 | 110 | $this->setPagesInRange($config['pagesInRange'] ?? 5); |
111 | 111 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | return $this->afterQueryCallback; |
328 | 328 | } |
329 | 329 | |
330 | - return static function (): void {}; |
|
330 | + return static function(): void {}; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | return $this->beforeQueryCallback; |
343 | 343 | } |
344 | 344 | |
345 | - return static function (): void {}; |
|
345 | + return static function(): void {}; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | |
428 | 428 | $config ??= []; |
429 | 429 | |
430 | - return array_filter($config, static function (mixed $value, string $key) use ($validKeys): bool { |
|
430 | + return array_filter($config, static function(mixed $value, string $key) use ($validKeys): bool { |
|
431 | 431 | if (!\in_array($key, $validKeys, true)) { |
432 | 432 | return false; |
433 | 433 | } |