php 7.0 support

instead of using the void return type, add more ReturnTypeWillChange annotations
pull/9370/head
Brett McBride 3 years ago
parent 9e65df20a7
commit bfe33d7d08
  1. 2
      php/composer.json
  2. 6
      php/src/Google/Protobuf/Internal/MapField.php
  3. 6
      php/src/Google/Protobuf/Internal/MapFieldIter.php
  4. 6
      php/src/Google/Protobuf/Internal/RepeatedField.php
  5. 6
      php/src/Google/Protobuf/Internal/RepeatedFieldIter.php

@ -6,7 +6,7 @@
"homepage": "https://developers.google.com/protocol-buffers/", "homepage": "https://developers.google.com/protocol-buffers/",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"require": { "require": {
"php": ">=7.1.0", "php": ">=7.0.0",
"ext-bcmath": "*" "ext-bcmath": "*"
}, },
"require-dev": { "require-dev": {

@ -154,7 +154,8 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable
* @throws \ErrorException Invalid type for value. * @throws \ErrorException Invalid type for value.
* @throws \ErrorException Non-existing key. * @throws \ErrorException Non-existing key.
*/ */
public function offsetSet($key, $value): void #[\ReturnTypeWillChange]
public function offsetSet($key, $value)
{ {
$this->checkKey($this->key_type, $key); $this->checkKey($this->key_type, $key);
@ -212,7 +213,8 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable
* @return void * @return void
* @throws \ErrorException Invalid type for key. * @throws \ErrorException Invalid type for key.
*/ */
public function offsetUnset($key): void #[\ReturnTypeWillChange]
public function offsetUnset($key)
{ {
$this->checkKey($this->key_type, $key); $this->checkKey($this->key_type, $key);
unset($this->container[$key]); unset($this->container[$key]);

@ -68,7 +68,8 @@ class MapFieldIter implements \Iterator
* *
* @return void * @return void
*/ */
public function rewind(): void #[\ReturnTypeWillChange]
public function rewind()
{ {
reset($this->container); reset($this->container);
} }
@ -119,7 +120,8 @@ class MapFieldIter implements \Iterator
* *
* @return void * @return void
*/ */
public function next(): void #[\ReturnTypeWillChange]
public function next()
{ {
next($this->container); next($this->container);
} }

@ -140,7 +140,8 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
* @throws \ErrorException Non-existing index. * @throws \ErrorException Non-existing index.
* @throws \ErrorException Incorrect type of the element. * @throws \ErrorException Incorrect type of the element.
*/ */
public function offsetSet($offset, $value): void #[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{ {
switch ($this->type) { switch ($this->type) {
case GPBType::SFIXED32: case GPBType::SFIXED32:
@ -211,7 +212,8 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
* @throws \ErrorException The element to be removed is not at the end of the * @throws \ErrorException The element to be removed is not at the end of the
* RepeatedField. * RepeatedField.
*/ */
public function offsetUnset($offset): void #[\ReturnTypeWillChange]
public function offsetUnset($offset)
{ {
$count = count($this->container); $count = count($this->container);
if (!is_numeric($offset) || $count === 0 || $offset !== $count - 1) { if (!is_numeric($offset) || $count === 0 || $offset !== $count - 1) {

@ -71,7 +71,8 @@ class RepeatedFieldIter implements \Iterator
* *
* @return void * @return void
*/ */
public function rewind(): void #[\ReturnTypeWillChange]
public function rewind()
{ {
$this->position = 0; $this->position = 0;
} }
@ -103,7 +104,8 @@ class RepeatedFieldIter implements \Iterator
* *
* @return void * @return void
*/ */
public function next(): void #[\ReturnTypeWillChange]
public function next()
{ {
++$this->position; ++$this->position;
} }

Loading…
Cancel
Save