From fe87de31bf4a7623bb4beb6e4890ac2d33a4a402 Mon Sep 17 00:00:00 2001 From: Oleg Kolesov <47299406+oleg1540@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:19:12 +0300 Subject: [PATCH] #9293 - incompatible return type php 8.1 (#9301) * #9293 - fix Missing function's return type declaration (incompatible return type php 8.1) * #9293 - remove return type void for compatible with php 7.0 * #9293 - add todo for mixed return type Co-authored-by: Adam Cozzette --- php/src/Google/Protobuf/Internal/MapField.php | 3 +++ php/src/Google/Protobuf/Internal/MapFieldIter.php | 4 ++++ php/src/Google/Protobuf/Internal/RepeatedField.php | 3 +++ php/src/Google/Protobuf/Internal/RepeatedFieldIter.php | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/php/src/Google/Protobuf/Internal/MapField.php b/php/src/Google/Protobuf/Internal/MapField.php index 86463a9a47..d44377a179 100644 --- a/php/src/Google/Protobuf/Internal/MapField.php +++ b/php/src/Google/Protobuf/Internal/MapField.php @@ -135,6 +135,7 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable * @return object The stored element at given key. * @throws \ErrorException Invalid type for index. * @throws \ErrorException Non-existing index. + * @todo need to add return type mixed (require update php version to 8.0) */ #[\ReturnTypeWillChange] public function offsetGet($key) @@ -153,6 +154,7 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable * @throws \ErrorException Invalid type for key. * @throws \ErrorException Invalid type for value. * @throws \ErrorException Non-existing key. + * @todo need to add return type void (require update php version to 7.1) */ #[\ReturnTypeWillChange] public function offsetSet($key, $value) @@ -212,6 +214,7 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable * @param object $key The key of the element to be removed. * @return void * @throws \ErrorException Invalid type for key. + * @todo need to add return type void (require update php version to 7.1) */ #[\ReturnTypeWillChange] public function offsetUnset($key) diff --git a/php/src/Google/Protobuf/Internal/MapFieldIter.php b/php/src/Google/Protobuf/Internal/MapFieldIter.php index a3c834bd2c..2ff6b44ae3 100644 --- a/php/src/Google/Protobuf/Internal/MapFieldIter.php +++ b/php/src/Google/Protobuf/Internal/MapFieldIter.php @@ -67,6 +67,7 @@ class MapFieldIter implements \Iterator * Reset the status of the iterator * * @return void + * @todo need to add return type void (require update php version to 7.1) */ #[\ReturnTypeWillChange] public function rewind() @@ -78,6 +79,7 @@ class MapFieldIter implements \Iterator * Return the element at the current position. * * @return object The element at the current position. + * @todo need to add return type mixed (require update php version to 8.0) */ #[\ReturnTypeWillChange] public function current() @@ -89,6 +91,7 @@ class MapFieldIter implements \Iterator * Return the current key. * * @return object The current key. + * @todo need to add return type mixed (require update php version to 8.0) */ #[\ReturnTypeWillChange] public function key() @@ -119,6 +122,7 @@ class MapFieldIter implements \Iterator * Move to the next position. * * @return void + * @todo need to add return type void (require update php version to 7.1) */ #[\ReturnTypeWillChange] public function next() diff --git a/php/src/Google/Protobuf/Internal/RepeatedField.php b/php/src/Google/Protobuf/Internal/RepeatedField.php index 704123ad15..cfe5140d77 100644 --- a/php/src/Google/Protobuf/Internal/RepeatedField.php +++ b/php/src/Google/Protobuf/Internal/RepeatedField.php @@ -121,6 +121,7 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable * @return object The stored element at given index. * @throws \ErrorException Invalid type for index. * @throws \ErrorException Non-existing index. + * @todo need to add return type mixed (require update php version to 8.0) */ #[\ReturnTypeWillChange] public function offsetGet($offset) @@ -139,6 +140,7 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable * @throws \ErrorException Invalid type for index. * @throws \ErrorException Non-existing index. * @throws \ErrorException Incorrect type of the element. + * @todo need to add return type void (require update php version to 7.1) */ #[\ReturnTypeWillChange] public function offsetSet($offset, $value) @@ -211,6 +213,7 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable * @throws \ErrorException Invalid type for index. * @throws \ErrorException The element to be removed is not at the end of the * RepeatedField. + * @todo need to add return type void (require update php version to 7.1) */ #[\ReturnTypeWillChange] public function offsetUnset($offset) diff --git a/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php b/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php index 3c85869989..ec99b64ae7 100644 --- a/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php +++ b/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php @@ -70,6 +70,7 @@ class RepeatedFieldIter implements \Iterator * Reset the status of the iterator * * @return void + * @todo need to add return type void (require update php version to 7.1) */ #[\ReturnTypeWillChange] public function rewind() @@ -81,6 +82,7 @@ class RepeatedFieldIter implements \Iterator * Return the element at the current position. * * @return object The element at the current position. + * @todo need to add return type mixed (require update php version to 8.0) */ #[\ReturnTypeWillChange] public function current() @@ -92,6 +94,7 @@ class RepeatedFieldIter implements \Iterator * Return the current position. * * @return integer The current position. + * @todo need to add return type mixed (require update php version to 8.0) */ #[\ReturnTypeWillChange] public function key() @@ -103,6 +106,7 @@ class RepeatedFieldIter implements \Iterator * Move to the next position. * * @return void + * @todo need to add return type void (require update php version to 7.1) */ #[\ReturnTypeWillChange] public function next()