Skip to content

Commit

Permalink
Result: fix return type of current()
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Apr 13, 2020
1 parent 8330829 commit 7545696
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/Result/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@

namespace Nextras\Dbal\Result;

use Countable;
use DateTimeZone;
use Nextras\Dbal\Drivers\IDriver;
use Nextras\Dbal\Drivers\IResultAdapter;
use Nextras\Dbal\InvalidArgumentException;
use Nextras\Dbal\Utils\DateTimeImmutable;
use SeekableIterator;
use function assert;
use function date_default_timezone_get;
use function iterator_to_array;


/**
* @implements \SeekableIterator<int, Row>
* @implements SeekableIterator<int, Row>
*/
class Result implements \SeekableIterator, \Countable
class Result implements SeekableIterator, Countable
{
/** @var IResultAdapter */
private $adapter;
Expand Down Expand Up @@ -243,8 +248,9 @@ public function key(): int
}


public function current(): ?Row
public function current(): Row
{
assert($this->iteratorRow !== null);
return $this->iteratorRow;
}

Expand Down
1 change: 0 additions & 1 deletion tests/cases/unit/ResultTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class ResultTest extends TestCase
Assert::same(['First'], $names);

Assert::false($result->valid());
Assert::null($result->current());
Assert::same(1, $result->key());

$result->rewind();
Expand Down

0 comments on commit 7545696

Please sign in to comment.