Skip to content

Commit

Permalink
protocolbuffers#9293 - remove return type void for compatible with ph…
Browse files Browse the repository at this point in the history
…p 7.0
  • Loading branch information
oleg1540 committed Dec 15, 2021
1 parent c7e9b8d commit 7c1b174
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
8 changes: 6 additions & 2 deletions php/src/Google/Protobuf/Internal/MapField.php
Expand Up @@ -150,8 +150,10 @@ public function offsetGet($key): object
* @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)
*/
public function offsetSet($key, $value): void
#[\ReturnTypeWillChange]
public function offsetSet($key, $value)
{
$this->checkKey($this->key_type, $key);

Expand Down Expand Up @@ -208,8 +210,10 @@ public function offsetSet($key, $value): void
* @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)
*/
public function offsetUnset($key): void
#[\ReturnTypeWillChange]
public function offsetUnset($key)
{
$this->checkKey($this->key_type, $key);
unset($this->container[$key]);
Expand Down
8 changes: 6 additions & 2 deletions php/src/Google/Protobuf/Internal/MapFieldIter.php
Expand Up @@ -67,8 +67,10 @@ 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)
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
reset($this->container);
}
Expand Down Expand Up @@ -116,8 +118,10 @@ public function key(): object
* Move to the next position.
*
* @return void
* @todo need to add return type void (require update php version to 7.1)
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
next($this->container);
}
Expand Down
8 changes: 6 additions & 2 deletions php/src/Google/Protobuf/Internal/RepeatedField.php
Expand Up @@ -137,8 +137,10 @@ public function offsetGet($offset): object
* @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)
*/
public function offsetSet($offset, $value): void
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
switch ($this->type) {
case GPBType::SFIXED32:
Expand Down Expand Up @@ -208,8 +210,10 @@ public function offsetSet($offset, $value): void
* @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)
*/
public function offsetUnset($offset): void
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$count = count($this->container);
if (!is_numeric($offset) || $count === 0 || $offset !== $count - 1) {
Expand Down
8 changes: 6 additions & 2 deletions php/src/Google/Protobuf/Internal/RepeatedFieldIter.php
Expand Up @@ -70,8 +70,10 @@ 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)
*/
public function rewind(): void
#[\ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
}
Expand Down Expand Up @@ -100,8 +102,10 @@ public function key(): int
* Move to the next position.
*
* @return void
* @todo need to add return type void (require update php version to 7.1)
*/
public function next(): void
#[\ReturnTypeWillChange]
public function next()
{
++$this->position;
}
Expand Down

0 comments on commit 7c1b174

Please sign in to comment.