aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brent Shaffer <betterbrent@google.com>2017-08-01 09:42:46 -0700
committerGravatar Paul Yang <TeBoring@users.noreply.github.com>2017-08-01 09:42:46 -0700
commitd32f5b4de3501e1bf3c0bc98d8e74219d47ebe69 (patch)
treed99b00bb2ec87ac22f6b523aaac009901f840b5f
parent072431452a365450c607e9503f51786be44ecf7f (diff)
Removes unnecessary pass-by-references in PHP internal classes (#3433)
-rw-r--r--php/src/Google/Protobuf/Internal/DescriptorPool.php14
-rw-r--r--php/src/Google/Protobuf/Internal/MapEntry.php4
-rw-r--r--php/src/Google/Protobuf/Internal/OneofDescriptor.php2
3 files changed, 10 insertions, 10 deletions
diff --git a/php/src/Google/Protobuf/Internal/DescriptorPool.php b/php/src/Google/Protobuf/Internal/DescriptorPool.php
index 2c00dfb6..65d1a884 100644
--- a/php/src/Google/Protobuf/Internal/DescriptorPool.php
+++ b/php/src/Google/Protobuf/Internal/DescriptorPool.php
@@ -61,17 +61,17 @@ class DescriptorPool
$files->mergeFromString($data);
$file = FileDescriptor::buildFromProto($files->getFile()[0]);
- foreach ($file->getMessageType() as &$desc) {
+ foreach ($file->getMessageType() as $desc) {
$this->addDescriptor($desc);
}
unset($desc);
- foreach ($file->getEnumType() as &$desc) {
+ foreach ($file->getEnumType() as $desc) {
$this->addEnumDescriptor($desc);
}
unset($desc);
- foreach ($file->getMessageType() as &$desc) {
+ foreach ($file->getMessageType() as $desc) {
$this->crossLink($desc);
}
unset($desc);
@@ -129,9 +129,9 @@ class DescriptorPool
return $this->class_to_enum_desc[$klass];
}
- private function crossLink(&$desc)
+ private function crossLink(Descriptor $desc)
{
- foreach ($desc->getField() as &$field) {
+ foreach ($desc->getField() as $field) {
switch ($field->getType()) {
case GPBType::MESSAGE:
$proto = $field->getMessageType();
@@ -149,7 +149,7 @@ class DescriptorPool
}
unset($field);
- foreach ($desc->getNestedType() as &$nested_type) {
+ foreach ($desc->getNestedType() as $nested_type) {
$this->crossLink($nested_type);
}
unset($nested_type);
@@ -157,7 +157,7 @@ class DescriptorPool
public function finish()
{
- foreach ($this->class_to_desc as $klass => &$desc) {
+ foreach ($this->class_to_desc as $klass => $desc) {
$this->crossLink($desc);
}
unset($desc);
diff --git a/php/src/Google/Protobuf/Internal/MapEntry.php b/php/src/Google/Protobuf/Internal/MapEntry.php
index 926645e1..9c32f1ea 100644
--- a/php/src/Google/Protobuf/Internal/MapEntry.php
+++ b/php/src/Google/Protobuf/Internal/MapEntry.php
@@ -39,7 +39,7 @@ class MapEntry extends Message
public $key;
public $value;
- public function setKey(&$key) {
+ public function setKey($key) {
$this->key = $key;
}
@@ -47,7 +47,7 @@ class MapEntry extends Message
return $this->key;
}
- public function setValue(&$value) {
+ public function setValue($value) {
$this->value = $value;
}
diff --git a/php/src/Google/Protobuf/Internal/OneofDescriptor.php b/php/src/Google/Protobuf/Internal/OneofDescriptor.php
index 04988737..57961f39 100644
--- a/php/src/Google/Protobuf/Internal/OneofDescriptor.php
+++ b/php/src/Google/Protobuf/Internal/OneofDescriptor.php
@@ -48,7 +48,7 @@ class OneofDescriptor
return $this->name;
}
- public function addField(&$field)
+ public function addField(Descriptor $field)
{
$this->fields[] = $field;
}