Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ReturnTypeWillChange to FrameCollection #706

Merged
merged 2 commits into from
Sep 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/Whoops/Exception/FrameCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use ArrayIterator;
use Countable;
use IteratorAggregate;
use ReturnTypeWillChange;
use Serializable;
use UnexpectedValueException;

Expand Down Expand Up @@ -89,6 +90,7 @@ public function getArray()
* @see IteratorAggregate::getIterator
* @return ArrayIterator
*/
#[ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->frames);
Expand All @@ -98,6 +100,7 @@ public function getIterator()
* @see ArrayAccess::offsetExists
* @param int $offset
*/
#[ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->frames[$offset]);
Expand All @@ -107,6 +110,7 @@ public function offsetExists($offset)
* @see ArrayAccess::offsetGet
* @param int $offset
*/
#[ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->frames[$offset];
Expand All @@ -116,6 +120,7 @@ public function offsetGet($offset)
* @see ArrayAccess::offsetSet
* @param int $offset
*/
#[ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
throw new \Exception(__CLASS__ . ' is read only');
Expand All @@ -125,6 +130,7 @@ public function offsetSet($offset, $value)
* @see ArrayAccess::offsetUnset
* @param int $offset
*/
#[ReturnTypeWillChange]
public function offsetUnset($offset)
{
throw new \Exception(__CLASS__ . ' is read only');
Expand All @@ -134,6 +140,7 @@ public function offsetUnset($offset)
* @see Countable::count
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
return count($this->frames);
Expand All @@ -155,6 +162,7 @@ public function countIsApplication()
* @see Serializable::serialize
* @return string
*/
#[ReturnTypeWillChange]
public function serialize()
{
return serialize($this->frames);
Expand All @@ -164,11 +172,22 @@ public function serialize()
* @see Serializable::unserialize
* @param string $serializedFrames
*/
#[ReturnTypeWillChange]
public function unserialize($serializedFrames)
{
$this->frames = unserialize($serializedFrames);
}

public function __serialize(): array
{
return $this->frames;
}

public function __unserialize(array $serializedFrames): void
{
$this->frames = $serializedFrames;
}
Comment on lines +181 to +189
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these related to the ReturnTypeWillChange or is this an accidental addition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also needed for PHP 8.1 compatibility because Serializable is deprecated.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


/**
* @param Frame[] $frames Array of Frame instances, usually from $e->getPrevious()
*/
Expand Down