Skip to content

Commit c72e250

Browse files
committed
Add return type for rdbms.ResultSet::getIterator()
Fixes #51
1 parent 8fba095 commit c72e250

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ RDBMS support for the XP Framework: MySQL, Sybase, MSSQL, PostgreSQL, SQLite3, I
33

44
## ?.?.? / ????-??-??
55

6+
* Fixed #51: *Warning: Return type of rdbms\ResultSet::getIterator()*
7+
(@thekid)
8+
69
## 13.0.3 / 2022-02-27
710

811
* Fixed "Creation of dynamic property" warnings in PHP 8.2 - @thekid

src/main/php/rdbms/ResultSet.class.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php namespace rdbms;
22

3+
use IteratorAggregate, Traversable;
34
use lang\Closeable;
45
use util\{Objects, TimeZone};
56

@@ -17,7 +18,7 @@
1718
*
1819
* @test xp://rdbms.unittest.ResultSetTest
1920
*/
20-
abstract class ResultSet implements Closeable, \IteratorAggregate {
21+
abstract class ResultSet implements Closeable, IteratorAggregate {
2122
protected $handle, $fields, $tz;
2223
private $iterator= null;
2324

@@ -66,30 +67,20 @@ public abstract function next($field= null);
6667
*/
6768
public function close() { }
6869

69-
/**
70-
* Returns an iterator
71-
*
72-
* @return php.Iterator
73-
*/
74-
public function getIterator() {
70+
/** Returns an iterator */
71+
public function getIterator(): Traversable {
7572
if (null === $this->iterator) {
7673
$this->iterator= new ResultSetIterator($this);
7774
}
7875
return $this->iterator;
7976
}
8077

81-
/**
82-
* Returns a string representation of this object
83-
*
84-
* @return string
85-
*/
78+
/** @return string */
8679
public function toString() {
8780
return nameof($this).'('.Objects::stringOf($this->handle).')@'.Objects::stringOf($this->fields);
8881
}
8982

90-
/**
91-
* Destructor. Ensures `close()` is called.
92-
*/
83+
/** Destructor. Ensures `close()` is called */
9384
public function __destruct() {
9485
$this->close();
9586
}

0 commit comments

Comments
 (0)