Skip to content

Commit 5c8d1ae

Browse files
authored
Make Cookie compatible with ArrayAccess
1 parent 6ba40da commit 5c8d1ae

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

system/Cookie/Cookie.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use DateTimeInterface;
1818
use InvalidArgumentException;
1919
use LogicException;
20+
use ReturnTypeWillChange;
2021

2122
/**
2223
* A `Cookie` class represents an immutable HTTP cookie value object.
@@ -562,24 +563,23 @@ public function withRaw(bool $raw = true)
562563
/**
563564
* Whether an offset exists.
564565
*
565-
* @param string $offset
566-
*
567-
* @return bool
566+
* @param mixed $offset
568567
*/
569-
public function offsetExists($offset)
568+
public function offsetExists($offset): bool
570569
{
571570
return $offset === 'expire' ? true : property_exists($this, $offset);
572571
}
573572

574573
/**
575574
* Offset to retrieve.
576575
*
577-
* @param string $offset
576+
* @param mixed $offset
578577
*
579578
* @throws InvalidArgumentException
580579
*
581580
* @return mixed
582581
*/
582+
#[ReturnTypeWillChange]
583583
public function offsetGet($offset)
584584
{
585585
if (! $this->offsetExists($offset)) {
@@ -592,24 +592,24 @@ public function offsetGet($offset)
592592
/**
593593
* Offset to set.
594594
*
595-
* @param string $offset
596-
* @param mixed $value
595+
* @param mixed $offset
596+
* @param mixed $value
597597
*
598598
* @throws LogicException
599599
*/
600-
public function offsetSet($offset, $value)
600+
public function offsetSet($offset, $value): void
601601
{
602602
throw new LogicException(sprintf('Cannot set values of properties of %s as it is immutable.', static::class));
603603
}
604604

605605
/**
606606
* Offset to unset.
607607
*
608-
* @param string $offset
608+
* @param mixed $offset
609609
*
610610
* @throws LogicException
611611
*/
612-
public function offsetUnset($offset)
612+
public function offsetUnset($offset): void
613613
{
614614
throw new LogicException(sprintf('Cannot unset values of properties of %s as it is immutable.', static::class));
615615
}

0 commit comments

Comments
 (0)