Skip to content

Commit

Permalink
fix CI again
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenk committed May 14, 2024
1 parent 0b07f61 commit 3a8c20c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
9 changes: 0 additions & 9 deletions src/EmptyResultIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@

namespace TheCodingMachine\TDBM;

use Psr\Log\NullLogger;
use TheCodingMachine\TDBM\ResultIterator;

class EmptyResultIterator extends ResultIterator
{
protected function __construct()
{
$this->totalCount = 0;
$this->logger = new NullLogger();
}

}
13 changes: 8 additions & 5 deletions src/ResultIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ class ResultIterator implements Result, \ArrayAccess, \JsonSerializable
private $innerResultIterator;

/** @var int|null */
protected $totalCount;
private $totalCount;

/** @var int */
private $mode;

/** @var LoggerInterface */
protected $logger;
private $logger;

protected function __construct()
final private function __construct()
{
}

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

public static function createEmpyIterator(): self
{
return new EmptyResultIterator();
$iterator = new static();
$iterator->totalCount = 0;
$iterator->logger = new NullLogger();
return $iterator;
}

protected function executeCountQuery(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/AbstractTDBMObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testEmptyResultIterator()

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

0 comments on commit 3a8c20c

Please sign in to comment.