Commit d32f5b4d authored by Brent Shaffer's avatar Brent Shaffer Committed by Paul Yang

Removes unnecessary pass-by-references in PHP internal classes (#3433)

parent 07243145
...@@ -61,17 +61,17 @@ class DescriptorPool ...@@ -61,17 +61,17 @@ class DescriptorPool
$files->mergeFromString($data); $files->mergeFromString($data);
$file = FileDescriptor::buildFromProto($files->getFile()[0]); $file = FileDescriptor::buildFromProto($files->getFile()[0]);
foreach ($file->getMessageType() as &$desc) { foreach ($file->getMessageType() as $desc) {
$this->addDescriptor($desc); $this->addDescriptor($desc);
} }
unset($desc); unset($desc);
foreach ($file->getEnumType() as &$desc) { foreach ($file->getEnumType() as $desc) {
$this->addEnumDescriptor($desc); $this->addEnumDescriptor($desc);
} }
unset($desc); unset($desc);
foreach ($file->getMessageType() as &$desc) { foreach ($file->getMessageType() as $desc) {
$this->crossLink($desc); $this->crossLink($desc);
} }
unset($desc); unset($desc);
...@@ -129,9 +129,9 @@ class DescriptorPool ...@@ -129,9 +129,9 @@ class DescriptorPool
return $this->class_to_enum_desc[$klass]; 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()) { switch ($field->getType()) {
case GPBType::MESSAGE: case GPBType::MESSAGE:
$proto = $field->getMessageType(); $proto = $field->getMessageType();
...@@ -149,7 +149,7 @@ class DescriptorPool ...@@ -149,7 +149,7 @@ class DescriptorPool
} }
unset($field); unset($field);
foreach ($desc->getNestedType() as &$nested_type) { foreach ($desc->getNestedType() as $nested_type) {
$this->crossLink($nested_type); $this->crossLink($nested_type);
} }
unset($nested_type); unset($nested_type);
...@@ -157,7 +157,7 @@ class DescriptorPool ...@@ -157,7 +157,7 @@ class DescriptorPool
public function finish() public function finish()
{ {
foreach ($this->class_to_desc as $klass => &$desc) { foreach ($this->class_to_desc as $klass => $desc) {
$this->crossLink($desc); $this->crossLink($desc);
} }
unset($desc); unset($desc);
......
...@@ -39,7 +39,7 @@ class MapEntry extends Message ...@@ -39,7 +39,7 @@ class MapEntry extends Message
public $key; public $key;
public $value; public $value;
public function setKey(&$key) { public function setKey($key) {
$this->key = $key; $this->key = $key;
} }
...@@ -47,7 +47,7 @@ class MapEntry extends Message ...@@ -47,7 +47,7 @@ class MapEntry extends Message
return $this->key; return $this->key;
} }
public function setValue(&$value) { public function setValue($value) {
$this->value = $value; $this->value = $value;
} }
......
...@@ -48,7 +48,7 @@ class OneofDescriptor ...@@ -48,7 +48,7 @@ class OneofDescriptor
return $this->name; return $this->name;
} }
public function addField(&$field) public function addField(Descriptor $field)
{ {
$this->fields[] = $field; $this->fields[] = $field;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment