Skip to content

Commit

Permalink
Bump patch version to 5.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jlevers committed Jun 5, 2023
1 parent abf5bbb commit e46136c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jlevers/selling-partner-api",
"version": "5.8.3",
"version": "5.8.4",
"description": "PHP client for Amazon's Selling Partner API",
"keywords": [
"api",
Expand Down
4 changes: 2 additions & 2 deletions lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Configuration
*
* @var string
*/
protected $userAgent = 'jlevers/selling-partner-api/5.8.3 (Language=PHP)';
protected $userAgent = 'jlevers/selling-partner-api/5.8.4 (Language=PHP)';

/**
* Debug switch (default set to false)
Expand Down Expand Up @@ -429,7 +429,7 @@ public static function toDebugReport(?string $tempFolderPath = null)
$report .= ' OS: ' . php_uname() . PHP_EOL;
$report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
$report .= ' The version of the OpenAPI document: 2020-11-01' . PHP_EOL;
$report .= ' SDK Package Version: 5.8.3' . PHP_EOL;
$report .= ' SDK Package Version: 5.8.4' . PHP_EOL;
$report .= ' Temp Folder Path: ' . $tempFolderPath . PHP_EOL;

return $report;
Expand Down
17 changes: 9 additions & 8 deletions lib/ObjectSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

namespace SellingPartnerApi;

use DateTime;
use SellingPartnerApi\Model\ModelInterface;

/**
Expand All @@ -27,7 +28,7 @@
class ObjectSerializer
{
/** @var string */
private static $dateTimeFormat = \DateTime::ATOM;
private static $dateTimeFormat = DateTime::ATOM;

/**
* Change the date format
Expand All @@ -54,7 +55,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n
return $data;
}

if ($data instanceof \DateTime) {
if ($data instanceof DateTime) {
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat);
}

Expand Down Expand Up @@ -138,7 +139,7 @@ public static function toPathValue($value, $isPath = false)
* If it's a string, pass through unchanged. It will be url-encoded
* later.
*
* @param string[]|string|\DateTime $object an object to be serialized to a string
* @param string[]|string|DateTime $object an object to be serialized to a string
*
* @return string the serialized object
*/
Expand Down Expand Up @@ -194,13 +195,13 @@ public static function toFormValue($value)
* If it's a datetime object, format it in ISO8601
* If it's a boolean, convert it to "true" or "false".
*
* @param string|bool|\DateTime $value the value of the parameter
* @param string|bool|DateTime $value the value of the parameter
*
* @return string the header string
*/
public static function toString($value)
{
if ($value instanceof \DateTime) { // datetime in ISO8601 format
if ($value instanceof DateTime) { // datetime in ISO8601 format
return $value->format(self::$dateTimeFormat);
} elseif (is_bool($value)) {
return $value ? 'true' : 'false';
Expand Down Expand Up @@ -297,7 +298,7 @@ public static function deserialize($data, $class, $httpHeaders = null)
return $data;
}

if ($class === '\DateTime') {
if ($class === '\DateTime') {
// Some API's return an invalid, empty string as a
// date-time property. DateTime::__construct() will return
// the current time for empty input which is probably not
Expand All @@ -306,13 +307,13 @@ public static function deserialize($data, $class, $httpHeaders = null)
// this graceful.
if (!empty($data)) {
try {
return new \DateTime($data);
return new DateTime($data);
} catch (\Exception $exception) {
// Some API's return a date-time with too high nanosecond
// precision for php's DateTime to handle. This conversion
// (string -> unix timestamp -> DateTime) is a workaround
// for the problem.
return (new \DateTime())->setTimestamp(strtotime($data));
return (new DateTime())->setTimestamp(strtotime($data));
}
} else {
return null;
Expand Down

0 comments on commit e46136c

Please sign in to comment.