diff --git a/modules/swagger-codegen/src/main/resources/php/ApiException.mustache b/modules/swagger-codegen/src/main/resources/php/ApiException.mustache index 3df0f467fc02..31dc76fe3fbc 100644 --- a/modules/swagger-codegen/src/main/resources/php/ApiException.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ApiException.mustache @@ -55,12 +55,12 @@ class ApiException extends Exception /** * Constructor * - * @param string $message Error message - * @param int $code HTTP status code - * @param string $responseHeaders HTTP response header - * @param mixed $responseBody HTTP body of the server response either as Json or string + * @param string $message Error message + * @param int $code HTTP status code + * @param string[] $responseHeaders HTTP response header + * @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string */ - public function __construct($message = "", $code = 0, $responseHeaders = null, $responseBody = null) + public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) { parent::__construct($message, $code); $this->responseHeaders = $responseHeaders; @@ -70,7 +70,7 @@ class ApiException extends Exception /** * Gets the HTTP response header * - * @return string HTTP response header + * @return string[] HTTP response headers */ public function getResponseHeaders() { @@ -80,7 +80,7 @@ class ApiException extends Exception /** * Gets the HTTP body of the server response either as Json or string * - * @return mixed HTTP body of the server response either as Json or string + * @return mixed HTTP body of the server response either as \stdClass or string */ public function getResponseBody() { diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiException.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiException.php index 4c029f982aef..6bc8c02024d9 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiException.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/ApiException.php @@ -65,12 +65,12 @@ class ApiException extends Exception /** * Constructor * - * @param string $message Error message - * @param int $code HTTP status code - * @param string $responseHeaders HTTP response header - * @param mixed $responseBody HTTP body of the server response either as Json or string + * @param string $message Error message + * @param int $code HTTP status code + * @param string[] $responseHeaders HTTP response header + * @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string */ - public function __construct($message = "", $code = 0, $responseHeaders = null, $responseBody = null) + public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) { parent::__construct($message, $code); $this->responseHeaders = $responseHeaders; @@ -80,7 +80,7 @@ class ApiException extends Exception /** * Gets the HTTP response header * - * @return string HTTP response header + * @return string[] HTTP response headers */ public function getResponseHeaders() { @@ -90,7 +90,7 @@ class ApiException extends Exception /** * Gets the HTTP body of the server response either as Json or string * - * @return mixed HTTP body of the server response either as Json or string + * @return mixed HTTP body of the server response either as \stdClass or string */ public function getResponseBody() { diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ApiException.php b/samples/client/petstore/php/SwaggerClient-php/lib/ApiException.php index 8fa9056dbabb..2c1a040490b5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ApiException.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ApiException.php @@ -65,12 +65,12 @@ class ApiException extends Exception /** * Constructor * - * @param string $message Error message - * @param int $code HTTP status code - * @param string $responseHeaders HTTP response header - * @param mixed $responseBody HTTP body of the server response either as Json or string + * @param string $message Error message + * @param int $code HTTP status code + * @param string[] $responseHeaders HTTP response header + * @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string */ - public function __construct($message = "", $code = 0, $responseHeaders = null, $responseBody = null) + public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) { parent::__construct($message, $code); $this->responseHeaders = $responseHeaders; @@ -80,7 +80,7 @@ class ApiException extends Exception /** * Gets the HTTP response header * - * @return string HTTP response header + * @return string[] HTTP response headers */ public function getResponseHeaders() { @@ -90,7 +90,7 @@ class ApiException extends Exception /** * Gets the HTTP body of the server response either as Json or string * - * @return mixed HTTP body of the server response either as Json or string + * @return mixed HTTP body of the server response either as \stdClass or string */ public function getResponseBody() { diff --git a/samples/client/petstore/php/test.php b/samples/client/petstore/php/test.php index 6f571a1c1769..5c27e3d7ae99 100644 --- a/samples/client/petstore/php/test.php +++ b/samples/client/petstore/php/test.php @@ -55,7 +55,7 @@ try { } catch (Swagger\Client\ApiException $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; - echo 'HTTP response headers: ', $e->getResponseHeaders(), "\n"; - echo 'HTTP response body: ', $e->getResponseBody(), "\n"; + echo 'HTTP response headers: ', print_r($e->getResponseHeaders(), true), "\n"; + echo 'HTTP response body: ', print_r($e->getResponseBody(), true), "\n"; echo 'HTTP status code: ', $e->getCode(), "\n"; }