Skip to content

Commit 3a8c20c

Browse files
committed
fix CI again
1 parent 0b07f61 commit 3a8c20c

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

src/EmptyResultIterator.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
namespace TheCodingMachine\TDBM;
44

5-
use Psr\Log\NullLogger;
6-
use TheCodingMachine\TDBM\ResultIterator;
7-
85
class EmptyResultIterator extends ResultIterator
96
{
10-
protected function __construct()
11-
{
12-
$this->totalCount = 0;
13-
$this->logger = new NullLogger();
14-
}
15-
167
}

src/ResultIterator.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ class ResultIterator implements Result, \ArrayAccess, \JsonSerializable
6565
private $innerResultIterator;
6666

6767
/** @var int|null */
68-
protected $totalCount;
68+
private $totalCount;
6969

7070
/** @var int */
7171
private $mode;
7272

7373
/** @var LoggerInterface */
74-
protected $logger;
74+
private $logger;
7575

76-
protected function __construct()
76+
final private function __construct()
7777
{
7878
}
7979

@@ -83,7 +83,7 @@ protected function __construct()
8383
*/
8484
public static function createResultIterator(QueryFactory $queryFactory, array $parameters, ObjectStorageInterface $objectStorage, ?string $className, TDBMService $tdbmService, MagicQuery $magicQuery, int $mode, LoggerInterface $logger): self
8585
{
86-
$iterator = new self();
86+
$iterator = new static();
8787
if ($mode !== TDBMService::MODE_CURSOR && $mode !== TDBMService::MODE_ARRAY) {
8888
throw new TDBMException("Unknown fetch mode: '".$mode."'");
8989
}
@@ -101,7 +101,10 @@ public static function createResultIterator(QueryFactory $queryFactory, array $p
101101

102102
public static function createEmpyIterator(): self
103103
{
104-
return new EmptyResultIterator();
104+
$iterator = new static();
105+
$iterator->totalCount = 0;
106+
$iterator->logger = new NullLogger();
107+
return $iterator;
105108
}
106109

107110
protected function executeCountQuery(): void

tests/AbstractTDBMObjectTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testEmptyResultIterator()
4444

4545
public function testEmptyPageIterator()
4646
{
47-
$a = ResultIterator::createEmpyIterator();
47+
$a = EmptyResultIterator::createEmpyIterator();
4848
$b = $a->take(0, 10);
4949
foreach ($b as $empty) {
5050
throw new \LogicException("Not supposed to iterate on an empty page iterator.");

0 commit comments

Comments
 (0)