diff --git a/core/dbobjectiterator.php b/core/dbobjectiterator.php index 85e1e5208..8f9311266 100644 --- a/core/dbobjectiterator.php +++ b/core/dbobjectiterator.php @@ -38,7 +38,7 @@ interface iDBObjectSetIterator extends Countable * * @return int */ - public function Count(); + public function Count(): int; /** * Reset the cursor to the first item in the collection. Equivalent to Seek(0) @@ -52,7 +52,7 @@ interface iDBObjectSetIterator extends Countable * * @param int $iRow */ - public function Seek($iPosition); + public function Seek($iPosition): void; /** * Fetch the object at the current position in the collection and move the cursor to the next position. diff --git a/core/dbobjectset.class.php b/core/dbobjectset.class.php index 57c2da786..fb8ebb43b 100644 --- a/core/dbobjectset.class.php +++ b/core/dbobjectset.class.php @@ -842,7 +842,7 @@ class DBObjectSet implements iDBObjectSetIterator * @throws \MySQLException * @throws \MySQLHasGoneAwayException */ - public function Count() + public function Count(): int { if (is_null($this->m_iNumTotalDBRows)) { @@ -1077,14 +1077,13 @@ class DBObjectSet implements iDBObjectSetIterator * * @param int $iRow * - * @return int|mixed - * * @throws \CoreException * @throws \MissingQueryArgument * @throws \MySQLException * @throws \MySQLHasGoneAwayException + * @since 3.1.0 N°4517 Now returns void for return type to match parent class and be compatible with PHP 8.1 */ - public function Seek($iRow) + public function Seek($iRow): void { if (!$this->m_bLoaded) $this->Load(); @@ -1093,7 +1092,6 @@ class DBObjectSet implements iDBObjectSetIterator { $this->m_oSQLResult->data_seek($this->m_iCurrRow); } - return $this->m_iCurrRow; } /** diff --git a/core/ormlinkset.class.inc.php b/core/ormlinkset.class.inc.php index caa5be16c..f39863755 100644 --- a/core/ormlinkset.class.inc.php +++ b/core/ormlinkset.class.inc.php @@ -311,7 +311,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator * @throws \CoreUnexpectedValue * @throws \MySQLException */ - public function Count() + public function Count(): int { $this->LoadOriginalIds(); $iRet = count($this->aPreserved) + count($this->aAdded) + count($this->aModified); @@ -326,7 +326,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator * @throws Exception * @internal param int $iRow */ - public function Seek($iPosition) + public function Seek($iPosition): void { $this->LoadOriginalIds();