Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
* [Updating from v1 to v2](v1-to-v2-update.md)
* [Updating from v2 to v3](v2-to-v3-update.md)
* [Updating from v3 to v4](v3-to-v4-update.md)
* [Updating from v4 to v5](v4-to-v5-update.md)
9 changes: 9 additions & 0 deletions docs/v4-to-v5-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Updating from v4 to v5

The following changes were made to the Database package between v4 and v5.

### `DatabaseIterator` has native return types

`DatabaseIterator::count()`, `current()`, `key()`, `next()`, `rewind()` and `valid()` declare the return types of
`Iterator` and `Countable` (`int`, `mixed`, `mixed`, `void`, `void`, `bool`) instead of relying on
`#[\ReturnTypeWillChange]`. Subclasses that override these methods must declare the same return types.
18 changes: 6 additions & 12 deletions src/DatabaseIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ public function __destruct()
* @see Countable::count()
* @since 1.0
*/
#[\ReturnTypeWillChange]
public function count()
public function count(): int
{
if ($this->statement) {
return $this->statement->rowCount();
Expand All @@ -136,8 +135,7 @@ public function count()
* @see Iterator::current()
* @since 1.0
*/
#[\ReturnTypeWillChange]
public function current()
public function current(): mixed
{
return $this->current;
}
Expand All @@ -150,8 +148,7 @@ public function current()
* @see Iterator::key()
* @since 1.0
*/
#[\ReturnTypeWillChange]
public function key()
public function key(): mixed
{
return $this->key;
}
Expand All @@ -164,8 +161,7 @@ public function key()
* @see Iterator::next()
* @since 1.0
*/
#[\ReturnTypeWillChange]
public function next()
public function next(): void
{
// Set the default key as being the number of fetched object
$this->key = $this->fetched;
Expand Down Expand Up @@ -195,8 +191,7 @@ public function next()
* @see Iterator::rewind()
* @since 1.0
*/
#[\ReturnTypeWillChange]
public function rewind()
public function rewind(): void
{
}

Expand All @@ -208,8 +203,7 @@ public function rewind()
* @see Iterator::valid()
* @since 1.0
*/
#[\ReturnTypeWillChange]
public function valid()
public function valid(): bool
{
return (bool) $this->current;
}
Expand Down
Loading