mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°4517 - PHP 8.1: Fix return types to match parent Countable class
* DBObjectSet::Seek() now returns void instead of the current object, this was mandatory in to order to match parent class. Returned object is never used in iTop core and extensions so we consider it ok and will document it in the migration notes.
This commit is contained in:
@@ -38,7 +38,7 @@ interface iDBObjectSetIterator extends Countable
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function Count();
|
public function Count(): int;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the cursor to the first item in the collection. Equivalent to Seek(0)
|
* 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
|
* @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.
|
* Fetch the object at the current position in the collection and move the cursor to the next position.
|
||||||
|
|||||||
@@ -842,7 +842,7 @@ class DBObjectSet implements iDBObjectSetIterator
|
|||||||
* @throws \MySQLException
|
* @throws \MySQLException
|
||||||
* @throws \MySQLHasGoneAwayException
|
* @throws \MySQLHasGoneAwayException
|
||||||
*/
|
*/
|
||||||
public function Count()
|
public function Count(): int
|
||||||
{
|
{
|
||||||
if (is_null($this->m_iNumTotalDBRows))
|
if (is_null($this->m_iNumTotalDBRows))
|
||||||
{
|
{
|
||||||
@@ -1077,14 +1077,13 @@ class DBObjectSet implements iDBObjectSetIterator
|
|||||||
*
|
*
|
||||||
* @param int $iRow
|
* @param int $iRow
|
||||||
*
|
*
|
||||||
* @return int|mixed
|
|
||||||
*
|
|
||||||
* @throws \CoreException
|
* @throws \CoreException
|
||||||
* @throws \MissingQueryArgument
|
* @throws \MissingQueryArgument
|
||||||
* @throws \MySQLException
|
* @throws \MySQLException
|
||||||
* @throws \MySQLHasGoneAwayException
|
* @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();
|
if (!$this->m_bLoaded) $this->Load();
|
||||||
|
|
||||||
@@ -1093,7 +1092,6 @@ class DBObjectSet implements iDBObjectSetIterator
|
|||||||
{
|
{
|
||||||
$this->m_oSQLResult->data_seek($this->m_iCurrRow);
|
$this->m_oSQLResult->data_seek($this->m_iCurrRow);
|
||||||
}
|
}
|
||||||
return $this->m_iCurrRow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
|
|||||||
* @throws \CoreUnexpectedValue
|
* @throws \CoreUnexpectedValue
|
||||||
* @throws \MySQLException
|
* @throws \MySQLException
|
||||||
*/
|
*/
|
||||||
public function Count()
|
public function Count(): int
|
||||||
{
|
{
|
||||||
$this->LoadOriginalIds();
|
$this->LoadOriginalIds();
|
||||||
$iRet = count($this->aPreserved) + count($this->aAdded) + count($this->aModified);
|
$iRet = count($this->aPreserved) + count($this->aAdded) + count($this->aModified);
|
||||||
@@ -326,7 +326,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @internal param int $iRow
|
* @internal param int $iRow
|
||||||
*/
|
*/
|
||||||
public function Seek($iPosition)
|
public function Seek($iPosition): void
|
||||||
{
|
{
|
||||||
$this->LoadOriginalIds();
|
$this->LoadOriginalIds();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user