diff --git a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache index 3ab026909ec..526665f2717 100644 --- a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache @@ -165,8 +165,9 @@ class ObjectSerializer * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". * - * @param string|\DateTime $value the value of the parameter + * @param string|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -174,6 +175,8 @@ class ObjectSerializer { if ($value instanceof \DateTime) { // datetime in ISO8601 format return $value->format(\DateTime::ATOM); + } else if (is_bool($value)) { + return $value ? 'true' : 'false'; } else { return $value; } diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index d8bff1321ac..e62da54b988 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -175,8 +175,9 @@ class ObjectSerializer * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". * - * @param string|\DateTime $value the value of the parameter + * @param string|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -184,6 +185,8 @@ class ObjectSerializer { if ($value instanceof \DateTime) { // datetime in ISO8601 format return $value->format(\DateTime::ATOM); + } else if (is_bool($value)) { + return $value ? 'true' : 'false'; } else { return $value; } diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index d8bff1321ac..e62da54b988 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -175,8 +175,9 @@ class ObjectSerializer * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". * - * @param string|\DateTime $value the value of the parameter + * @param string|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -184,6 +185,8 @@ class ObjectSerializer { if ($value instanceof \DateTime) { // datetime in ISO8601 format return $value->format(\DateTime::ATOM); + } else if (is_bool($value)) { + return $value ? 'true' : 'false'; } else { return $value; }