From 2852f647bbfebf598304249837cec32ffab44b27 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Mon, 2 Aug 2021 16:49:13 +0200 Subject: [PATCH] Add ReturnTypeWillChange attribute (#2269) Adds ReturnTypeWillChange attribute in order to not break forward compatibility with php 8 --- src/Api/DateTimeResult.php | 2 ++ src/Crypto/MetadataEnvelope.php | 2 ++ src/DynamoDb/BinaryValue.php | 2 ++ src/DynamoDb/NumberValue.php | 3 +++ src/DynamoDb/SessionHandler.php | 8 ++++++++ src/DynamoDb/SetValue.php | 3 +++ 6 files changed, 20 insertions(+) diff --git a/src/Api/DateTimeResult.php b/src/Api/DateTimeResult.php index d61488ac38..3b2bbb24ea 100644 --- a/src/Api/DateTimeResult.php +++ b/src/Api/DateTimeResult.php @@ -4,6 +4,7 @@ use Aws\Api\Parser\Exception\ParserException; use Exception; +use \ReturnTypeWillChange; /** * DateTime overrides that make DateTime work more seamlessly as a string, @@ -94,6 +95,7 @@ public function __toString() * * @return mixed|string */ + #[ReturnTypeWillChange] public function jsonSerialize() { return (string) $this; diff --git a/src/Crypto/MetadataEnvelope.php b/src/Crypto/MetadataEnvelope.php index 043a6433ee..b70e3bcf2b 100644 --- a/src/Crypto/MetadataEnvelope.php +++ b/src/Crypto/MetadataEnvelope.php @@ -6,6 +6,7 @@ use \IteratorAggregate; use \InvalidArgumentException; use \JsonSerializable; +use \ReturnTypeWillChange; /** * Stores encryption metadata for reading and writing. @@ -49,6 +50,7 @@ public function offsetSet($name, $value) $this->data[$name] = $value; } + #[ReturnTypeWillChange] public function jsonSerialize() { return $this->data; diff --git a/src/DynamoDb/BinaryValue.php b/src/DynamoDb/BinaryValue.php index 946377f320..c125ab813a 100644 --- a/src/DynamoDb/BinaryValue.php +++ b/src/DynamoDb/BinaryValue.php @@ -2,6 +2,7 @@ namespace Aws\DynamoDb; use GuzzleHttp\Psr7; +use \ReturnTypeWillChange; /** * Special object to represent a DynamoDB binary (B) value. @@ -24,6 +25,7 @@ public function __construct($value) $this->value = (string) $value; } + #[ReturnTypeWillChange] public function jsonSerialize() { return $this->value; diff --git a/src/DynamoDb/NumberValue.php b/src/DynamoDb/NumberValue.php index 093143b424..235ec44db5 100644 --- a/src/DynamoDb/NumberValue.php +++ b/src/DynamoDb/NumberValue.php @@ -1,6 +1,8 @@ value = (string) $value; } + #[ReturnTypeWillChange] public function jsonSerialize() { return $this->value; diff --git a/src/DynamoDb/SessionHandler.php b/src/DynamoDb/SessionHandler.php index 5246725ac3..1b302a8291 100644 --- a/src/DynamoDb/SessionHandler.php +++ b/src/DynamoDb/SessionHandler.php @@ -1,6 +1,8 @@ savePath = $savePath; @@ -114,6 +117,7 @@ public function open($savePath, $sessionName) * * @return bool Success */ + #[ReturnTypeWillChange] public function close() { $id = session_id(); @@ -134,6 +138,7 @@ public function close() * * @return string Session data. */ + #[ReturnTypeWillChange] public function read($id) { $this->openSessionId = $id; @@ -167,6 +172,7 @@ public function read($id) * * @return bool Whether or not the operation succeeded. */ + #[ReturnTypeWillChange] public function write($id, $data) { $changed = $id !== $this->openSessionId @@ -187,6 +193,7 @@ public function write($id, $data) * * @return bool Whether or not the operation succeeded. */ + #[ReturnTypeWillChange] public function destroy($id) { $this->openSessionId = $id; @@ -206,6 +213,7 @@ public function destroy($id) * @return bool Whether or not the operation succeeded. * @codeCoverageIgnore */ + #[ReturnTypeWillChange] public function gc($maxLifetime) { // Garbage collection for a DynamoDB table must be triggered manually. diff --git a/src/DynamoDb/SetValue.php b/src/DynamoDb/SetValue.php index 5bee62bf58..c45858a41a 100644 --- a/src/DynamoDb/SetValue.php +++ b/src/DynamoDb/SetValue.php @@ -1,6 +1,8 @@ values); } + #[ReturnTypeWillChange] public function jsonSerialize() { return $this->toArray();