N°4517 - PHP 8.1: Replace mixed return types with #[\ReturnTypeWillChange] PHP attributes to restore PHP 7.4 compatibility

Also add comment on previous #[\ReturnTypeWillChange]
This commit is contained in:
Molkobain
2022-05-20 16:07:38 +02:00
committed by acognet
parent 7dc4a2776b
commit 6facaec353
5 changed files with 17 additions and 5 deletions

View File

@@ -77,6 +77,7 @@ class DesignDocument extends DOMDocument
*
* @return int
*/
// Return type union is not supported by PHP 7.4, we can remove the following PHP attribute and add the return type once iTop min PHP version is PHP 8.0+
#[\ReturnTypeWillChange]
public function save($filename, $options = 0)
{

View File

@@ -38,7 +38,9 @@ class OQLParser_yyToken implements ArrayAccess
return isset($this->metadata[$offset]);
}
function offsetGet($offset): mixed
// Return type mixed is not supported by PHP 7.4, we can remove the following PHP attribute and add the return type once iTop min PHP version is PHP 8.0+
#[\ReturnTypeWillChange]
function offsetGet($offset)
{
return $this->metadata[$offset];
}

View File

@@ -374,7 +374,9 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
*/
public function current(): mixed
// Return type mixed is not supported by PHP 7.4, we can remove the following PHP attribute and add the return type once iTop min PHP version is PHP 8.0+
#[\ReturnTypeWillChange]
public function current()
{
$this->LoadOriginalIds();
@@ -439,7 +441,9 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
* @link http://php.net/manual/en/iterator.key.php
* @return mixed scalar on success, or null on failure.
*/
public function key(): mixed
// Return type mixed is not supported by PHP 7.4, we can remove the following PHP attribute and add the return type once iTop min PHP version is PHP 8.0+
#[\ReturnTypeWillChange]
public function key()
{
return $this->iCursor;
}

View File

@@ -760,12 +760,16 @@ class RelationTypeIterator implements Iterator
$this->iCurrentIdx++;
}
public function current(): mixed
// Return type mixed is not supported by PHP 7.4, we can remove the following PHP attribute and add the return type once iTop min PHP version is PHP 8.0+
#[\ReturnTypeWillChange]
public function current()
{
return $this->aList[$this->iCurrentIdx];
}
public function key(): mixed
// Return type mixed is not supported by PHP 7.4, we can remove the following PHP attribute and add the return type once iTop min PHP version is PHP 8.0+
#[\ReturnTypeWillChange]
public function key()
{
return $this->iCurrentIdx;
}

View File

@@ -2538,6 +2538,7 @@ class MFDocument extends \Combodo\iTop\DesignDocument
* @return string
* @throws \Exception
*/
// Return type union is not supported by PHP 7.4, we can remove the following PHP attribute and add the return type once iTop min PHP version is PHP 8.0+
#[\ReturnTypeWillChange]
public function saveXML(DOMNode $node = null, $options = 0)
{