Skip to content

Commit

Permalink
#9293 - incompatible return type php 8.1 (#9301)
Browse files Browse the repository at this point in the history
* #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 <[email protected]>
  • Loading branch information
oleg1540 and acozzette authored Feb 11, 2022
1 parent 2ce9604 commit fe87de3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions php/src/Google/Protobuf/Internal/MapField.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public function getLegacyValueClass()
* @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)
Expand All @@ -153,6 +154,7 @@ public function offsetGet($key)
* @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)
Expand Down Expand Up @@ -212,6 +214,7 @@ public function offsetSet($key, $value)
* @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)
Expand Down
4 changes: 4 additions & 0 deletions php/src/Google/Protobuf/Internal/MapFieldIter.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function __construct($container, $key_type)
* 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()
Expand All @@ -78,6 +79,7 @@ public function rewind()
* 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()
Expand All @@ -89,6 +91,7 @@ public function current()
* 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()
Expand Down Expand Up @@ -119,6 +122,7 @@ public function key()
* 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()
Expand Down
3 changes: 3 additions & 0 deletions php/src/Google/Protobuf/Internal/RepeatedField.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public function getLegacyClass()
* @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)
Expand All @@ -139,6 +140,7 @@ public function offsetGet($offset)
* @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)
Expand Down Expand Up @@ -211,6 +213,7 @@ public function offsetSet($offset, $value)
* @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)
Expand Down
4 changes: 4 additions & 0 deletions php/src/Google/Protobuf/Internal/RepeatedFieldIter.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function __construct($container)
* 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()
Expand All @@ -81,6 +82,7 @@ public function rewind()
* 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()
Expand All @@ -92,6 +94,7 @@ public function current()
* 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()
Expand All @@ -103,6 +106,7 @@ public function key()
* 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()
Expand Down

0 comments on commit fe87de3

Please sign in to comment.