Updated: Changes for PHP 8.x compatibility
This commit is contained in:
@@ -392,7 +392,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
*
|
||||
* @see Iterator::rewind()
|
||||
*/
|
||||
public function rewind()
|
||||
public function rewind(): void
|
||||
{
|
||||
$this->getAll();
|
||||
$this->results = array_merge($this->results);
|
||||
@@ -406,7 +406,8 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @see Iterator::current()
|
||||
* @return ObjectModel
|
||||
*/
|
||||
public function current()
|
||||
#[ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return isset($this->results[$this->iterator]) ? $this->results[$this->iterator] : null;
|
||||
}
|
||||
@@ -417,7 +418,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @see Iterator::valid()
|
||||
* @return bool
|
||||
*/
|
||||
public function valid()
|
||||
public function valid(): bool
|
||||
{
|
||||
return $this->iterator < $this->total;
|
||||
}
|
||||
@@ -428,7 +429,8 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @see Iterator::key()
|
||||
* @return int
|
||||
*/
|
||||
public function key()
|
||||
#[ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
return $this->iterator;
|
||||
}
|
||||
@@ -438,7 +440,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
*
|
||||
* @see Iterator::next()
|
||||
*/
|
||||
public function next()
|
||||
public function next(): void
|
||||
{
|
||||
$this->iterator++;
|
||||
}
|
||||
@@ -449,7 +451,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @see Countable::count()
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
$this->getAll();
|
||||
return count($this->results);
|
||||
@@ -462,7 +464,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @param $offset
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
$this->getAll();
|
||||
return isset($this->results[$offset]);
|
||||
@@ -475,6 +477,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @param $offset
|
||||
* @return ObjectModel
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
$this->getAll();
|
||||
@@ -491,7 +494,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @param $offset
|
||||
* @param $value
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
if (!$value instanceof $this->classname) {
|
||||
throw new PrestaShopException('You cannot add an element which is not an instance of '.$this->classname);
|
||||
@@ -511,7 +514,7 @@ class PrestaShopCollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @see ArrayAccess::offsetUnset()
|
||||
* @param $offset
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
$this->getAll();
|
||||
unset($this->results[$offset]);
|
||||
|
||||
Reference in New Issue
Block a user