bug #3536 Add ReturnTypeWillChange to JsonSerializable implementation (derrabus)

This PR was merged into the 2.x branch.

Discussion
----------

Add ReturnTypeWillChange to JsonSerializable implementation

On PHP 8.1, implementations of `JsonSerializable` should declare a return type.

In order to avoid a deprecation warning and maintain backwards compatibility, I've added the `ReturnTypeWillChange` attribute to declare that our implementation will add the necessary return type in a future release.

Commits
-------

507f78d9 Add ReturnTypeWillChange to JsonSerializable implementation
This commit is contained in:
Fabien Potencier
2021-06-06 18:30:46 +02:00
+1
View File
@@ -40,6 +40,7 @@ class Markup implements \Countable, \JsonSerializable
return mb_strlen($this->content, $this->charset);
}
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->content;