Skip to content

Commit

Permalink
3.25.3 sync
Browse files Browse the repository at this point in the history
  • Loading branch information
protobuf-team-bot committed Feb 15, 2024
1 parent ef037c4 commit 983a87f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 70 deletions.
4 changes: 0 additions & 4 deletions src/Google/Protobuf/Internal/GPBUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,6 @@ public static function parseTimestamp($timestamp)
$nanoseconds = substr($timestamp, $periodIndex + 1, $nanosecondsLength);
$nanoseconds = intval($nanoseconds);

if ($nanosecondsLength < 9) {
$nanoseconds = $nanoseconds * pow(10, 9 - $nanosecondsLength);
}

// remove the nanoseconds and preceding period from the timestamp
$date = substr($timestamp, 0, $periodIndex);
$timezone = substr($timestamp, $periodIndex + $nanosecondsLength + 1);
Expand Down
54 changes: 1 addition & 53 deletions src/Google/Protobuf/Internal/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ public function parseFromJsonStream($input, $ignore_unknown)
try {
$this->mergeFromJsonArray($array, $ignore_unknown);
} catch (\Exception $e) {
throw new GPBDecodeException($e->getMessage(), $e->getCode(), $e);
throw new GPBDecodeException($e->getMessage());
}
}

Expand Down Expand Up @@ -2014,56 +2014,4 @@ public function jsonByteSize()
}
return $size;
}

public function __debugInfo()
{
if (is_a($this, 'Google\Protobuf\FieldMask')) {
return ['paths' => $this->getPaths()->__debugInfo()];
}

if (is_a($this, 'Google\Protobuf\Value')) {
switch ($this->getKind()) {
case 'null_value':
return ['nullValue' => $this->getNullValue()];
case 'number_value':
return ['numberValue' => $this->getNumberValue()];
case 'string_value':
return ['stringValue' => $this->getStringValue()];
case 'bool_value':
return ['boolValue' => $this->getBoolValue()];
case 'struct_value':
return ['structValue' => $this->getStructValue()->__debugInfo()];
case 'list_value':
return ['listValue' => $this->getListValue()->__debugInfo()];
}
return [];
}

if (is_a($this, 'Google\Protobuf\BoolValue')
|| is_a($this, 'Google\Protobuf\BytesValue')
|| is_a($this, 'Google\Protobuf\DoubleValue')
|| is_a($this, 'Google\Protobuf\FloatValue')
|| is_a($this, 'Google\Protobuf\StringValue')
|| is_a($this, 'Google\Protobuf\Int32Value')
|| is_a($this, 'Google\Protobuf\Int64Value')
|| is_a($this, 'Google\Protobuf\UInt32Value')
|| is_a($this, 'Google\Protobuf\UInt64Value')
) {
return [
'value' => json_decode($this->serializeToJsonString(), true),
];
}

if (
is_a($this, 'Google\Protobuf\Duration')
|| is_a($this, 'Google\Protobuf\Timestamp')
) {
return [
'seconds' => $this->getSeconds(),
'nanos' => $this->getNanos(),
];
}

return json_decode($this->serializeToJsonString(), true);
}
}
13 changes: 0 additions & 13 deletions src/Google/Protobuf/Internal/RepeatedField.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,4 @@ public function count(): int
{
return count($this->container);
}

public function __debugInfo()
{
return array_map(
function ($item) {
if ($item instanceof Message || $item instanceof RepeatedField) {
return $item->__debugInfo();
}
return $item;
},
iterator_to_array($this)
);
}
}

0 comments on commit 983a87f

Please sign in to comment.