File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -102,8 +102,12 @@ private static function serializeToJsonString(Message $message): string
102
102
{
103
103
// @phan-suppress-next-line PhanUndeclaredClassReference
104
104
if (\class_exists (\Google \Protobuf \PrintOptions::class)) {
105
- /** @psalm-suppress TooManyArguments @phan-suppress-next-line PhanParamTooManyInternal,PhanUndeclaredClassConstant @phpstan-ignore arguments.count */
106
- return $ message ->serializeToJsonString (\Google \Protobuf \PrintOptions::ALWAYS_PRINT_ENUMS_AS_INTS );
105
+ try {
106
+ /** @psalm-suppress TooManyArguments @phan-suppress-next-line PhanParamTooManyInternal,PhanUndeclaredClassConstant @phpstan-ignore arguments.count */
107
+ return $ message ->serializeToJsonString (\Google \Protobuf \PrintOptions::ALWAYS_PRINT_ENUMS_AS_INTS );
108
+ } catch (\TypeError ) {
109
+ // google/protobuf ^4.31 w/ ext-protobuf <4.31 installed
110
+ }
107
111
}
108
112
109
113
$ payload = $ message ->serializeToJsonString ();
You can’t perform that action at this time.
0 commit comments