Forráskód Böngészése

Regenerated well-known types and moved hand-written messages into base classes.

Joshua Haberman 5 éve
szülő
commit
a0eef68bbd
36 módosított fájl, 187 hozzáadás és 350 törlés
  1. 2 8
      php/src/GPBMetadata/Google/Protobuf/Any.php
  2. 2 25
      php/src/GPBMetadata/Google/Protobuf/Api.php
  3. 2 9
      php/src/GPBMetadata/Google/Protobuf/Duration.php
  4. 2 9
      php/src/GPBMetadata/Google/Protobuf/FieldMask.php
  5. 2 8
      php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php
  6. 2 10
      php/src/GPBMetadata/Google/Protobuf/SourceContext.php
  7. 1 1
      php/src/GPBMetadata/Google/Protobuf/Struct.php
  8. 2 9
      php/src/GPBMetadata/Google/Protobuf/Timestamp.php
  9. 0 54
      php/src/GPBMetadata/Google/Protobuf/Type.php
  10. 2 16
      php/src/GPBMetadata/Google/Protobuf/Wrappers.php
  11. 16 85
      php/src/Google/Protobuf/Any.php
  12. 15 5
      php/src/Google/Protobuf/Api.php
  13. 1 1
      php/src/Google/Protobuf/BoolValue.php
  14. 1 1
      php/src/Google/Protobuf/BytesValue.php
  15. 1 1
      php/src/Google/Protobuf/DoubleValue.php
  16. 3 3
      php/src/Google/Protobuf/Duration.php
  17. 14 4
      php/src/Google/Protobuf/Enum.php
  18. 2 2
      php/src/Google/Protobuf/EnumValue.php
  19. 11 11
      php/src/Google/Protobuf/Field.php
  20. 1 0
      php/src/Google/Protobuf/Field/Cardinality.php
  21. 1 0
      php/src/Google/Protobuf/Field/Kind.php
  22. 18 24
      php/src/Google/Protobuf/FieldMask.php
  23. 1 1
      php/src/Google/Protobuf/FloatValue.php
  24. 1 1
      php/src/Google/Protobuf/Int32Value.php
  25. 1 1
      php/src/Google/Protobuf/Int64Value.php
  26. 6 6
      php/src/Google/Protobuf/Method.php
  27. 2 2
      php/src/Google/Protobuf/Mixin.php
  28. 13 3
      php/src/Google/Protobuf/Option.php
  29. 1 1
      php/src/Google/Protobuf/SourceContext.php
  30. 1 1
      php/src/Google/Protobuf/StringValue.php
  31. 1 0
      php/src/Google/Protobuf/Syntax.php
  32. 27 41
      php/src/Google/Protobuf/Timestamp.php
  33. 14 4
      php/src/Google/Protobuf/Type.php
  34. 1 1
      php/src/Google/Protobuf/UInt32Value.php
  35. 1 1
      php/src/Google/Protobuf/UInt64Value.php
  36. 16 1
      src/google/protobuf/compiler/php/php_generator.cc

+ 2 - 8
php/src/GPBMetadata/Google/Protobuf/Any.php

@@ -15,14 +15,8 @@ class Any
           return;
         }
         $pool->internalAddGeneratedFile(hex2bin(
-            "0acd010a19676f6f676c652f70726f746f6275662f616e792e70726f746f" .
-            "120f676f6f676c652e70726f746f62756622260a03416e7912100a087479" .
-            "70655f75726c180120012809120d0a0576616c756518022001280c426f0a" .
-            "13636f6d2e676f6f676c652e70726f746f6275664208416e7950726f746f" .
-            "50015a256769746875622e636f6d2f676f6c616e672f70726f746f627566" .
-            "2f7074797065732f616e79a20203475042aa021e476f6f676c652e50726f" .
-            "746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
-        ));
+            "0ad4010a19676f6f676c652f70726f746f6275662f616e792e70726f746f120f676f6f676c652e70726f746f62756622260a03416e7912100a08747970655f75726c180120012809120d0a0576616c756518022001280c42760a13636f6d2e676f6f676c652e70726f746f6275664208416e7950726f746f50015a2c676f6f676c652e676f6c616e672e6f72672f70726f746f6275662f74797065732f6b6e6f776e2f616e797062a20203475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
+        ), true);
 
         static::$is_initialized = true;
     }

+ 2 - 25
php/src/GPBMetadata/Google/Protobuf/Api.php

@@ -17,31 +17,8 @@ class Api
         \GPBMetadata\Google\Protobuf\SourceContext::initOnce();
         \GPBMetadata\Google\Protobuf\Type::initOnce();
         $pool->internalAddGeneratedFile(hex2bin(
-            "0ac8050a19676f6f676c652f70726f746f6275662f6170692e70726f746f" .
-            "120f676f6f676c652e70726f746f6275661a1a676f6f676c652f70726f74" .
-            "6f6275662f747970652e70726f746f2281020a03417069120c0a046e616d" .
-            "6518012001280912280a076d6574686f647318022003280b32172e676f6f" .
-            "676c652e70726f746f6275662e4d6574686f6412280a076f7074696f6e73" .
-            "18032003280b32172e676f6f676c652e70726f746f6275662e4f7074696f" .
-            "6e120f0a0776657273696f6e18042001280912360a0e736f757263655f63" .
-            "6f6e7465787418052001280b321e2e676f6f676c652e70726f746f627566" .
-            "2e536f75726365436f6e7465787412260a066d6978696e7318062003280b" .
-            "32162e676f6f676c652e70726f746f6275662e4d6978696e12270a067379" .
-            "6e74617818072001280e32172e676f6f676c652e70726f746f6275662e53" .
-            "796e74617822d5010a064d6574686f64120c0a046e616d65180120012809" .
-            "12180a10726571756573745f747970655f75726c18022001280912190a11" .
-            "726571756573745f73747265616d696e6718032001280812190a11726573" .
-            "706f6e73655f747970655f75726c180420012809121a0a12726573706f6e" .
-            "73655f73747265616d696e6718052001280812280a076f7074696f6e7318" .
-            "062003280b32172e676f6f676c652e70726f746f6275662e4f7074696f6e" .
-            "12270a0673796e74617818072001280e32172e676f6f676c652e70726f74" .
-            "6f6275662e53796e74617822230a054d6978696e120c0a046e616d651801" .
-            "20012809120c0a04726f6f7418022001280942750a13636f6d2e676f6f67" .
-            "6c652e70726f746f627566420841706950726f746f50015a2b676f6f676c" .
-            "652e676f6c616e672e6f72672f67656e70726f746f2f70726f746f627566" .
-            "2f6170693b617069a20203475042aa021e476f6f676c652e50726f746f62" .
-            "75662e57656c6c4b6e6f776e5479706573620670726f746f33"
-        ));
+            "0ac9050a19676f6f676c652f70726f746f6275662f6170692e70726f746f120f676f6f676c652e70726f746f6275661a1a676f6f676c652f70726f746f6275662f747970652e70726f746f2281020a03417069120c0a046e616d6518012001280912280a076d6574686f647318022003280b32172e676f6f676c652e70726f746f6275662e4d6574686f6412280a076f7074696f6e7318032003280b32172e676f6f676c652e70726f746f6275662e4f7074696f6e120f0a0776657273696f6e18042001280912360a0e736f757263655f636f6e7465787418052001280b321e2e676f6f676c652e70726f746f6275662e536f75726365436f6e7465787412260a066d6978696e7318062003280b32162e676f6f676c652e70726f746f6275662e4d6978696e12270a0673796e74617818072001280e32172e676f6f676c652e70726f746f6275662e53796e74617822d5010a064d6574686f64120c0a046e616d6518012001280912180a10726571756573745f747970655f75726c18022001280912190a11726571756573745f73747265616d696e6718032001280812190a11726573706f6e73655f747970655f75726c180420012809121a0a12726573706f6e73655f73747265616d696e6718052001280812280a076f7074696f6e7318062003280b32172e676f6f676c652e70726f746f6275662e4f7074696f6e12270a0673796e74617818072001280e32172e676f6f676c652e70726f746f6275662e53796e74617822230a054d6978696e120c0a046e616d65180120012809120c0a04726f6f7418022001280942760a13636f6d2e676f6f676c652e70726f746f627566420841706950726f746f50015a2c676f6f676c652e676f6c616e672e6f72672f70726f746f6275662f74797065732f6b6e6f776e2f6170697062a20203475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
+        ), true);
 
         static::$is_initialized = true;
     }

+ 2 - 9
php/src/GPBMetadata/Google/Protobuf/Duration.php

@@ -15,15 +15,8 @@ class Duration
           return;
         }
         $pool->internalAddGeneratedFile(hex2bin(
-            "0ae3010a1e676f6f676c652f70726f746f6275662f6475726174696f6e2e" .
-            "70726f746f120f676f6f676c652e70726f746f627566222a0a0844757261" .
-            "74696f6e120f0a077365636f6e6473180120012803120d0a056e616e6f73" .
-            "180220012805427c0a13636f6d2e676f6f676c652e70726f746f62756642" .
-            "0d4475726174696f6e50726f746f50015a2a6769746875622e636f6d2f67" .
-            "6f6c616e672f70726f746f6275662f7074797065732f6475726174696f6e" .
-            "f80101a20203475042aa021e476f6f676c652e50726f746f6275662e5765" .
-            "6c6c4b6e6f776e5479706573620670726f746f33"
-        ));
+            "0aeb010a1e676f6f676c652f70726f746f6275662f6475726174696f6e2e70726f746f120f676f6f676c652e70726f746f627566222a0a084475726174696f6e120f0a077365636f6e6473180120012803120d0a056e616e6f731802200128054283010a13636f6d2e676f6f676c652e70726f746f627566420d4475726174696f6e50726f746f50015a31676f6f676c652e676f6c616e672e6f72672f70726f746f6275662f74797065732f6b6e6f776e2f6475726174696f6e7062f80101a20203475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
+        ), true);
 
         static::$is_initialized = true;
     }

+ 2 - 9
php/src/GPBMetadata/Google/Protobuf/FieldMask.php

@@ -15,15 +15,8 @@ class FieldMask
           return;
         }
         $pool->internalAddGeneratedFile(hex2bin(
-            "0ae3010a20676f6f676c652f70726f746f6275662f6669656c645f6d6173" .
-            "6b2e70726f746f120f676f6f676c652e70726f746f627566221a0a094669" .
-            "656c644d61736b120d0a0570617468731801200328094289010a13636f6d" .
-            "2e676f6f676c652e70726f746f627566420e4669656c644d61736b50726f" .
-            "746f50015a39676f6f676c652e676f6c616e672e6f72672f67656e70726f" .
-            "746f2f70726f746f6275662f6669656c645f6d61736b3b6669656c645f6d" .
-            "61736ba20203475042aa021e476f6f676c652e50726f746f6275662e5765" .
-            "6c6c4b6e6f776e5479706573620670726f746f33"
-        ));
+            "0adf010a20676f6f676c652f70726f746f6275662f6669656c645f6d61736b2e70726f746f120f676f6f676c652e70726f746f627566221a0a094669656c644d61736b120d0a0570617468731801200328094285010a13636f6d2e676f6f676c652e70726f746f627566420e4669656c644d61736b50726f746f50015a32676f6f676c652e676f6c616e672e6f72672f70726f746f6275662f74797065732f6b6e6f776e2f6669656c646d61736b7062f80101a20203475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
+        ), true);
 
         static::$is_initialized = true;
     }

+ 2 - 8
php/src/GPBMetadata/Google/Protobuf/GPBEmpty.php

@@ -15,14 +15,8 @@ class GPBEmpty
           return;
         }
         $pool->internalAddGeneratedFile(hex2bin(
-            "0ab7010a1b676f6f676c652f70726f746f6275662f656d7074792e70726f" .
-            "746f120f676f6f676c652e70726f746f62756622070a05456d7074794276" .
-            "0a13636f6d2e676f6f676c652e70726f746f627566420a456d7074795072" .
-            "6f746f50015a276769746875622e636f6d2f676f6c616e672f70726f746f" .
-            "6275662f7074797065732f656d707479f80101a20203475042aa021e476f" .
-            "6f676c652e50726f746f6275662e57656c6c4b6e6f776e54797065736206" .
-            "70726f746f33"
-        ));
+            "0abe010a1b676f6f676c652f70726f746f6275662f656d7074792e70726f746f120f676f6f676c652e70726f746f62756622070a05456d707479427d0a13636f6d2e676f6f676c652e70726f746f627566420a456d70747950726f746f50015a2e676f6f676c652e676f6c616e672e6f72672f70726f746f6275662f74797065732f6b6e6f776e2f656d7074797062f80101a20203475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
+        ), true);
 
         static::$is_initialized = true;
     }

+ 2 - 10
php/src/GPBMetadata/Google/Protobuf/SourceContext.php

@@ -15,16 +15,8 @@ class SourceContext
           return;
         }
         $pool->internalAddGeneratedFile(hex2bin(
-            "0afb010a24676f6f676c652f70726f746f6275662f736f757263655f636f" .
-            "6e746578742e70726f746f120f676f6f676c652e70726f746f6275662222" .
-            "0a0d536f75726365436f6e7465787412110a0966696c655f6e616d651801" .
-            "200128094295010a13636f6d2e676f6f676c652e70726f746f6275664212" .
-            "536f75726365436f6e7465787450726f746f50015a41676f6f676c652e67" .
-            "6f6c616e672e6f72672f67656e70726f746f2f70726f746f6275662f736f" .
-            "757263655f636f6e746578743b736f757263655f636f6e74657874a20203" .
-            "475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f77" .
-            "6e5479706573620670726f746f33"
-        ));
+            "0af0010a24676f6f676c652f70726f746f6275662f736f757263655f636f6e746578742e70726f746f120f676f6f676c652e70726f746f62756622220a0d536f75726365436f6e7465787412110a0966696c655f6e616d65180120012809428a010a13636f6d2e676f6f676c652e70726f746f6275664212536f75726365436f6e7465787450726f746f50015a36676f6f676c652e676f6c616e672e6f72672f70726f746f6275662f74797065732f6b6e6f776e2f736f75726365636f6e746578747062a20203475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
+        ), true);
 
         static::$is_initialized = true;
     }

+ 1 - 1
php/src/GPBMetadata/Google/Protobuf/Struct.php

@@ -15,7 +15,7 @@ class Struct
           return;
         }
         $pool->internalAddGeneratedFile(hex2bin(
-            "0a81050a1c676f6f676c652f70726f746f6275662f7374727563742e70726f746f120f676f6f676c652e70726f746f6275662284010a0653747275637412330a066669656c647318012003280b32232e676f6f676c652e70726f746f6275662e5374727563742e4669656c6473456e7472791a450a0b4669656c6473456e747279120b0a036b657918012001280912250a0576616c756518022001280b32162e676f6f676c652e70726f746f6275662e56616c75653a02380122ea010a0556616c756512300a0a6e756c6c5f76616c756518012001280e321a2e676f6f676c652e70726f746f6275662e4e756c6c56616c7565480012160a0c6e756d6265725f76616c7565180220012801480012160a0c737472696e675f76616c7565180320012809480012140a0a626f6f6c5f76616c75651804200128084800122f0a0c7374727563745f76616c756518052001280b32172e676f6f676c652e70726f746f6275662e537472756374480012300a0a6c6973745f76616c756518062001280b321a2e676f6f676c652e70726f746f6275662e4c69737456616c7565480042060a046b696e6422330a094c69737456616c756512260a0676616c75657318012003280b32162e676f6f676c652e70726f746f6275662e56616c75652a1b0a094e756c6c56616c7565120e0a0a4e554c4c5f56414c554510004281010a13636f6d2e676f6f676c652e70726f746f627566420b53747275637450726f746f50015a316769746875622e636f6d2f676f6c616e672f70726f746f6275662f7074797065732f7374727563743b7374727563747062f80101a20203475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
+            "0afe040a1c676f6f676c652f70726f746f6275662f7374727563742e70726f746f120f676f6f676c652e70726f746f6275662284010a0653747275637412330a066669656c647318012003280b32232e676f6f676c652e70726f746f6275662e5374727563742e4669656c6473456e7472791a450a0b4669656c6473456e747279120b0a036b657918012001280912250a0576616c756518022001280b32162e676f6f676c652e70726f746f6275662e56616c75653a02380122ea010a0556616c756512300a0a6e756c6c5f76616c756518012001280e321a2e676f6f676c652e70726f746f6275662e4e756c6c56616c7565480012160a0c6e756d6265725f76616c7565180220012801480012160a0c737472696e675f76616c7565180320012809480012140a0a626f6f6c5f76616c75651804200128084800122f0a0c7374727563745f76616c756518052001280b32172e676f6f676c652e70726f746f6275662e537472756374480012300a0a6c6973745f76616c756518062001280b321a2e676f6f676c652e70726f746f6275662e4c69737456616c7565480042060a046b696e6422330a094c69737456616c756512260a0676616c75657318012003280b32162e676f6f676c652e70726f746f6275662e56616c75652a1b0a094e756c6c56616c7565120e0a0a4e554c4c5f56414c55451000427f0a13636f6d2e676f6f676c652e70726f746f627566420b53747275637450726f746f50015a2f676f6f676c652e676f6c616e672e6f72672f70726f746f6275662f74797065732f6b6e6f776e2f7374727563747062f80101a20203475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
         ), true);
 
         static::$is_initialized = true;

+ 2 - 9
php/src/GPBMetadata/Google/Protobuf/Timestamp.php

@@ -15,15 +15,8 @@ class Timestamp
           return;
         }
         $pool->internalAddGeneratedFile(hex2bin(
-            "0ae7010a1f676f6f676c652f70726f746f6275662f74696d657374616d70" .
-            "2e70726f746f120f676f6f676c652e70726f746f627566222b0a0954696d" .
-            "657374616d70120f0a077365636f6e6473180120012803120d0a056e616e" .
-            "6f73180220012805427e0a13636f6d2e676f6f676c652e70726f746f6275" .
-            "66420e54696d657374616d7050726f746f50015a2b6769746875622e636f" .
-            "6d2f676f6c616e672f70726f746f6275662f7074797065732f74696d6573" .
-            "74616d70f80101a20203475042aa021e476f6f676c652e50726f746f6275" .
-            "662e57656c6c4b6e6f776e5479706573620670726f746f33"
-        ));
+            "0aef010a1f676f6f676c652f70726f746f6275662f74696d657374616d702e70726f746f120f676f6f676c652e70726f746f627566222b0a0954696d657374616d70120f0a077365636f6e6473180120012803120d0a056e616e6f731802200128054285010a13636f6d2e676f6f676c652e70726f746f627566420e54696d657374616d7050726f746f50015a32676f6f676c652e676f6c616e672e6f72672f70726f746f6275662f74797065732f6b6e6f776e2f74696d657374616d707062f80101a20203475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
+        ), true);
 
         static::$is_initialized = true;
     }

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 54
php/src/GPBMetadata/Google/Protobuf/Type.php


+ 2 - 16
php/src/GPBMetadata/Google/Protobuf/Wrappers.php

@@ -15,22 +15,8 @@ class Wrappers
           return;
         }
         $pool->internalAddGeneratedFile(hex2bin(
-            "0abf030a1e676f6f676c652f70726f746f6275662f77726170706572732e" .
-            "70726f746f120f676f6f676c652e70726f746f627566221c0a0b446f7562" .
-            "6c6556616c7565120d0a0576616c7565180120012801221b0a0a466c6f61" .
-            "7456616c7565120d0a0576616c7565180120012802221b0a0a496e743634" .
-            "56616c7565120d0a0576616c7565180120012803221c0a0b55496e743634" .
-            "56616c7565120d0a0576616c7565180120012804221b0a0a496e74333256" .
-            "616c7565120d0a0576616c7565180120012805221c0a0b55496e74333256" .
-            "616c7565120d0a0576616c756518012001280d221a0a09426f6f6c56616c" .
-            "7565120d0a0576616c7565180120012808221c0a0b537472696e6756616c" .
-            "7565120d0a0576616c7565180120012809221b0a0a427974657356616c75" .
-            "65120d0a0576616c756518012001280c427c0a13636f6d2e676f6f676c65" .
-            "2e70726f746f627566420d577261707065727350726f746f50015a2a6769" .
-            "746875622e636f6d2f676f6c616e672f70726f746f6275662f7074797065" .
-            "732f7772617070657273f80101a20203475042aa021e476f6f676c652e50" .
-            "726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
-        ));
+            "0ac7030a1e676f6f676c652f70726f746f6275662f77726170706572732e70726f746f120f676f6f676c652e70726f746f627566221c0a0b446f75626c6556616c7565120d0a0576616c7565180120012801221b0a0a466c6f617456616c7565120d0a0576616c7565180120012802221b0a0a496e74363456616c7565120d0a0576616c7565180120012803221c0a0b55496e74363456616c7565120d0a0576616c7565180120012804221b0a0a496e74333256616c7565120d0a0576616c7565180120012805221c0a0b55496e74333256616c7565120d0a0576616c756518012001280d221a0a09426f6f6c56616c7565120d0a0576616c7565180120012808221c0a0b537472696e6756616c7565120d0a0576616c7565180120012809221b0a0a427974657356616c7565120d0a0576616c756518012001280c4283010a13636f6d2e676f6f676c652e70726f746f627566420d577261707065727350726f746f50015a31676f6f676c652e676f6c616e672e6f72672f70726f746f6275662f74797065732f6b6e6f776e2f77726170706572737062f80101a20203475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
+        ), true);
 
         static::$is_initialized = true;
     }

+ 16 - 85
php/src/Google/Protobuf/Any.php

@@ -5,7 +5,6 @@
 namespace Google\Protobuf;
 
 use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\Message;
 use Google\Protobuf\Internal\RepeatedField;
 use Google\Protobuf\Internal\GPBUtil;
 
@@ -39,10 +38,13 @@ use Google\Protobuf\Internal\GPBUtil;
  *       ...
  *  Example 4: Pack and unpack a message in Go
  *      foo := &pb.Foo{...}
- *      any, err := ptypes.MarshalAny(foo)
+ *      any, err := anypb.New(foo)
+ *      if err != nil {
+ *        ...
+ *      }
  *      ...
  *      foo := &pb.Foo{}
- *      if err := ptypes.UnmarshalAny(any, foo); err != nil {
+ *      if err := any.UnmarshalTo(foo); err != nil {
  *        ...
  *      }
  * The pack methods provided by protobuf library will by default use
@@ -76,11 +78,12 @@ use Google\Protobuf\Internal\GPBUtil;
  *
  * Generated from protobuf message <code>google.protobuf.Any</code>
  */
-class Any extends \Google\Protobuf\Internal\Message
+class Any extends \Google\Protobuf\Internal\AnyBase
 {
     /**
      * A URL/resource name that uniquely identifies the type of the serialized
-     * protocol buffer message. The last segment of the URL's path must represent
+     * protocol buffer message. This string must contain at least
+     * one "/" character. The last segment of the URL's path must represent
      * the fully qualified name of the type (as in
      * `path/google.protobuf.Duration`). The name should be in a canonical form
      * (e.g., leading "." is not accepted).
@@ -104,15 +107,13 @@ class Any extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string type_url = 1;</code>
      */
-    private $type_url = '';
+    protected $type_url = '';
     /**
      * Must be a valid serialized protocol buffer of the above specified type.
      *
      * Generated from protobuf field <code>bytes value = 2;</code>
      */
-    private $value = '';
-
-    const TYPE_URL_PREFIX = 'type.googleapis.com/';
+    protected $value = '';
 
     /**
      * Constructor.
@@ -122,7 +123,8 @@ class Any extends \Google\Protobuf\Internal\Message
      *
      *     @type string $type_url
      *           A URL/resource name that uniquely identifies the type of the serialized
-     *           protocol buffer message. The last segment of the URL's path must represent
+     *           protocol buffer message. This string must contain at least
+     *           one "/" character. The last segment of the URL's path must represent
      *           the fully qualified name of the type (as in
      *           `path/google.protobuf.Duration`). The name should be in a canonical form
      *           (e.g., leading "." is not accepted).
@@ -154,7 +156,8 @@ class Any extends \Google\Protobuf\Internal\Message
 
     /**
      * A URL/resource name that uniquely identifies the type of the serialized
-     * protocol buffer message. The last segment of the URL's path must represent
+     * protocol buffer message. This string must contain at least
+     * one "/" character. The last segment of the URL's path must represent
      * the fully qualified name of the type (as in
      * `path/google.protobuf.Duration`). The name should be in a canonical form
      * (e.g., leading "." is not accepted).
@@ -186,7 +189,8 @@ class Any extends \Google\Protobuf\Internal\Message
 
     /**
      * A URL/resource name that uniquely identifies the type of the serialized
-     * protocol buffer message. The last segment of the URL's path must represent
+     * protocol buffer message. This string must contain at least
+     * one "/" character. The last segment of the URL's path must represent
      * the fully qualified name of the type (as in
      * `path/google.protobuf.Duration`). The name should be in a canonical form
      * (e.g., leading "." is not accepted).
@@ -246,78 +250,5 @@ class Any extends \Google\Protobuf\Internal\Message
         return $this;
     }
 
-    /**
-     * This method will try to resolve the type_url in Any message to get the
-     * targeted message type. If failed, an error will be thrown. Otherwise,
-     * the method will create a message of the targeted type and fill it with
-     * the decoded value in Any.
-     * @return Message unpacked message
-     * @throws \Exception Type url needs to be type.googleapis.com/fully-qualified.
-     * @throws \Exception Class hasn't been added to descriptor pool.
-     * @throws \Exception cannot decode data in value field.
-     */
-    public function unpack()
-    {
-        // Get fully qualified name from type url.
-        $url_prifix_len = strlen(GPBUtil::TYPE_URL_PREFIX);
-        if (substr($this->type_url, 0, $url_prifix_len) !=
-                GPBUtil::TYPE_URL_PREFIX) {
-            throw new \Exception(
-                "Type url needs to be type.googleapis.com/fully-qulified");
-        }
-        $fully_qualifed_name =
-            substr($this->type_url, $url_prifix_len);
-
-        // Create message according to fully qualified name.
-        $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-        $desc = $pool->getDescriptorByProtoName($fully_qualifed_name);
-        if (is_null($desc)) {
-            throw new \Exception("Class ".$fully_qualifed_name
-                                     ." hasn't been added to descriptor pool");
-        }
-        $klass = $desc->getClass();
-        $msg = new $klass();
-
-        // Merge data into message.
-        $msg->mergeFromString($this->value);
-        return $msg;
-    }
-
-    /**
-     * The type_url will be created according to the given message’s type and
-     * the value is encoded data from the given message..
-     * @param message: A proto message.
-     */
-    public function pack($msg)
-    {
-        if (!$msg instanceof Message) {
-            trigger_error("Given parameter is not a message instance.",
-                          E_USER_ERROR);
-            return;
-        }
-
-        // Set value using serialized message.
-        $this->value = $msg->serializeToString();
-
-        // Set type url.
-        $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-        $desc = $pool->getDescriptorByClassName(get_class($msg));
-        $fully_qualifed_name = $desc->getFullName();
-        $this->type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualifed_name;
-    }
-
-    /**
-     * This method returns whether the type_url in any_message is corresponded
-     * to the given class.
-     * @param klass: The fully qualified PHP class name of a proto message type.
-     */
-    public function is($klass)
-    {
-        $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
-        $desc = $pool->getDescriptorByClassName($klass);
-        $fully_qualifed_name = $desc->getFullName();
-        $type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualifed_name;
-        return $this->type_url === $type_url;
-    }
 }
 

+ 15 - 5
php/src/Google/Protobuf/Api.php

@@ -28,7 +28,7 @@ class Api extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string name = 1;</code>
      */
-    private $name = '';
+    protected $name = '';
     /**
      * The methods of this interface, in unspecified order.
      *
@@ -62,14 +62,14 @@ class Api extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string version = 4;</code>
      */
-    private $version = '';
+    protected $version = '';
     /**
      * Source context for the protocol buffer service represented by this
      * message.
      *
      * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 5;</code>
      */
-    private $source_context = null;
+    protected $source_context = null;
     /**
      * Included interfaces. See [Mixin][].
      *
@@ -81,7 +81,7 @@ class Api extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 7;</code>
      */
-    private $syntax = 0;
+    protected $syntax = 0;
 
     /**
      * Constructor.
@@ -275,7 +275,17 @@ class Api extends \Google\Protobuf\Internal\Message
      */
     public function getSourceContext()
     {
-        return $this->source_context;
+        return isset($this->source_context) ? $this->source_context : null;
+    }
+
+    public function hasSourceContext()
+    {
+        return isset($this->source_context);
+    }
+
+    public function clearSourceContext()
+    {
+        unset($this->source_context);
     }
 
     /**

+ 1 - 1
php/src/Google/Protobuf/BoolValue.php

@@ -21,7 +21,7 @@ class BoolValue extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>bool value = 1;</code>
      */
-    private $value = false;
+    protected $value = false;
 
     /**
      * Constructor.

+ 1 - 1
php/src/Google/Protobuf/BytesValue.php

@@ -21,7 +21,7 @@ class BytesValue extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>bytes value = 1;</code>
      */
-    private $value = '';
+    protected $value = '';
 
     /**
      * Constructor.

+ 1 - 1
php/src/Google/Protobuf/DoubleValue.php

@@ -21,7 +21,7 @@ class DoubleValue extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>double value = 1;</code>
      */
-    private $value = 0.0;
+    protected $value = 0.0;
 
     /**
      * Constructor.

+ 3 - 3
php/src/Google/Protobuf/Duration.php

@@ -25,7 +25,7 @@ use Google\Protobuf\Internal\GPBUtil;
  *     if (duration.seconds < 0 && duration.nanos > 0) {
  *       duration.seconds += 1;
  *       duration.nanos -= 1000000000;
- *     } else if (durations.seconds > 0 && duration.nanos < 0) {
+ *     } else if (duration.seconds > 0 && duration.nanos < 0) {
  *       duration.seconds -= 1;
  *       duration.nanos += 1000000000;
  *     }
@@ -66,7 +66,7 @@ class Duration extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>int64 seconds = 1;</code>
      */
-    private $seconds = 0;
+    protected $seconds = 0;
     /**
      * Signed fractions of a second at nanosecond resolution of the span
      * of time. Durations less than one second are represented with a 0
@@ -77,7 +77,7 @@ class Duration extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>int32 nanos = 2;</code>
      */
-    private $nanos = 0;
+    protected $nanos = 0;
 
     /**
      * Constructor.

+ 14 - 4
php/src/Google/Protobuf/Enum.php

@@ -20,7 +20,7 @@ class Enum extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string name = 1;</code>
      */
-    private $name = '';
+    protected $name = '';
     /**
      * Enum value definitions.
      *
@@ -38,13 +38,13 @@ class Enum extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 4;</code>
      */
-    private $source_context = null;
+    protected $source_context = null;
     /**
      * The source syntax.
      *
      * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 5;</code>
      */
-    private $syntax = 0;
+    protected $syntax = 0;
 
     /**
      * Constructor.
@@ -155,7 +155,17 @@ class Enum extends \Google\Protobuf\Internal\Message
      */
     public function getSourceContext()
     {
-        return $this->source_context;
+        return isset($this->source_context) ? $this->source_context : null;
+    }
+
+    public function hasSourceContext()
+    {
+        return isset($this->source_context);
+    }
+
+    public function clearSourceContext()
+    {
+        unset($this->source_context);
     }
 
     /**

+ 2 - 2
php/src/Google/Protobuf/EnumValue.php

@@ -20,13 +20,13 @@ class EnumValue extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string name = 1;</code>
      */
-    private $name = '';
+    protected $name = '';
     /**
      * Enum value number.
      *
      * Generated from protobuf field <code>int32 number = 2;</code>
      */
-    private $number = 0;
+    protected $number = 0;
     /**
      * Protocol buffer options.
      *

+ 11 - 11
php/src/Google/Protobuf/Field.php

@@ -20,45 +20,45 @@ class Field extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
      */
-    private $kind = 0;
+    protected $kind = 0;
     /**
      * The field cardinality.
      *
      * Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
      */
-    private $cardinality = 0;
+    protected $cardinality = 0;
     /**
      * The field number.
      *
      * Generated from protobuf field <code>int32 number = 3;</code>
      */
-    private $number = 0;
+    protected $number = 0;
     /**
      * The field name.
      *
      * Generated from protobuf field <code>string name = 4;</code>
      */
-    private $name = '';
+    protected $name = '';
     /**
      * The field type URL, without the scheme, for message or enumeration
      * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
      *
      * Generated from protobuf field <code>string type_url = 6;</code>
      */
-    private $type_url = '';
+    protected $type_url = '';
     /**
      * The index of the field type in `Type.oneofs`, for message or enumeration
      * types. The first type has index 1; zero means the type is not in the list.
      *
      * Generated from protobuf field <code>int32 oneof_index = 7;</code>
      */
-    private $oneof_index = 0;
+    protected $oneof_index = 0;
     /**
      * Whether to use alternative packed wire representation.
      *
      * Generated from protobuf field <code>bool packed = 8;</code>
      */
-    private $packed = false;
+    protected $packed = false;
     /**
      * The protocol buffer options.
      *
@@ -70,13 +70,13 @@ class Field extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string json_name = 10;</code>
      */
-    private $json_name = '';
+    protected $json_name = '';
     /**
      * The string value of the default value of this field. Proto2 syntax only.
      *
      * Generated from protobuf field <code>string default_value = 11;</code>
      */
-    private $default_value = '';
+    protected $default_value = '';
 
     /**
      * Constructor.
@@ -133,7 +133,7 @@ class Field extends \Google\Protobuf\Internal\Message
      */
     public function setKind($var)
     {
-        GPBUtil::checkEnum($var, \Google\Protobuf\Field_Kind::class);
+        GPBUtil::checkEnum($var, \Google\Protobuf\Field\Kind::class);
         $this->kind = $var;
 
         return $this;
@@ -159,7 +159,7 @@ class Field extends \Google\Protobuf\Internal\Message
      */
     public function setCardinality($var)
     {
-        GPBUtil::checkEnum($var, \Google\Protobuf\Field_Cardinality::class);
+        GPBUtil::checkEnum($var, \Google\Protobuf\Field\Cardinality::class);
         $this->cardinality = $var;
 
         return $this;

+ 1 - 0
php/src/Google/Protobuf/Field/Cardinality.php

@@ -54,6 +54,7 @@ class Cardinality
         return self::$valueToName[$value];
     }
 
+
     public static function value($name)
     {
         $const = __CLASS__ . '::' . strtoupper($name);

+ 1 - 0
php/src/Google/Protobuf/Field/Kind.php

@@ -159,6 +159,7 @@ class Kind
         return self::$valueToName[$value];
     }
 
+
     public static function value($name)
     {
         $const = __CLASS__ . '::' . strtoupper($name);

+ 18 - 24
php/src/Google/Protobuf/FieldMask.php

@@ -62,45 +62,39 @@ use Google\Protobuf\Internal\GPBUtil;
  * and leave the others untouched. If a resource is passed in to
  * describe the updated values, the API ignores the values of all
  * fields not covered by the mask.
- * If a repeated field is specified for an update operation, the existing
- * repeated values in the target resource will be overwritten by the new values.
- * Note that a repeated field is only allowed in the last position of a `paths`
- * string.
+ * If a repeated field is specified for an update operation, new values will
+ * be appended to the existing repeated field in the target resource. Note that
+ * a repeated field is only allowed in the last position of a `paths` string.
  * If a sub-message is specified in the last position of the field mask for an
- * update operation, then the existing sub-message in the target resource is
- * overwritten. Given the target message:
+ * update operation, then new value will be merged into the existing sub-message
+ * in the target resource.
+ * For example, given the target message:
  *     f {
  *       b {
- *         d : 1
- *         x : 2
+ *         d: 1
+ *         x: 2
  *       }
- *       c : 1
+ *       c: [1]
  *     }
  * And an update message:
  *     f {
  *       b {
- *         d : 10
+ *         d: 10
  *       }
+ *       c: [2]
  *     }
  * then if the field mask is:
- *  paths: "f.b"
+ *  paths: ["f.b", "f.c"]
  * then the result will be:
  *     f {
  *       b {
- *         d : 10
- *       }
- *       c : 1
- *     }
- * However, if the update mask was:
- *  paths: "f.b.d"
- * then the result would be:
- *     f {
- *       b {
- *         d : 10
- *         x : 2
+ *         d: 10
+ *         x: 2
  *       }
- *       c : 1
+ *       c: [1, 2]
  *     }
+ * An implementation may provide options to override this default behavior for
+ * repeated and message fields.
  * In order to reset a field's value to the default, the field must
  * be in the mask and set to the default value in the provided resource.
  * Hence, in order to reset all fields of a resource, provide a default
@@ -165,7 +159,7 @@ use Google\Protobuf\Internal\GPBUtil;
  * ## Field Mask Verification
  * The implementation of any API method which has a FieldMask type field in the
  * request should verify the included field paths, and return an
- * `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
+ * `INVALID_ARGUMENT` error if any path is unmappable.
  *
  * Generated from protobuf message <code>google.protobuf.FieldMask</code>
  */

+ 1 - 1
php/src/Google/Protobuf/FloatValue.php

@@ -21,7 +21,7 @@ class FloatValue extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>float value = 1;</code>
      */
-    private $value = 0.0;
+    protected $value = 0.0;
 
     /**
      * Constructor.

+ 1 - 1
php/src/Google/Protobuf/Int32Value.php

@@ -21,7 +21,7 @@ class Int32Value extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>int32 value = 1;</code>
      */
-    private $value = 0;
+    protected $value = 0;
 
     /**
      * Constructor.

+ 1 - 1
php/src/Google/Protobuf/Int64Value.php

@@ -21,7 +21,7 @@ class Int64Value extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>int64 value = 1;</code>
      */
-    private $value = 0;
+    protected $value = 0;
 
     /**
      * Constructor.

+ 6 - 6
php/src/Google/Protobuf/Method.php

@@ -20,31 +20,31 @@ class Method extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string name = 1;</code>
      */
-    private $name = '';
+    protected $name = '';
     /**
      * A URL of the input message type.
      *
      * Generated from protobuf field <code>string request_type_url = 2;</code>
      */
-    private $request_type_url = '';
+    protected $request_type_url = '';
     /**
      * If true, the request is streamed.
      *
      * Generated from protobuf field <code>bool request_streaming = 3;</code>
      */
-    private $request_streaming = false;
+    protected $request_streaming = false;
     /**
      * The URL of the output message type.
      *
      * Generated from protobuf field <code>string response_type_url = 4;</code>
      */
-    private $response_type_url = '';
+    protected $response_type_url = '';
     /**
      * If true, the response is streamed.
      *
      * Generated from protobuf field <code>bool response_streaming = 5;</code>
      */
-    private $response_streaming = false;
+    protected $response_streaming = false;
     /**
      * Any metadata attached to the method.
      *
@@ -56,7 +56,7 @@ class Method extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 7;</code>
      */
-    private $syntax = 0;
+    protected $syntax = 0;
 
     /**
      * Constructor.

+ 2 - 2
php/src/Google/Protobuf/Mixin.php

@@ -81,14 +81,14 @@ class Mixin extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string name = 1;</code>
      */
-    private $name = '';
+    protected $name = '';
     /**
      * If non-empty specifies a path under which inherited HTTP paths
      * are rooted.
      *
      * Generated from protobuf field <code>string root = 2;</code>
      */
-    private $root = '';
+    protected $root = '';
 
     /**
      * Constructor.

+ 13 - 3
php/src/Google/Protobuf/Option.php

@@ -24,7 +24,7 @@ class Option extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string name = 1;</code>
      */
-    private $name = '';
+    protected $name = '';
     /**
      * The option's value packed in an Any message. If the value is a primitive,
      * the corresponding wrapper type defined in google/protobuf/wrappers.proto
@@ -33,7 +33,7 @@ class Option extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
      */
-    private $value = null;
+    protected $value = null;
 
     /**
      * Constructor.
@@ -101,7 +101,17 @@ class Option extends \Google\Protobuf\Internal\Message
      */
     public function getValue()
     {
-        return $this->value;
+        return isset($this->value) ? $this->value : null;
+    }
+
+    public function hasValue()
+    {
+        return isset($this->value);
+    }
+
+    public function clearValue()
+    {
+        unset($this->value);
     }
 
     /**

+ 1 - 1
php/src/Google/Protobuf/SourceContext.php

@@ -22,7 +22,7 @@ class SourceContext extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string file_name = 1;</code>
      */
-    private $file_name = '';
+    protected $file_name = '';
 
     /**
      * Constructor.

+ 1 - 1
php/src/Google/Protobuf/StringValue.php

@@ -21,7 +21,7 @@ class StringValue extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string value = 1;</code>
      */
-    private $value = '';
+    protected $value = '';
 
     /**
      * Constructor.

+ 1 - 0
php/src/Google/Protobuf/Syntax.php

@@ -40,6 +40,7 @@ class Syntax
         return self::$valueToName[$value];
     }
 
+
     public static function value($name)
     {
         $const = __CLASS__ . '::' . strtoupper($name);

+ 27 - 41
php/src/Google/Protobuf/Timestamp.php

@@ -9,17 +9,17 @@ use Google\Protobuf\Internal\RepeatedField;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * A Timestamp represents a point in time independent of any time zone
- * or calendar, represented as seconds and fractions of seconds at
- * nanosecond resolution in UTC Epoch time. It is encoded using the
- * Proleptic Gregorian Calendar which extends the Gregorian calendar
- * backwards to year one. It is encoded assuming all minutes are 60
- * seconds long, i.e. leap seconds are "smeared" so that no leap second
- * table is needed for interpretation. Range is from
- * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
- * By restricting to that range, we ensure that we can convert to
- * and from  RFC 3339 date strings.
- * See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
+ * A Timestamp represents a point in time independent of any time zone or local
+ * calendar, encoded as a count of seconds and fractions of seconds at
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
+ * Gregorian calendar backwards to year one.
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
+ * second table is needed for interpretation, using a [24-hour linear
+ * smear](https://developers.google.com/time/smear).
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
+ * restricting to that range, we ensure that we can convert to and from [RFC
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
  * # Examples
  * Example 1: Compute Timestamp from POSIX `time()`.
  *     Timestamp timestamp;
@@ -44,7 +44,12 @@ use Google\Protobuf\Internal\GPBUtil;
  *     long millis = System.currentTimeMillis();
  *     Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
  *         .setNanos((int) ((millis % 1000) * 1000000)).build();
- * Example 5: Compute Timestamp from current time in Python.
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
+ *     Instant now = Instant.now();
+ *     Timestamp timestamp =
+ *         Timestamp.newBuilder().setSeconds(now.getEpochSecond())
+ *             .setNanos(now.getNano()).build();
+ * Example 6: Compute Timestamp from current time in Python.
  *     timestamp = Timestamp()
  *     timestamp.GetCurrentTime()
  * # JSON Mapping
@@ -61,17 +66,19 @@ use Google\Protobuf\Internal\GPBUtil;
  * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
  * 01:30 UTC on January 15, 2017.
  * In JavaScript, one can convert a Date object to this format using the
- * standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
+ * standard
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
  * method. In Python, a standard `datetime.datetime` object can be converted
- * to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
- * with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
- * can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
- * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
+ * to this format using
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
+ * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
  * ) to obtain a formatter capable of generating timestamps in this format.
  *
  * Generated from protobuf message <code>google.protobuf.Timestamp</code>
  */
-class Timestamp extends \Google\Protobuf\Internal\Message
+class Timestamp extends \Google\Protobuf\Internal\TimestampBase
 {
     /**
      * Represents seconds of UTC time since Unix epoch
@@ -80,7 +87,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>int64 seconds = 1;</code>
      */
-    private $seconds = 0;
+    protected $seconds = 0;
     /**
      * Non-negative fractions of a second at nanosecond resolution. Negative
      * second values with fractions must still have non-negative nanos values
@@ -89,7 +96,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>int32 nanos = 2;</code>
      */
-    private $nanos = 0;
+    protected $nanos = 0;
 
     /**
      * Constructor.
@@ -175,26 +182,5 @@ class Timestamp extends \Google\Protobuf\Internal\Message
         return $this;
     }
 
-    /*
-     * Converts PHP DateTime to Timestamp.
-     *
-     * @param \DateTime $datetime
-     */
-    public function fromDateTime(\DateTime $datetime)
-    {
-        $this->seconds = $datetime->getTimestamp();
-        $this->nanos = 1000 * $datetime->format('u');
-    }
-
-    /**
-     * Converts Timestamp to PHP DateTime.
-     *
-     * @return \DateTime $datetime
-     */
-    public function toDateTime()
-    {
-        $time = sprintf('%s.%06d', $this->seconds, $this->nanos / 1000);
-        return \DateTime::createFromFormat('U.u', $time);
-    }
 }
 

+ 14 - 4
php/src/Google/Protobuf/Type.php

@@ -20,7 +20,7 @@ class Type extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>string name = 1;</code>
      */
-    private $name = '';
+    protected $name = '';
     /**
      * The list of fields.
      *
@@ -44,13 +44,13 @@ class Type extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 5;</code>
      */
-    private $source_context = null;
+    protected $source_context = null;
     /**
      * The source syntax.
      *
      * Generated from protobuf field <code>.google.protobuf.Syntax syntax = 6;</code>
      */
-    private $syntax = 0;
+    protected $syntax = 0;
 
     /**
      * Constructor.
@@ -189,7 +189,17 @@ class Type extends \Google\Protobuf\Internal\Message
      */
     public function getSourceContext()
     {
-        return $this->source_context;
+        return isset($this->source_context) ? $this->source_context : null;
+    }
+
+    public function hasSourceContext()
+    {
+        return isset($this->source_context);
+    }
+
+    public function clearSourceContext()
+    {
+        unset($this->source_context);
     }
 
     /**

+ 1 - 1
php/src/Google/Protobuf/UInt32Value.php

@@ -21,7 +21,7 @@ class UInt32Value extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>uint32 value = 1;</code>
      */
-    private $value = 0;
+    protected $value = 0;
 
     /**
      * Constructor.

+ 1 - 1
php/src/Google/Protobuf/UInt64Value.php

@@ -21,7 +21,7 @@ class UInt64Value extends \Google\Protobuf\Internal\Message
      *
      * Generated from protobuf field <code>uint64 value = 1;</code>
      */
-    private $value = 0;
+    protected $value = 0;
 
     /**
      * Constructor.

+ 16 - 1
src/google/protobuf/compiler/php/php_generator.cc

@@ -1402,9 +1402,24 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
     fullname = fullname.substr(lastindex + 1);
   }
 
+  std::string base;
+
+  switch (message->well_known_type()) {
+    case Descriptor::WELLKNOWNTYPE_ANY:
+      base = "\\Google\\Protobuf\\Internal\\AnyBase";
+      break;
+    case Descriptor::WELLKNOWNTYPE_TIMESTAMP:
+      base = "\\Google\\Protobuf\\Internal\\TimestampBase";
+      break;
+    default:
+      base = "\\Google\\Protobuf\\Internal\\Message";
+      break;
+  }
+
   printer.Print(
-      "class ^name^ extends \\Google\\Protobuf\\Internal\\Message\n"
+      "class ^name^ extends ^base^\n"
       "{\n",
+      "base", base,
       "name", fullname);
   Indent(&printer);
 

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott