Unverified Commit 857a0216 authored by Paul Yang's avatar Paul Yang Committed by GitHub

Use fully qualifed name for DescriptorPool in Any.php to avoid name (#3886)

conflict
parent 0cd2ad11
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
namespace Google\Protobuf; namespace Google\Protobuf;
use Google\Protobuf\Internal\DescriptorPool;
use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil; use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\Internal\Message; use Google\Protobuf\Internal\Message;
...@@ -217,7 +216,7 @@ class Any extends \Google\Protobuf\Internal\Message ...@@ -217,7 +216,7 @@ class Any extends \Google\Protobuf\Internal\Message
substr($this->type_url, $url_prifix_len); substr($this->type_url, $url_prifix_len);
// Create message according to fully qualified name. // Create message according to fully qualified name.
$pool = DescriptorPool::getGeneratedPool(); $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByProtoName( ".".$fully_qualifed_name); $desc = $pool->getDescriptorByProtoName( ".".$fully_qualifed_name);
if (is_null($desc)) { if (is_null($desc)) {
throw new \Exception("Class ".$fully_qualifed_name throw new \Exception("Class ".$fully_qualifed_name
...@@ -248,7 +247,7 @@ class Any extends \Google\Protobuf\Internal\Message ...@@ -248,7 +247,7 @@ class Any extends \Google\Protobuf\Internal\Message
$this->value = $msg->serializeToString(); $this->value = $msg->serializeToString();
// Set type url. // Set type url.
$pool = DescriptorPool::getGeneratedPool(); $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByClassName(get_class($msg)); $desc = $pool->getDescriptorByClassName(get_class($msg));
$fully_qualifed_name = $desc->getFullName(); $fully_qualifed_name = $desc->getFullName();
$this->type_url = GPBUtil::TYPE_URL_PREFIX.substr( $this->type_url = GPBUtil::TYPE_URL_PREFIX.substr(
...@@ -262,7 +261,7 @@ class Any extends \Google\Protobuf\Internal\Message ...@@ -262,7 +261,7 @@ class Any extends \Google\Protobuf\Internal\Message
*/ */
public function is($klass) public function is($klass)
{ {
$pool = DescriptorPool::getGeneratedPool(); $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByClassName($klass); $desc = $pool->getDescriptorByClassName($klass);
$fully_qualifed_name = $desc->getFullName(); $fully_qualifed_name = $desc->getFullName();
$type_url = GPBUtil::TYPE_URL_PREFIX.substr( $type_url = GPBUtil::TYPE_URL_PREFIX.substr(
......
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