Port for php8 (#8105)

* Port for php8

* Port php c extension for php8

* Update composer.json

* Drop php7.0 support

* Update phpunit for php7.1 in c extension test

* Add back support for php7.0

* Add badge for php8 continuous build
diff --git a/php/composer.json b/php/composer.json
index abcc293..28d379b 100644
--- a/php/composer.json
+++ b/php/composer.json
@@ -6,10 +6,10 @@
   "homepage": "https://developers.google.com/protocol-buffers/",
   "license": "BSD-3-Clause",
   "require": {
-    "php": ">=5.5.0"
+    "php": ">=7.0.0"
   },
   "require-dev": {
-    "phpunit/phpunit": "^5|^4.8.0"
+    "phpunit/phpunit": ">=6.0.0"
   },
   "autoload": {
     "psr-4": {
diff --git a/php/ext/google/protobuf/array.c b/php/ext/google/protobuf/array.c
index 0fa9bf0..e6412c0 100644
--- a/php/ext/google/protobuf/array.c
+++ b/php/ext/google/protobuf/array.c
@@ -453,9 +453,6 @@
   ZEND_ARG_INFO(0, newval)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO(arginfo_void, 0)
-ZEND_END_ARG_INFO()
-
 static zend_function_entry repeated_field_methods[] = {
   PHP_ME(RepeatedField, __construct,  arginfo_construct, ZEND_ACC_PUBLIC)
   PHP_ME(RepeatedField, append,       arginfo_append,    ZEND_ACC_PUBLIC)
@@ -636,7 +633,11 @@
   h = &RepeatedField_object_handlers;
   memcpy(h, &std_object_handlers, sizeof(zend_object_handlers));
   h->dtor_obj = RepeatedField_destructor;
+#if PHP_VERSION_ID < 80000
   h->compare_objects = RepeatedField_compare_objects;
+#else
+  h->compare = RepeatedField_compare_objects;
+#endif
   h->get_properties = RepeatedField_GetProperties;
   h->get_property_ptr_ptr = RepeatedField_GetPropertyPtrPtr;
 
diff --git a/php/ext/google/protobuf/def.c b/php/ext/google/protobuf/def.c
index 3f7590c..9accb1d 100644
--- a/php/ext/google/protobuf/def.c
+++ b/php/ext/google/protobuf/def.c
@@ -103,8 +103,8 @@
 }
 
 static zend_function_entry EnumValueDescriptor_methods[] = {
-  PHP_ME(EnumValueDescriptor, getName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(EnumValueDescriptor, getNumber, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(EnumValueDescriptor, getName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(EnumValueDescriptor, getNumber, arginfo_void, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -224,9 +224,9 @@
 }
 
 static zend_function_entry EnumDescriptor_methods[] = {
-  PHP_ME(EnumDescriptor, getPublicDescriptor, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(EnumDescriptor, getValueCount, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(EnumDescriptor, getValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(EnumDescriptor, getPublicDescriptor, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(EnumDescriptor, getValueCount, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(EnumDescriptor, getValue, arginfo_void, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -316,9 +316,9 @@
 }
 
 static zend_function_entry OneofDescriptor_methods[] = {
-  PHP_ME(OneofDescriptor, getName,  NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(OneofDescriptor, getField, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(OneofDescriptor, getFieldCount, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(OneofDescriptor, getName,  arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(OneofDescriptor, getField, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(OneofDescriptor, getFieldCount, arginfo_void, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -480,13 +480,13 @@
 }
 
 static zend_function_entry FieldDescriptor_methods[] = {
-  PHP_ME(FieldDescriptor, getName,   NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(FieldDescriptor, getNumber, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(FieldDescriptor, getLabel,  NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(FieldDescriptor, getType,   NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(FieldDescriptor, isMap,     NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(FieldDescriptor, getEnumType, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(FieldDescriptor, getMessageType, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(FieldDescriptor, getName,   arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(FieldDescriptor, getNumber, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(FieldDescriptor, getLabel,  arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(FieldDescriptor, getType,   arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(FieldDescriptor, isMap,     arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(FieldDescriptor, getEnumType, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(FieldDescriptor, getMessageType, arginfo_void, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -700,13 +700,13 @@
 
 
 static zend_function_entry Descriptor_methods[] = {
-  PHP_ME(Descriptor, getClass, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(Descriptor, getFullName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(Descriptor, getField, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(Descriptor, getFieldCount, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(Descriptor, getOneofDecl, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(Descriptor, getOneofDeclCount, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(Descriptor, getPublicDescriptor, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(Descriptor, getClass, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(Descriptor, getFullName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(Descriptor, getField, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(Descriptor, getFieldCount, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(Descriptor, getOneofDecl, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(Descriptor, getOneofDeclCount, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(Descriptor, getPublicDescriptor, arginfo_void, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -1000,13 +1000,18 @@
   upb_arena_free(arena);
 }
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_addgeneratedfile, 0, 0, 2)
+  ZEND_ARG_INFO(0, data)
+  ZEND_ARG_INFO(0, data_len)
+ZEND_END_ARG_INFO()
+
 static zend_function_entry DescriptorPool_methods[] = {
-  PHP_ME(DescriptorPool, getGeneratedPool, NULL,
+  PHP_ME(DescriptorPool, getGeneratedPool, arginfo_void,
          ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-  PHP_ME(DescriptorPool, getDescriptorByClassName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(DescriptorPool, getDescriptorByProtoName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(DescriptorPool, getEnumDescriptorByClassName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(DescriptorPool, internalAddGeneratedFile, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(DescriptorPool, getDescriptorByClassName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(DescriptorPool, getDescriptorByProtoName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(DescriptorPool, getEnumDescriptorByClassName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(DescriptorPool, internalAddGeneratedFile, arginfo_addgeneratedfile, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -1034,7 +1039,7 @@
 }
 
 static zend_function_entry InternalDescriptorPool_methods[] = {
-  PHP_ME(InternalDescriptorPool, getGeneratedPool, NULL,
+  PHP_ME(InternalDescriptorPool, getGeneratedPool, arginfo_void,
          ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
   ZEND_FE_END
 };
diff --git a/php/ext/google/protobuf/map.c b/php/ext/google/protobuf/map.c
index 426d56a..26776e6 100644
--- a/php/ext/google/protobuf/map.c
+++ b/php/ext/google/protobuf/map.c
@@ -437,9 +437,6 @@
   ZEND_ARG_INFO(0, newval)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO(arginfo_void, 0)
-ZEND_END_ARG_INFO()
-
 static zend_function_entry MapField_methods[] = {
   PHP_ME(MapField, __construct,  arginfo_construct, ZEND_ACC_PUBLIC)
   PHP_ME(MapField, offsetExists, arginfo_offsetGet, ZEND_ACC_PUBLIC)
@@ -622,7 +619,11 @@
   h = &MapField_object_handlers;
   memcpy(h, &std_object_handlers, sizeof(zend_object_handlers));
   h->dtor_obj = MapField_destructor;
+#if PHP_VERSION_ID < 80000
   h->compare_objects = MapField_compare_objects;
+#else
+  h->compare = MapField_compare_objects;
+#endif
   h->get_properties = Map_GetProperties;
   h->get_property_ptr_ptr = Map_GetPropertyPtrPtr;
 
diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c
index f15b8ac..8a5a0cf 100644
--- a/php/ext/google/protobuf/message.c
+++ b/php/ext/google/protobuf/message.c
@@ -1021,9 +1021,6 @@
   upb_msg_set(intern->msg, f, msgval, arena);
 }
 
-ZEND_BEGIN_ARG_INFO_EX(arginfo_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
 ZEND_BEGIN_ARG_INFO_EX(arginfo_mergeFrom, 0, 0, 1)
   ZEND_ARG_INFO(0, data)
 ZEND_END_ARG_INFO()
@@ -1106,7 +1103,7 @@
   if (!TryStripUrlPrefix(&type_url)) {
     zend_throw_exception(
         NULL, "Type url needs to be type.googleapis.com/fully-qualified",
-        0 TSRMLS_CC);
+        0);
     return;
   }
 
@@ -1115,7 +1112,7 @@
   if (m == NULL) {
     zend_throw_exception(
         NULL, "Specified message in any hasn't been added to descriptor pool",
-        0 TSRMLS_CC);
+        0);
     return;
   }
 
@@ -1149,7 +1146,7 @@
   const char *full_name;
   char *buf;
 
-  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &val) ==
+  if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &val) ==
       FAILURE) {
     return;
   }
@@ -1182,7 +1179,7 @@
   zend_class_entry *klass = NULL;
   const upb_msgdef *m;
 
-  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "C", &klass) ==
+  if (zend_parse_parameters(ZEND_NUM_ARGS(), "C", &klass) ==
       FAILURE) {
     return;
   }
@@ -1209,7 +1206,7 @@
     return;
   }
 
-  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &datetime,
+  if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &datetime,
                             date_interface_ce) == FAILURE) {
     zend_error(E_USER_ERROR, "Expect DatetimeInterface.");
     return;
@@ -1326,7 +1323,11 @@
 
   memcpy(h, &std_object_handlers, sizeof(zend_object_handlers));
   h->dtor_obj = Message_dtor;
+#if PHP_VERSION_ID < 80000
   h->compare_objects = Message_compare_objects;
+#else
+  h->compare = Message_compare_objects;
+#endif
   h->read_property = Message_read_property;
   h->write_property = Message_write_property;
   h->has_property = Message_has_property;
diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h
index fe0b5a7..322567e 100644
--- a/php/ext/google/protobuf/protobuf.h
+++ b/php/ext/google/protobuf/protobuf.h
@@ -69,6 +69,13 @@
 #define PROTO_STRLEN_P(obj) ZSTR_LEN(obj)
 #endif
 
+ZEND_BEGIN_ARG_INFO(arginfo_void, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1)
+  ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
 #define PHP_PROTOBUF_VERSION "3.14.0"
 
 // ptr -> PHP object cache. This is a weak map that caches lazily-created
diff --git a/php/ext/google/protobuf/wkt.inc b/php/ext/google/protobuf/wkt.inc
index 573ff30..401f2e8 100644
--- a/php/ext/google/protobuf/wkt.inc
+++ b/php/ext/google/protobuf/wkt.inc
@@ -37,7 +37,7 @@
 }
 
 static zend_function_entry GPBMetadata_Google_Protobuf_Any_methods[] = {
-  PHP_ME(GPBMetadata_Google_Protobuf_Any, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(GPBMetadata_Google_Protobuf_Any, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -103,15 +103,19 @@
   RETURN_ZVAL(getThis(), 1, 0);
 }
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_is, 0, 0, 1)
+  ZEND_ARG_INFO(0, proto)
+ZEND_END_ARG_INFO()
+
 static zend_function_entry google_protobuf_Any_phpmethods[] = {
-  PHP_ME(google_protobuf_Any, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Any, getTypeUrl, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Any, setTypeUrl, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Any, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Any, setValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Any, is, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Any, pack, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Any, unpack, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Any, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Any, getTypeUrl, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Any, setTypeUrl, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Any, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Any, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Any, is, arginfo_is, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Any, pack, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Any, unpack, arginfo_void, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -178,7 +182,7 @@
 }
 
 static zend_function_entry GPBMetadata_Google_Protobuf_Api_methods[] = {
-  PHP_ME(GPBMetadata_Google_Protobuf_Api, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(GPBMetadata_Google_Protobuf_Api, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -355,21 +359,21 @@
 }
 
 static zend_function_entry google_protobuf_Api_phpmethods[] = {
-  PHP_ME(google_protobuf_Api, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, getName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, setName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, getMethods, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, setMethods, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, getOptions, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, setOptions, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, getVersion, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, setVersion, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, getSourceContext, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, setSourceContext, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, getMixins, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, setMixins, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, getSyntax, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Api, setSyntax, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, getName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, setName, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, getMethods, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, setMethods, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, getOptions, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, setOptions, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, getVersion, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, setVersion, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, getSourceContext, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, setSourceContext, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, getMixins, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, setMixins, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, getSyntax, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Api, setSyntax, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -549,21 +553,21 @@
 }
 
 static zend_function_entry google_protobuf_Method_phpmethods[] = {
-  PHP_ME(google_protobuf_Method, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, getName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, setName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, getRequestTypeUrl, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, setRequestTypeUrl, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, getRequestStreaming, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, setRequestStreaming, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, getResponseTypeUrl, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, setResponseTypeUrl, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, getResponseStreaming, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, setResponseStreaming, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, getOptions, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, setOptions, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, getSyntax, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Method, setSyntax, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, getName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, setName, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, getRequestTypeUrl, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, setRequestTypeUrl, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, getRequestStreaming, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, setRequestStreaming, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, getResponseTypeUrl, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, setResponseTypeUrl, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, getResponseStreaming, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, setResponseStreaming, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, getOptions, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, setOptions, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, getSyntax, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Method, setSyntax, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -633,11 +637,11 @@
 }
 
 static zend_function_entry google_protobuf_Mixin_phpmethods[] = {
-  PHP_ME(google_protobuf_Mixin, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Mixin, getName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Mixin, setName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Mixin, getRoot, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Mixin, setRoot, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Mixin, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Mixin, getName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Mixin, setName, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Mixin, getRoot, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Mixin, setRoot, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -681,7 +685,7 @@
 }
 
 static zend_function_entry GPBMetadata_Google_Protobuf_Duration_methods[] = {
-  PHP_ME(GPBMetadata_Google_Protobuf_Duration, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(GPBMetadata_Google_Protobuf_Duration, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -748,11 +752,11 @@
 }
 
 static zend_function_entry google_protobuf_Duration_phpmethods[] = {
-  PHP_ME(google_protobuf_Duration, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Duration, getSeconds, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Duration, setSeconds, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Duration, getNanos, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Duration, setNanos, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Duration, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Duration, getSeconds, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Duration, setSeconds, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Duration, getNanos, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Duration, setNanos, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -794,7 +798,7 @@
 }
 
 static zend_function_entry GPBMetadata_Google_Protobuf_GPBEmpty_methods[] = {
-  PHP_ME(GPBMetadata_Google_Protobuf_GPBEmpty, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(GPBMetadata_Google_Protobuf_GPBEmpty, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -817,7 +821,7 @@
 }
 
 static zend_function_entry google_protobuf_Empty_phpmethods[] = {
-  PHP_ME(google_protobuf_Empty, __construct, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Empty, __construct, arginfo_void, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -860,7 +864,7 @@
 }
 
 static zend_function_entry GPBMetadata_Google_Protobuf_FieldMask_methods[] = {
-  PHP_ME(GPBMetadata_Google_Protobuf_FieldMask, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(GPBMetadata_Google_Protobuf_FieldMask, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -905,9 +909,9 @@
 }
 
 static zend_function_entry google_protobuf_FieldMask_phpmethods[] = {
-  PHP_ME(google_protobuf_FieldMask, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_FieldMask, getPaths, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_FieldMask, setPaths, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_FieldMask, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_FieldMask, getPaths, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_FieldMask, setPaths, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -951,7 +955,7 @@
 }
 
 static zend_function_entry GPBMetadata_Google_Protobuf_SourceContext_methods[] = {
-  PHP_ME(GPBMetadata_Google_Protobuf_SourceContext, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(GPBMetadata_Google_Protobuf_SourceContext, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -996,9 +1000,9 @@
 }
 
 static zend_function_entry google_protobuf_SourceContext_phpmethods[] = {
-  PHP_ME(google_protobuf_SourceContext, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_SourceContext, getFileName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_SourceContext, setFileName, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_SourceContext, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_SourceContext, getFileName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_SourceContext, setFileName, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -1058,7 +1062,7 @@
 }
 
 static zend_function_entry GPBMetadata_Google_Protobuf_Struct_methods[] = {
-  PHP_ME(GPBMetadata_Google_Protobuf_Struct, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(GPBMetadata_Google_Protobuf_Struct, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -1103,9 +1107,9 @@
 }
 
 static zend_function_entry google_protobuf_Struct_phpmethods[] = {
-  PHP_ME(google_protobuf_Struct, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Struct, getFields, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Struct, setFields, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Struct, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Struct, getFields, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Struct, setFields, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -1175,11 +1179,11 @@
 }
 
 static zend_function_entry google_protobuf_Struct_FieldsEntry_phpmethods[] = {
-  PHP_ME(google_protobuf_Struct_FieldsEntry, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Struct_FieldsEntry, getKey, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Struct_FieldsEntry, setKey, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Struct_FieldsEntry, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Struct_FieldsEntry, setValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Struct_FieldsEntry, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Struct_FieldsEntry, getKey, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Struct_FieldsEntry, setKey, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Struct_FieldsEntry, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Struct_FieldsEntry, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -1344,20 +1348,20 @@
   RETURN_STRING(field ? upb_fielddef_name(field) : "");
 }
 static zend_function_entry google_protobuf_Value_phpmethods[] = {
-  PHP_ME(google_protobuf_Value, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, getNullValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, setNullValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, getNumberValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, setNumberValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, getStringValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, setStringValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, getBoolValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, setBoolValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, getStructValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, setStructValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, getListValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, setListValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Value, getKind, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, getNullValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, setNullValue, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, getNumberValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, setNumberValue, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, getStringValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, setStringValue, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, getBoolValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, setBoolValue, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, getStructValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, setStructValue, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, getListValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, setListValue, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Value, getKind, arginfo_void, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -1405,9 +1409,9 @@
 }
 
 static zend_function_entry google_protobuf_ListValue_phpmethods[] = {
-  PHP_ME(google_protobuf_ListValue, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_ListValue, getValues, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_ListValue, setValues, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_ListValue, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_ListValue, getValues, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_ListValue, setValues, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -1433,7 +1437,7 @@
   const upb_enumdef *e = upb_symtab_lookupenum(symtab, "google.protobuf.NullValue");
   const char *name;
   zend_long value;
-  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) ==
+  if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &value) ==
       FAILURE) {
     return;
   }
@@ -1455,7 +1459,7 @@
   char *name = NULL;
   size_t name_len;
   int32_t num;
-  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name,
+  if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name,
                             &name_len) == FAILURE) {
     return;
   }
@@ -1470,8 +1474,8 @@
 }
 
 static zend_function_entry google_protobuf_NullValue_phpmethods[] = {
-  PHP_ME(google_protobuf_NullValue, name, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
-  PHP_ME(google_protobuf_NullValue, value, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(google_protobuf_NullValue, name, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(google_protobuf_NullValue, value, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -1570,7 +1574,7 @@
 }
 
 static zend_function_entry GPBMetadata_Google_Protobuf_Type_methods[] = {
-  PHP_ME(GPBMetadata_Google_Protobuf_Type, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(GPBMetadata_Google_Protobuf_Type, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -1725,19 +1729,19 @@
 }
 
 static zend_function_entry google_protobuf_Type_phpmethods[] = {
-  PHP_ME(google_protobuf_Type, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, getName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, setName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, getFields, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, setFields, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, getOneofs, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, setOneofs, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, getOptions, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, setOptions, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, getSourceContext, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, setSourceContext, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, getSyntax, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Type, setSyntax, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, getName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, setName, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, getFields, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, setFields, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, getOneofs, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, setOneofs, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, getOptions, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, setOptions, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, getSourceContext, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, setSourceContext, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, getSyntax, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Type, setSyntax, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -1983,27 +1987,27 @@
 }
 
 static zend_function_entry google_protobuf_Field_phpmethods[] = {
-  PHP_ME(google_protobuf_Field, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, getKind, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, setKind, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, getCardinality, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, setCardinality, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, getNumber, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, setNumber, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, getName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, setName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, getTypeUrl, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, setTypeUrl, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, getOneofIndex, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, setOneofIndex, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, getPacked, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, setPacked, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, getOptions, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, setOptions, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, getJsonName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, setJsonName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, getDefaultValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Field, setDefaultValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, getKind, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, setKind, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, getCardinality, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, setCardinality, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, getNumber, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, setNumber, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, getName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, setName, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, getTypeUrl, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, setTypeUrl, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, getOneofIndex, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, setOneofIndex, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, getPacked, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, setPacked, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, getOptions, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, setOptions, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, getJsonName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, setJsonName, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, getDefaultValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Field, setDefaultValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -2029,7 +2033,7 @@
   const upb_enumdef *e = upb_symtab_lookupenum(symtab, "google.protobuf.Field.Kind");
   const char *name;
   zend_long value;
-  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) ==
+  if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &value) ==
       FAILURE) {
     return;
   }
@@ -2051,7 +2055,7 @@
   char *name = NULL;
   size_t name_len;
   int32_t num;
-  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name,
+  if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name,
                             &name_len) == FAILURE) {
     return;
   }
@@ -2066,8 +2070,8 @@
 }
 
 static zend_function_entry google_protobuf_Field_Kind_phpmethods[] = {
-  PHP_ME(google_protobuf_Field_Kind, name, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
-  PHP_ME(google_protobuf_Field_Kind, value, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(google_protobuf_Field_Kind, name, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(google_protobuf_Field_Kind, value, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -2128,7 +2132,7 @@
   const upb_enumdef *e = upb_symtab_lookupenum(symtab, "google.protobuf.Field.Cardinality");
   const char *name;
   zend_long value;
-  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) ==
+  if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &value) ==
       FAILURE) {
     return;
   }
@@ -2150,7 +2154,7 @@
   char *name = NULL;
   size_t name_len;
   int32_t num;
-  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name,
+  if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name,
                             &name_len) == FAILURE) {
     return;
   }
@@ -2165,8 +2169,8 @@
 }
 
 static zend_function_entry google_protobuf_Field_Cardinality_phpmethods[] = {
-  PHP_ME(google_protobuf_Field_Cardinality, name, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
-  PHP_ME(google_protobuf_Field_Cardinality, value, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(google_protobuf_Field_Cardinality, name, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(google_protobuf_Field_Cardinality, value, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -2307,17 +2311,17 @@
 }
 
 static zend_function_entry google_protobuf_Enum_phpmethods[] = {
-  PHP_ME(google_protobuf_Enum, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Enum, getName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Enum, setName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Enum, getEnumvalue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Enum, setEnumvalue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Enum, getOptions, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Enum, setOptions, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Enum, getSourceContext, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Enum, setSourceContext, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Enum, getSyntax, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Enum, setSyntax, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Enum, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Enum, getName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Enum, setName, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Enum, getEnumvalue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Enum, setEnumvalue, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Enum, getOptions, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Enum, setOptions, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Enum, getSourceContext, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Enum, setSourceContext, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Enum, getSyntax, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Enum, setSyntax, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -2409,13 +2413,13 @@
 }
 
 static zend_function_entry google_protobuf_EnumValue_phpmethods[] = {
-  PHP_ME(google_protobuf_EnumValue, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_EnumValue, getName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_EnumValue, setName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_EnumValue, getNumber, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_EnumValue, setNumber, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_EnumValue, getOptions, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_EnumValue, setOptions, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_EnumValue, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_EnumValue, getName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_EnumValue, setName, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_EnumValue, getNumber, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_EnumValue, setNumber, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_EnumValue, getOptions, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_EnumValue, setOptions, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -2485,11 +2489,11 @@
 }
 
 static zend_function_entry google_protobuf_Option_phpmethods[] = {
-  PHP_ME(google_protobuf_Option, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Option, getName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Option, setName, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Option, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Option, setValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Option, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Option, getName, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Option, setName, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Option, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Option, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -2515,7 +2519,7 @@
   const upb_enumdef *e = upb_symtab_lookupenum(symtab, "google.protobuf.Syntax");
   const char *name;
   zend_long value;
-  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) ==
+  if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &value) ==
       FAILURE) {
     return;
   }
@@ -2537,7 +2541,7 @@
   char *name = NULL;
   size_t name_len;
   int32_t num;
-  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name,
+  if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name,
                             &name_len) == FAILURE) {
     return;
   }
@@ -2552,8 +2556,8 @@
 }
 
 static zend_function_entry google_protobuf_Syntax_phpmethods[] = {
-  PHP_ME(google_protobuf_Syntax, name, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
-  PHP_ME(google_protobuf_Syntax, value, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(google_protobuf_Syntax, name, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(google_protobuf_Syntax, value, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -2598,7 +2602,7 @@
 }
 
 static zend_function_entry GPBMetadata_Google_Protobuf_Timestamp_methods[] = {
-  PHP_ME(GPBMetadata_Google_Protobuf_Timestamp, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(GPBMetadata_Google_Protobuf_Timestamp, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -2664,14 +2668,18 @@
   RETURN_ZVAL(getThis(), 1, 0);
 }
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_timestamp_fromdatetime, 0, 0, 1)
+  ZEND_ARG_INFO(0, datetime)
+ZEND_END_ARG_INFO()
+
 static zend_function_entry google_protobuf_Timestamp_phpmethods[] = {
-  PHP_ME(google_protobuf_Timestamp, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Timestamp, getSeconds, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Timestamp, setSeconds, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Timestamp, getNanos, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Timestamp, setNanos, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Timestamp, fromDateTime, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Timestamp, toDateTime, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Timestamp, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Timestamp, getSeconds, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Timestamp, setSeconds, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Timestamp, getNanos, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Timestamp, setNanos, arginfo_setter, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Timestamp, fromDateTime, arginfo_timestamp_fromdatetime, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Timestamp, toDateTime, arginfo_void, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -2724,7 +2732,7 @@
 }
 
 static zend_function_entry GPBMetadata_Google_Protobuf_Wrappers_methods[] = {
-  PHP_ME(GPBMetadata_Google_Protobuf_Wrappers, initOnce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+  PHP_ME(GPBMetadata_Google_Protobuf_Wrappers, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
   ZEND_FE_END
 };
 
@@ -2769,9 +2777,9 @@
 }
 
 static zend_function_entry google_protobuf_DoubleValue_phpmethods[] = {
-  PHP_ME(google_protobuf_DoubleValue, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_DoubleValue, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_DoubleValue, setValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_DoubleValue, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_DoubleValue, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_DoubleValue, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -2819,9 +2827,9 @@
 }
 
 static zend_function_entry google_protobuf_FloatValue_phpmethods[] = {
-  PHP_ME(google_protobuf_FloatValue, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_FloatValue, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_FloatValue, setValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_FloatValue, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_FloatValue, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_FloatValue, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -2869,9 +2877,9 @@
 }
 
 static zend_function_entry google_protobuf_Int64Value_phpmethods[] = {
-  PHP_ME(google_protobuf_Int64Value, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Int64Value, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Int64Value, setValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Int64Value, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Int64Value, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Int64Value, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -2919,9 +2927,9 @@
 }
 
 static zend_function_entry google_protobuf_UInt64Value_phpmethods[] = {
-  PHP_ME(google_protobuf_UInt64Value, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_UInt64Value, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_UInt64Value, setValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_UInt64Value, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_UInt64Value, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_UInt64Value, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -2969,9 +2977,9 @@
 }
 
 static zend_function_entry google_protobuf_Int32Value_phpmethods[] = {
-  PHP_ME(google_protobuf_Int32Value, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Int32Value, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_Int32Value, setValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Int32Value, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Int32Value, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_Int32Value, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -3019,9 +3027,9 @@
 }
 
 static zend_function_entry google_protobuf_UInt32Value_phpmethods[] = {
-  PHP_ME(google_protobuf_UInt32Value, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_UInt32Value, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_UInt32Value, setValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_UInt32Value, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_UInt32Value, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_UInt32Value, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -3069,9 +3077,9 @@
 }
 
 static zend_function_entry google_protobuf_BoolValue_phpmethods[] = {
-  PHP_ME(google_protobuf_BoolValue, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_BoolValue, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_BoolValue, setValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_BoolValue, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_BoolValue, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_BoolValue, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -3119,9 +3127,9 @@
 }
 
 static zend_function_entry google_protobuf_StringValue_phpmethods[] = {
-  PHP_ME(google_protobuf_StringValue, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_StringValue, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_StringValue, setValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_StringValue, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_StringValue, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_StringValue, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
@@ -3169,9 +3177,9 @@
 }
 
 static zend_function_entry google_protobuf_BytesValue_phpmethods[] = {
-  PHP_ME(google_protobuf_BytesValue, __construct, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_BytesValue, getValue, NULL, ZEND_ACC_PUBLIC)
-  PHP_ME(google_protobuf_BytesValue, setValue, NULL, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_BytesValue, __construct, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_BytesValue, getValue, arginfo_void, ZEND_ACC_PUBLIC)
+  PHP_ME(google_protobuf_BytesValue, setValue, arginfo_setter, ZEND_ACC_PUBLIC)
   ZEND_FE_END
 };
 
diff --git a/php/tests/ArrayTest.php b/php/tests/ArrayTest.php
index d167331..269d11d 100644
--- a/php/tests/ArrayTest.php
+++ b/php/tests/ArrayTest.php
@@ -1,5 +1,6 @@
 <?php
 
+require_once('test_base.php');
 require_once('test_util.php');
 
 use Google\Protobuf\Internal\RepeatedField;
@@ -7,7 +8,7 @@
 use Foo\TestMessage;
 use Foo\TestMessage\Sub;
 
-class ArrayTest extends \PHPUnit\Framework\TestCase
+class ArrayTest extends TestBase
 {
 
     #########################################################
@@ -296,15 +297,15 @@
 
         // Test append.
         $arr[] = 1;
-        $this->assertEquals(1.0, $arr[0], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.0, $arr[0], MAX_FLOAT_DIFF);
 
         $arr[] = 1.1;
-        $this->assertEquals(1.1, $arr[1], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.1, $arr[1], MAX_FLOAT_DIFF);
 
         $arr[] = '2';
-        $this->assertEquals(2.0, $arr[2], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(2.0, $arr[2], MAX_FLOAT_DIFF);
         $arr[] = '3.1';
-        $this->assertEquals(3.1, $arr[3], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(3.1, $arr[3], MAX_FLOAT_DIFF);
 
         $this->assertEquals(4, count($arr));
 
@@ -315,15 +316,15 @@
 
         // Test set.
         $arr[0] = 1;
-        $this->assertEquals(1.0, $arr[0], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.0, $arr[0], MAX_FLOAT_DIFF);
 
         $arr[1] = 1.1;
-        $this->assertEquals(1.1, $arr[1], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.1, $arr[1], MAX_FLOAT_DIFF);
 
         $arr[2] = '2';
-        $this->assertEquals(2.0, $arr[2], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(2.0, $arr[2], MAX_FLOAT_DIFF);
         $arr[3] = '3.1';
-        $this->assertEquals(3.1, $arr[3], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(3.1, $arr[3], MAX_FLOAT_DIFF);
     }
 
     #########################################################
@@ -336,15 +337,15 @@
 
         // Test append.
         $arr[] = 1;
-        $this->assertEquals(1.0, $arr[0], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.0, $arr[0], MAX_FLOAT_DIFF);
 
         $arr[] = 1.1;
-        $this->assertEquals(1.1, $arr[1], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.1, $arr[1], MAX_FLOAT_DIFF);
 
         $arr[] = '2';
-        $this->assertEquals(2.0, $arr[2], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(2.0, $arr[2], MAX_FLOAT_DIFF);
         $arr[] = '3.1';
-        $this->assertEquals(3.1, $arr[3], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(3.1, $arr[3], MAX_FLOAT_DIFF);
 
         $this->assertEquals(4, count($arr));
 
@@ -355,15 +356,15 @@
 
         // Test set.
         $arr[0] = 1;
-        $this->assertEquals(1.0, $arr[0], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.0, $arr[0], MAX_FLOAT_DIFF);
 
         $arr[1] = 1.1;
-        $this->assertEquals(1.1, $arr[1], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.1, $arr[1], MAX_FLOAT_DIFF);
 
         $arr[2] = '2';
-        $this->assertEquals(2.0, $arr[2], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(2.0, $arr[2], MAX_FLOAT_DIFF);
         $arr[3] = '3.1';
-        $this->assertEquals(3.1, $arr[3], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(3.1, $arr[3], MAX_FLOAT_DIFF);
     }
 
     #########################################################
@@ -566,6 +567,8 @@
             $sub = new Sub(['a' => $sub]);
         }
         $m->setRepeatedMessage($subs);
+
+        $this->assertTrue(true);
     }
 
     #########################################################
diff --git a/php/tests/DescriptorsTest.php b/php/tests/DescriptorsTest.php
index b2c5e01..ca7e8f3 100644
--- a/php/tests/DescriptorsTest.php
+++ b/php/tests/DescriptorsTest.php
@@ -205,22 +205,20 @@
         $this->assertSame(self::GPBTYPE_ENUM, $mapDesc->getField(1)->getType());
     }
 
-    /**
-     * @expectedException \Exception
-     */
     public function testFieldDescriptorEnumException()
     {
+        $this->expectException(Exception::class);
+
         $pool = DescriptorPool::getGeneratedPool();
         $desc = $pool->getDescriptorByClassName(get_class(new TestDescriptorsMessage()));
         $fieldDesc = $desc->getField(0);
         $fieldDesc->getEnumType();
     }
 
-    /**
-     * @expectedException \Exception
-     */
     public function testFieldDescriptorMessageException()
     {
+        $this->expectException(Exception::class);
+
         $pool = DescriptorPool::getGeneratedPool();
         $desc = $pool->getDescriptorByClassName(get_class(new TestDescriptorsMessage()));
         $fieldDesc = $desc->getField(0);
diff --git a/php/tests/EncodeDecodeTest.php b/php/tests/EncodeDecodeTest.php
index cea1e6a..6368a18 100644
--- a/php/tests/EncodeDecodeTest.php
+++ b/php/tests/EncodeDecodeTest.php
@@ -212,7 +212,7 @@
     public function generateRandomString($length = 10) {
         $randomString = str_repeat("+", $length);
         for ($i = 0; $i < $length; $i++) {
-            $randomString[$i] = rand(0, 255);
+            $randomString[$i] = chr(rand(0, 255));
         }
         return $randomString;
     }
@@ -529,200 +529,178 @@
         $this->assertSame("", $data);
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidInt32()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('08'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidSubMessage()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('9A010108'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidInt64()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('10'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidUInt32()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('18'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidUInt64()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('20'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidSInt32()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('28'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidSInt64()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('30'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidFixed32()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('3D'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidFixed64()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('41'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidSFixed32()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('4D'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidSFixed64()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('51'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidFloat()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('5D'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidDouble()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('61'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidBool()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('68'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidStringLengthMiss()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('72'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidStringDataMiss()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('7201'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidBytesLengthMiss()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('7A'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidBytesDataMiss()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('7A01'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidEnum()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('8001'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidMessageLengthMiss()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('8A01'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidMessageDataMiss()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage();
         $m->mergeFromString(hex2bin('8A0101'));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeInvalidPackedMessageLength()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestPackedMessage();
         $m->mergeFromString(hex2bin('D205'));
     }
@@ -1143,11 +1121,10 @@
         $this->assertSame("0801", bin2hex($m1->getAny()->getValue()));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testDecodeAnyWithUnknownPacked()
     {
+        $this->expectException(Exception::class);
+
         $m = new TestAny();
         $m->mergeFromJsonString(
             "{\"any\":" .
diff --git a/php/tests/GeneratedClassTest.php b/php/tests/GeneratedClassTest.php
index 037bd1b..f3f74d1 100644
--- a/php/tests/GeneratedClassTest.php
+++ b/php/tests/GeneratedClassTest.php
@@ -260,21 +260,21 @@
         $this->assertEquals(1, TestEnum::value('ONE'));
     }
 
-    /**
-     * @expectedException UnexpectedValueException
-     * @expectedExceptionMessage Enum Foo\TestEnum has no name defined for value -1
-     */
     public function testInvalidEnumValueThrowsException()
     {
+        $this->expectException(UnexpectedValueException::class);
+        $this->expectExceptionMessage(
+            'Enum Foo\TestEnum has no name defined for value -1');
+
         TestEnum::name(-1);
     }
 
-    /**
-     * @expectedException UnexpectedValueException
-     * @expectedExceptionMessage Enum Foo\TestEnum has no value defined for name DOES_NOT_EXIST
-     */
     public function testInvalidEnumNameThrowsException()
     {
+        $this->expectException(UnexpectedValueException::class);
+        $this->expectExceptionMessage(
+            'Enum Foo\TestEnum has no value defined for name DOES_NOT_EXIST');
+
         TestEnum::value('DOES_NOT_EXIST');
     }
 
@@ -313,17 +313,17 @@
 
         // Set integer.
         $m->setOptionalFloat(1);
-        $this->assertEquals(1.0, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.0, $m->getOptionalFloat(), MAX_FLOAT_DIFF);
 
         // Set float.
         $m->setOptionalFloat(1.1);
-        $this->assertEquals(1.1, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.1, $m->getOptionalFloat(), MAX_FLOAT_DIFF);
 
         // Set string.
         $m->setOptionalFloat('2');
-        $this->assertEquals(2.0, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(2.0, $m->getOptionalFloat(), MAX_FLOAT_DIFF);
         $m->setOptionalFloat('3.1');
-        $this->assertEquals(3.1, $m->getOptionalFloat(), '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(3.1, $m->getOptionalFloat(), MAX_FLOAT_DIFF);
     }
 
     #########################################################
@@ -336,17 +336,17 @@
 
         // Set integer.
         $m->setOptionalDouble(1);
-        $this->assertEquals(1.0, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.0, $m->getOptionalDouble(), MAX_FLOAT_DIFF);
 
         // Set float.
         $m->setOptionalDouble(1.1);
-        $this->assertEquals(1.1, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.1, $m->getOptionalDouble(), MAX_FLOAT_DIFF);
 
         // Set string.
         $m->setOptionalDouble('2');
-        $this->assertEquals(2.0, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(2.0, $m->getOptionalDouble(), MAX_FLOAT_DIFF);
         $m->setOptionalDouble('3.1');
-        $this->assertEquals(3.1, $m->getOptionalDouble(), '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(3.1, $m->getOptionalDouble(), MAX_FLOAT_DIFF);
     }
 
     #########################################################
@@ -1467,6 +1467,8 @@
             }
             $key = new TestMessage($key);
         }
+
+        $this->assertTrue(true);
     }
 
     public function testOneofMessageInArrayConstructor()
@@ -1476,6 +1478,8 @@
         ]);
         $this->assertSame('oneof_message', $m->getMyOneof());
         $this->assertNotNull($m->getOneofMessage());
+
+        $this->assertTrue(true);
     }
 
     public function testOneofStringInArrayConstructor()
@@ -1483,6 +1487,8 @@
         $m = new TestMessage([
             'oneof_string' => 'abc',
         ]);
+
+        $this->assertTrue(true);
     }
 
     #########################################################
@@ -1527,6 +1533,8 @@
         array_walk($values, function (&$value) {});
         $m = new TestMessage();
         $m->setOptionalString($values[0]);
+
+        $this->assertTrue(true);
     }
 
     #########################################################
@@ -1697,11 +1705,10 @@
         throw new Exception('Intended');
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testNoSegfaultWithError()
     {
+        $this->expectException(Exception::class);
+
         new TestMessage(['optional_int32' => $this->throwIntendedException()]);
     }
 
@@ -1724,5 +1731,7 @@
          * The value we are passing to var_dump() appears to be corrupt somehow.
          */
         /* var_dump($m); */
+
+        $this->assertTrue(true);
     }
 }
diff --git a/php/tests/GeneratedPhpdocTest.php b/php/tests/GeneratedPhpdocTest.php
index 526927f..de672ac 100644
--- a/php/tests/GeneratedPhpdocTest.php
+++ b/php/tests/GeneratedPhpdocTest.php
@@ -13,15 +13,15 @@
     {
         $class = new ReflectionClass('Foo\TestMessage');
         $doc = $class->getDocComment();
-        $this->assertContains('foo.TestMessage', $doc);
+        $this->assertStringContains('foo.TestMessage', $doc);
     }
 
     public function testPhpDocForConstructor()
     {
         $class = new ReflectionClass('Foo\TestMessage');
         $doc = $class->getMethod('__construct')->getDocComment();
-        $this->assertContains('@param array $data', $doc);
-        $this->assertContains('@type int $optional_int32', $doc);
+        $this->assertStringContains('@param array $data', $doc);
+        $this->assertStringContains('@type int $optional_int32', $doc);
     }
 
     /**
@@ -32,7 +32,7 @@
         $class = new ReflectionClass('Foo\TestMessage');
         foreach ($methods as $method) {
             $doc = $class->getMethod($method)->getDocComment();
-            $this->assertContains($expectedDoc, $doc);
+            $this->assertStringContains($expectedDoc, $doc);
         }
     }
 
diff --git a/php/tests/GeneratedServiceTest.php b/php/tests/GeneratedServiceTest.php
index 5407db9..be9234c 100644
--- a/php/tests/GeneratedServiceTest.php
+++ b/php/tests/GeneratedServiceTest.php
@@ -30,10 +30,13 @@
         'sayHelloAgain'
     ];
 
-    public function setUp()
+    /**
+     * Avoid calling setUp, which has void return type (not avalialbe in php7.0).
+     *
+     * @before
+     */
+    public function setUpTest()
     {
-        parent::setUp();
-
         $this->serviceClass = new ReflectionClass('Foo\GreeterInterface');
 
         $this->namespacedServiceClass = new ReflectionClass('Bar\OtherGreeterInterface');
@@ -46,17 +49,20 @@
 
     public function testPhpDocForClass()
     {
-        $this->assertContains('foo.Greeter', $this->serviceClass->getDocComment());
+        $this->assertStringContains(
+            'foo.Greeter', $this->serviceClass->getDocComment());
     }
 
     public function testPhpDocForNamespacedClass()
     {
-        $this->assertContains('foo.OtherGreeter', $this->namespacedServiceClass->getDocComment());
+        $this->assertStringContains(
+            'foo.OtherGreeter', $this->namespacedServiceClass->getDocComment());
     }
 
     public function testServiceMethodsAreGenerated()
     {
-        $this->assertCount(count($this->methodNames), $this->serviceClass->getMethods());
+        $this->assertCount(
+            count($this->methodNames), $this->serviceClass->getMethods());
         foreach ($this->methodNames as $methodName) {
             $this->assertTrue($this->serviceClass->hasMethod($methodName));
         }
@@ -65,20 +71,27 @@
     public function testPhpDocForServiceMethod()
     {
         foreach ($this->methodNames as $methodName) {
-            $docComment = $this->serviceClass->getMethod($methodName)->getDocComment();
-            $this->assertContains($methodName, $docComment);
-            $this->assertContains('@param \Foo\HelloRequest $request', $docComment);
-            $this->assertContains('@return \Foo\HelloReply', $docComment);
+            $docComment =
+                $this->serviceClass->getMethod($methodName)->getDocComment();
+            $this->assertStringContains($methodName, $docComment);
+            $this->assertStringContains(
+                '@param \Foo\HelloRequest $request', $docComment);
+            $this->assertStringContains(
+                '@return \Foo\HelloReply', $docComment);
         }
     }
 
     public function testPhpDocForServiceMethodInNamespacedClass()
     {
         foreach ($this->methodNames as $methodName) {
-            $docComment = $this->namespacedServiceClass->getMethod($methodName)->getDocComment();
-            $this->assertContains($methodName, $docComment);
-            $this->assertContains('@param \Foo\HelloRequest $request', $docComment);
-            $this->assertContains('@return \Foo\HelloReply', $docComment);
+            $docComment =
+                $this->namespacedServiceClass->getMethod(
+                    $methodName)->getDocComment();
+            $this->assertStringContains($methodName, $docComment);
+            $this->assertStringContains(
+                '@param \Foo\HelloRequest $request', $docComment);
+            $this->assertStringContains(
+                '@return \Foo\HelloReply', $docComment);
         }
     }
 
@@ -90,8 +103,10 @@
             $param = $method->getParameters()[0];
             $this->assertFalse($param->isOptional());
             $this->assertSame('request', $param->getName());
-            // ReflectionParameter::getType only exists in PHP 7+, so get the type from __toString
-            $this->assertContains('Foo\HelloRequest $request', (string) $param);
+	    // ReflectionParameter::getType only exists in PHP 7+, so get the
+	    // type from __toString
+            $this->assertStringContains(
+                'Foo\HelloRequest $request', (string) $param);
         }
     }
 
@@ -103,8 +118,10 @@
             $param = $method->getParameters()[0];
             $this->assertFalse($param->isOptional());
             $this->assertSame('request', $param->getName());
-            // ReflectionParameter::getType only exists in PHP 7+, so get the type from __toString
-            $this->assertContains('Foo\HelloRequest $request', (string) $param);
+	    // ReflectionParameter::getType only exists in PHP 7+, so get the
+	    // type from __toString
+            $this->assertStringContains(
+                'Foo\HelloRequest $request', (string) $param);
         }
     }
 }
diff --git a/php/tests/MapFieldTest.php b/php/tests/MapFieldTest.php
index 4ed4b09..a96f24f 100644
--- a/php/tests/MapFieldTest.php
+++ b/php/tests/MapFieldTest.php
@@ -1,5 +1,6 @@
 <?php
 
+require_once('test_base.php');
 require_once('test_util.php');
 
 use Google\Protobuf\Internal\GPBType;
@@ -7,7 +8,7 @@
 use Foo\TestMessage;
 use Foo\TestMessage\Sub;
 
-class MapFieldTest extends \PHPUnit\Framework\TestCase {
+class MapFieldTest extends TestBase {
 
     #########################################################
     # Test int32 field.
@@ -257,15 +258,15 @@
 
         // Test set.
         $arr[0] = 1;
-        $this->assertEquals(1.0, $arr[0], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.0, $arr[0], MAX_FLOAT_DIFF);
 
         $arr[1] = 1.1;
-        $this->assertEquals(1.1, $arr[1], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.1, $arr[1], MAX_FLOAT_DIFF);
 
         $arr[2] = '2';
-        $this->assertEquals(2.0, $arr[2], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(2.0, $arr[2], MAX_FLOAT_DIFF);
         $arr[3] = '3.1';
-        $this->assertEquals(3.1, $arr[3], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(3.1, $arr[3], MAX_FLOAT_DIFF);
 
         $this->assertEquals(4, count($arr));
     }
@@ -279,15 +280,15 @@
 
         // Test set.
         $arr[0] = 1;
-        $this->assertEquals(1.0, $arr[0], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.0, $arr[0], MAX_FLOAT_DIFF);
 
         $arr[1] = 1.1;
-        $this->assertEquals(1.1, $arr[1], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(1.1, $arr[1], MAX_FLOAT_DIFF);
 
         $arr[2] = '2';
-        $this->assertEquals(2.0, $arr[2], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(2.0, $arr[2], MAX_FLOAT_DIFF);
         $arr[3] = '3.1';
-        $this->assertEquals(3.1, $arr[3], '', MAX_FLOAT_DIFF);
+        $this->assertFloatEquals(3.1, $arr[3], MAX_FLOAT_DIFF);
 
         $this->assertEquals(4, count($arr));
     }
@@ -477,6 +478,8 @@
         array_walk($values, function (&$value) {});
         $m = new TestMessage();
         $m->setMapInt32Message($values);
+
+        $this->assertTrue(true);
     }
 
     #########################################################
diff --git a/php/tests/PhpImplementationTest.php b/php/tests/PhpImplementationTest.php
index f9fc1fd..82d0c5a 100644
--- a/php/tests/PhpImplementationTest.php
+++ b/php/tests/PhpImplementationTest.php
@@ -20,7 +20,11 @@
  */
 class ImplementationTest extends TestBase
 {
-    public function setUp()
+    /**
+     * Avoid calling setUp, which has void return type (not avalialbe in php7.0).
+     * @before
+     */
+    public function skipTestsForExtension()
     {
         if (extension_loaded('protobuf')) {
             $this->markTestSkipped();
@@ -306,6 +310,8 @@
         $m = new TestMessage();
         $m->mergeFromString(TestUtil::getGoldenTestMessage());
         TestUtil::assertTestMessage($m);
+
+        $this->assertTrue(true);
     }
 
     public function testDescriptorDecode()
@@ -525,23 +531,23 @@
         $this->assertSame(166, $m->byteSize());
     }
 
-    /**
-     * @expectedException UnexpectedValueException
-     * @expectedExceptionMessage Invalid message property: optionalInt32
-     */
     public function testArrayConstructorJsonCaseThrowsException()
     {
+        $this->expectException(UnexpectedValueException::class);
+        $this->expectExceptionMessage(
+            'Invalid message property: optionalInt32');
+
         $m = new TestMessage([
             'optionalInt32' => -42,
         ]);
     }
 
-    /**
-     * @expectedException Exception
-     * @expectedExceptionMessage Expect Foo\TestMessage\Sub.
-     */
     public function testArraysForMessagesThrowsException()
     {
+        $this->expectException(Exception::class);
+        $this->expectExceptionMessage(
+            'Expect Foo\TestMessage\Sub.');
+
         $m = new TestMessage([
             'optional_message' => [
                 'a' => 33
@@ -568,10 +574,11 @@
 
     /**
      * @dataProvider provideArrayConstructorWithNullValuesThrowsException
-     * @expectedException Exception
      */
     public function testArrayConstructorWithNullValuesThrowsException($requestData)
     {
+        $this->expectException(Exception::class);
+
         $m = new TestMessage($requestData);
     }
 
diff --git a/php/tests/WellKnownTest.php b/php/tests/WellKnownTest.php
index a148fa4..27b7e14 100644
--- a/php/tests/WellKnownTest.php
+++ b/php/tests/WellKnownTest.php
@@ -86,31 +86,28 @@
         $this->assertFalse($any->is(Any::class));
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testAnyUnpackInvalidTypeUrl()
     {
+        $this->expectException(Exception::class);
+
         $any = new Any();
         $any->setTypeUrl("invalid");
         $any->unpack();
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testAnyUnpackMessageNotAdded()
     {
+        $this->expectException(Exception::class);
+
         $any = new Any();
         $any->setTypeUrl("type.googleapis.com/MessageNotAdded");
         $any->unpack();
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testAnyUnpackDecodeError()
     {
+        $this->expectException(Exception::class);
+
         $any = new Any();
         $any->setTypeUrl("type.googleapis.com/foo.TestMessage");
         $any->setValue("abc");
diff --git a/php/tests/WrapperTypeSettersTest.php b/php/tests/WrapperTypeSettersTest.php
index e4bdfcf..045fa66 100644
--- a/php/tests/WrapperTypeSettersTest.php
+++ b/php/tests/WrapperTypeSettersTest.php
@@ -148,10 +148,10 @@
 
     /**
      * @dataProvider invalidSettersDataProvider
-     * @expectedException \Exception
      */
     public function testInvalidSetters($class, $setter, $value)
     {
+        $this->expectException(Exception::class);
         (new $class())->$setter($value);
     }
 
@@ -243,6 +243,8 @@
             }
             $this->assertEquals($expectedInnerValue, $actualInnerValue);
         }
+
+        $this->assertTrue(true);
     }
 
     public function constructorWithRepeatedWrapperTypeDataProvider()
@@ -286,6 +288,8 @@
             }
             $this->assertEquals($expectedInnerValue, $actualInnerValue);
         }
+
+        $this->assertTrue(true);
     }
 
     public function constructorWithMapWrapperTypeDataProvider()
diff --git a/php/tests/test.sh b/php/tests/test.sh
index 91ea56e..d04f36a 100755
--- a/php/tests/test.sh
+++ b/php/tests/test.sh
@@ -11,9 +11,11 @@
 
 # Each version of PHPUnit supports a fairly narrow range of PHP versions.
 case "$PHP_VERSION" in
-  7.0.*|7.1.*|7.2.*)
-    # Oddly older than for 5.6. Not sure the reason.
-    PHPUNIT=phpunit-5.6.0.phar
+  7.0.*)
+    PHPUNIT=phpunit-6.phar
+    ;;
+  7.1.*|7.2.*)
+    PHPUNIT=phpunit-7.5.0.phar
     ;;
   7.3.*|7.4.*)
     PHPUNIT=phpunit-8.phar
diff --git a/php/tests/test_base.php b/php/tests/test_base.php
index a4d951b..db884a8 100644
--- a/php/tests/test_base.php
+++ b/php/tests/test_base.php
@@ -12,6 +12,30 @@
         TestUtil::setTestMessage($m);
     }
 
+    /**
+     * Polyfill for phpunit6.
+     */
+    static public function assertStringContains($needle, $haystack)
+    {
+        if (function_exists('PHPUnit\Framework\assertStringContainsString')) {
+            parent::assertStringContainsString($needle, $haystack);
+        } else {
+            parent::assertContains($needle, $haystack);
+        }
+    }
+
+    /**
+     * Polyfill for phpunit6.
+     */
+    static public function assertFloatEquals($expected, $actual, $delta)
+    {
+        if (function_exists('PHPUnit\Framework\assertEqualsWithDelta')) {
+            parent::assertEqualsWithDelta($expected, $actual, $delta);
+        } else {
+            parent::assertEquals($expected, $actual, '', $delta);
+        }
+    }
+
     public function setFields2(TestMessage $m)
     {
         TestUtil::setTestMessage2($m);