mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fix #19041: Fix PHP 8.1 issues
This commit is contained in:

committed by
GitHub

parent
4bd551d143
commit
1271bc419f
@ -26,6 +26,7 @@ trait ArrayAccessTrait
|
||||
* It will be implicitly called when you use `foreach` to traverse the collection.
|
||||
* @return \ArrayIterator an iterator for traversing the cookies in the collection.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->data);
|
||||
@ -36,6 +37,7 @@ trait ArrayAccessTrait
|
||||
* This method is required by Countable interface.
|
||||
* @return int number of data elements.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->data);
|
||||
@ -46,6 +48,7 @@ trait ArrayAccessTrait
|
||||
* @param mixed $offset the offset to check on
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->data[$offset]);
|
||||
@ -56,6 +59,7 @@ trait ArrayAccessTrait
|
||||
* @param int $offset the offset to retrieve element.
|
||||
* @return mixed the element at the offset, null if no element is found at the offset
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return isset($this->data[$offset]) ? $this->data[$offset] : null;
|
||||
@ -66,6 +70,7 @@ trait ArrayAccessTrait
|
||||
* @param int $offset the offset to set element
|
||||
* @param mixed $item the element value
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $item)
|
||||
{
|
||||
$this->data[$offset] = $item;
|
||||
@ -75,6 +80,7 @@ trait ArrayAccessTrait
|
||||
* This method is required by the interface [[\ArrayAccess]].
|
||||
* @param mixed $offset the offset to unset element
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->data[$offset]);
|
||||
|
Reference in New Issue
Block a user