diff --git a/modules/openapi-generator/src/main/resources/php/.travis.yml b/modules/openapi-generator/src/main/resources/php/.travis.yml index cf85d27981a..b4b1d0a6b5a 100644 --- a/modules/openapi-generator/src/main/resources/php/.travis.yml +++ b/modules/openapi-generator/src/main/resources/php/.travis.yml @@ -1,6 +1,10 @@ language: php +# Bionic environment has preinstalled PHP from 7.1 to 7.4 +# https://docs.travis-ci.com/user/reference/bionic/#php-support +dist: bionic php: - - 7.1 - 7.2 + - 7.3 + - 7.4 before_install: "composer install" script: "vendor/bin/phpunit" diff --git a/modules/openapi-generator/src/main/resources/php/ApiException.mustache b/modules/openapi-generator/src/main/resources/php/ApiException.mustache index 68020161c2f..185be1a0a0a 100644 --- a/modules/openapi-generator/src/main/resources/php/ApiException.mustache +++ b/modules/openapi-generator/src/main/resources/php/ApiException.mustache @@ -1,7 +1,7 @@ "{{{url}}}", - "description" => "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - "variables" => array( - {{/-first}} - "{{{name}}}" => array( - "description" => "{{{description}}}{{^description}}No description provided{{/description}}", - "default_value" => "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - "enum_values" => array( - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ) - {{/-last}} - {{/enumValues}} - ){{^-last}},{{/-last}} - {{#-last}} - ) - {{/-last}} - {{/variables}} - ){{^-last}},{{/-last}} + [ + "url" => "{{{url}}}", + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + "variables" => [ + {{/-first}} + "{{{name}}}" => [ + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + "default_value" => "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + "enum_values" => [ + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/enumValues}} + ]{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/variables}} + ]{{^-last}},{{/-last}} {{/servers}} - ); + ]; } /** @@ -468,7 +468,7 @@ class Configuration public function getHostFromSettings($index, $variables = null) { if (null === $variables) { - $variables = array(); + $variables = []; } $hosts = $this->getHostSettings(); @@ -484,7 +484,7 @@ class Configuration // go through variable and assign a value foreach ($host["variables"] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (in_array($variables[$name], $variable["enum_values"])) { // check to see if the value is in the enum + if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); diff --git a/modules/openapi-generator/src/main/resources/php/HeaderSelector.mustache b/modules/openapi-generator/src/main/resources/php/HeaderSelector.mustache index baa2cb00bf7..2fdc0ab204f 100644 --- a/modules/openapi-generator/src/main/resources/php/HeaderSelector.mustache +++ b/modules/openapi-generator/src/main/resources/php/HeaderSelector.mustache @@ -1,7 +1,7 @@ format(self::$dateTimeFormat); - } else if (is_bool($value)) { + } elseif (is_bool($value)) { return $value ? 'true' : 'false'; } else { return $value; diff --git a/modules/openapi-generator/src/main/resources/php/README.mustache b/modules/openapi-generator/src/main/resources/php/README.mustache index 565eddfdd33..2bb063c5396 100644 --- a/modules/openapi-generator/src/main/resources/php/README.mustache +++ b/modules/openapi-generator/src/main/resources/php/README.mustache @@ -20,7 +20,7 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) ## Requirements -PHP 7.1 and later +PHP 7.2 and later ## Installation & Usage diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 86843bfc5f2..1f83befded2 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -1,7 +1,7 @@ =7.1", + "php": ">=7.2", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", "guzzlehttp/guzzle": "^6.2" }, "require-dev": { - "phpunit/phpunit": "^7.4", + "phpunit/phpunit": "^8.0 || ^9.0", "friendsofphp/php-cs-fixer": "^2.12" }, "autoload": { diff --git a/modules/openapi-generator/src/main/resources/php/gitignore b/modules/openapi-generator/src/main/resources/php/gitignore index edcf63f6aee..e2316dd486c 100644 --- a/modules/openapi-generator/src/main/resources/php/gitignore +++ b/modules/openapi-generator/src/main/resources/php/gitignore @@ -5,4 +5,10 @@ composer.phar # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file -composer.lock \ No newline at end of file +composer.lock + +# php-cs-fixer cache +.php_cs.cache + +# PHPUnit cache +.phpunit.result.cache diff --git a/modules/openapi-generator/src/main/resources/php/model.mustache b/modules/openapi-generator/src/main/resources/php/model.mustache index 7515deb6287..45157dd0520 100644 --- a/modules/openapi-generator/src/main/resources/php/model.mustache +++ b/modules/openapi-generator/src/main/resources/php/model.mustache @@ -4,7 +4,7 @@ /** * {{classname}} * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package {{invokerPackage}} diff --git a/modules/openapi-generator/src/main/resources/php/model_test.mustache b/modules/openapi-generator/src/main/resources/php/model_test.mustache index eb34ea8f9a7..848a24b5492 100644 --- a/modules/openapi-generator/src/main/resources/php/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/php/model_test.mustache @@ -4,7 +4,7 @@ /** * {{classname}}Test * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package {{invokerPackage}} @@ -38,28 +38,28 @@ class {{classname}}Test extends TestCase /** * Setup before running any test case */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { } /** * Setup before running each test case */ - public function setUp() + public function setUp(): void { } /** * Clean up after running each test case */ - public function tearDown() + public function tearDown(): void { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { } diff --git a/samples/client/petstore/php/OpenAPIClient-php/.gitignore b/samples/client/petstore/php/OpenAPIClient-php/.gitignore index edcf63f6aee..e2316dd486c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/.gitignore +++ b/samples/client/petstore/php/OpenAPIClient-php/.gitignore @@ -5,4 +5,10 @@ composer.phar # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file -composer.lock \ No newline at end of file +composer.lock + +# php-cs-fixer cache +.php_cs.cache + +# PHPUnit cache +.phpunit.result.cache diff --git a/samples/client/petstore/php/OpenAPIClient-php/.travis.yml b/samples/client/petstore/php/OpenAPIClient-php/.travis.yml index cf85d27981a..b4b1d0a6b5a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/.travis.yml +++ b/samples/client/petstore/php/OpenAPIClient-php/.travis.yml @@ -1,6 +1,10 @@ language: php +# Bionic environment has preinstalled PHP from 7.1 to 7.4 +# https://docs.travis-ci.com/user/reference/bionic/#php-support +dist: bionic php: - - 7.1 - 7.2 + - 7.3 + - 7.4 before_install: "composer install" script: "vendor/bin/phpunit" diff --git a/samples/client/petstore/php/OpenAPIClient-php/README.md b/samples/client/petstore/php/OpenAPIClient-php/README.md index 6577b1eeb36..123ca01e5bd 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/README.md +++ b/samples/client/petstore/php/OpenAPIClient-php/README.md @@ -9,7 +9,7 @@ This PHP package is automatically generated by the [OpenAPI Generator](https://o ## Requirements -PHP 7.1 and later +PHP 7.2 and later ## Installation & Usage diff --git a/samples/client/petstore/php/OpenAPIClient-php/composer.json b/samples/client/petstore/php/OpenAPIClient-php/composer.json index 4ca57f24d54..823e9f92a7b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/composer.json +++ b/samples/client/petstore/php/OpenAPIClient-php/composer.json @@ -19,14 +19,14 @@ } ], "require": { - "php": ">=7.1", + "php": ">=7.2", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", "guzzlehttp/guzzle": "^6.2" }, "require-dev": { - "phpunit/phpunit": "^7.4", + "phpunit/phpunit": "^8.0 || ^9.0", "friendsofphp/php-cs-fixer": "^2.12" }, "autoload": { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index 044d9f2b627..2902a8e1c9f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -1,7 +1,7 @@ client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation fooGet - * - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \OpenAPI\Client\Model\InlineResponseDefault - */ - public function fooGet() - { - list($response) = $this->fooGetWithHttpInfo(); - return $response; - } - - /** - * Operation fooGetWithHttpInfo - * - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\InlineResponseDefault, HTTP status code, HTTP response headers (array of strings) - */ - public function fooGetWithHttpInfo() - { - $request = $this->fooGetRequest(); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - - $responseBody = $response->getBody(); - switch($statusCode) { - default: - if ('\OpenAPI\Client\Model\InlineResponseDefault' === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - } - - return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\InlineResponseDefault', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\OpenAPI\Client\Model\InlineResponseDefault'; - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\OpenAPI\Client\Model\InlineResponseDefault', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation fooGetAsync - * - * - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fooGetAsync() - { - return $this->fooGetAsyncWithHttpInfo() - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation fooGetAsyncWithHttpInfo - * - * - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fooGetAsyncWithHttpInfo() - { - $returnType = '\OpenAPI\Client\Model\InlineResponseDefault'; - $request = $this->fooGetRequest(); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'fooGet' - * - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - protected function fooGetRequest() - { - - $resourcePath = '/foo'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // body params - $_tempBody = null; - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } - - // for model (json/xml) - if (isset($_tempBody)) { - // $_tempBody is the method argument, if present - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); - } else { - $httpBody = $_tempBody; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValue - ]; - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - - } else { - // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); - } - } - - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $query = \GuzzleHttp\Psr7\build_query($queryParams); - return new Request( - 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 50f5ecbf57d..8970a606e0a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -1,7 +1,7 @@ "http://petstore.swagger.io:80/v2", - "description" => "No description provided", - ) - ); + return [ + [ + "url" => "http://petstore.swagger.io:80/v2", + "description" => "No description provided", + ] + ]; } /** @@ -452,7 +452,7 @@ class Configuration public function getHostFromSettings($index, $variables = null) { if (null === $variables) { - $variables = array(); + $variables = []; } $hosts = $this->getHostSettings(); @@ -468,7 +468,7 @@ class Configuration // go through variable and assign a value foreach ($host["variables"] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (in_array($variables[$name], $variable["enum_values"])) { // check to see if the value is in the enum + if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php b/samples/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php index d5fec659084..25a92414028 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php @@ -1,7 +1,7 @@ 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPIFormats = [ - 'bar' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'bar' => 'bar' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'bar' => 'setBar' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'bar' => 'getBar' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['bar'] = isset($data['bar']) ? $data['bar'] : 'bar'; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets bar - * - * @return string|null - */ - public function getBar() - { - return $this->container['bar']; - } - - /** - * Sets bar - * - * @param string|null $bar bar - * - * @return $this - */ - public function setBar($bar) - { - $this->container['bar'] = $bar; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } -} - - diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php index 63c48102cab..a2203455b32 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php @@ -2,7 +2,7 @@ /** * FormatTest * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php index 6c7bf0aed69..40a8e5584fc 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php @@ -2,7 +2,7 @@ /** * HasOnlyReadOnly * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php deleted file mode 100644 index 3a9aa432007..00000000000 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php +++ /dev/null @@ -1,327 +0,0 @@ - 'string', - 'status' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPIFormats = [ - 'name' => null, - 'status' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'status' => 'status' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'status' => 'setStatus' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'status' => 'getStatus' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string|null - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string|null $name Updated name of the pet - * - * @return $this - */ - public function setName($name) - { - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets status - * - * @return string|null - */ - public function getStatus() - { - return $this->container['status']; - } - - /** - * Sets status - * - * @param string|null $status Updated status of the pet - * - * @return $this - */ - public function setStatus($status) - { - $this->container['status'] = $status; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } -} - - diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php deleted file mode 100644 index 0da191b5833..00000000000 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php +++ /dev/null @@ -1,327 +0,0 @@ - 'string', - 'file' => '\SplFileObject' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPIFormats = [ - 'additional_metadata' => null, - 'file' => 'binary' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'additional_metadata' => 'additionalMetadata', - 'file' => 'file' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'additional_metadata' => 'setAdditionalMetadata', - 'file' => 'setFile' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'additional_metadata' => 'getAdditionalMetadata', - 'file' => 'getFile' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['additional_metadata'] = isset($data['additional_metadata']) ? $data['additional_metadata'] : null; - $this->container['file'] = isset($data['file']) ? $data['file'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets additional_metadata - * - * @return string|null - */ - public function getAdditionalMetadata() - { - return $this->container['additional_metadata']; - } - - /** - * Sets additional_metadata - * - * @param string|null $additional_metadata Additional data to pass to server - * - * @return $this - */ - public function setAdditionalMetadata($additional_metadata) - { - $this->container['additional_metadata'] = $additional_metadata; - - return $this; - } - - /** - * Gets file - * - * @return \SplFileObject|null - */ - public function getFile() - { - return $this->container['file']; - } - - /** - * Sets file - * - * @param \SplFileObject|null $file file to upload - * - * @return $this - */ - public function setFile($file) - { - $this->container['file'] = $file; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } -} - - diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php deleted file mode 100644 index 80280518693..00000000000 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php +++ /dev/null @@ -1,385 +0,0 @@ - 'string[]', - 'enum_form_string' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPIFormats = [ - 'enum_form_string_array' => null, - 'enum_form_string' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'enum_form_string_array' => 'enum_form_string_array', - 'enum_form_string' => 'enum_form_string' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'enum_form_string_array' => 'setEnumFormStringArray', - 'enum_form_string' => 'setEnumFormString' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'enum_form_string_array' => 'getEnumFormStringArray', - 'enum_form_string' => 'getEnumFormString' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - const ENUM_FORM_STRING_ARRAY_GREATER_THAN = '>'; - const ENUM_FORM_STRING_ARRAY_DOLLAR = '$'; - const ENUM_FORM_STRING_ABC = '_abc'; - const ENUM_FORM_STRING_EFG = '-efg'; - const ENUM_FORM_STRING_XYZ = '(xyz)'; - - - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getEnumFormStringArrayAllowableValues() - { - return [ - self::ENUM_FORM_STRING_ARRAY_GREATER_THAN, - self::ENUM_FORM_STRING_ARRAY_DOLLAR, - ]; - } - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getEnumFormStringAllowableValues() - { - return [ - self::ENUM_FORM_STRING_ABC, - self::ENUM_FORM_STRING_EFG, - self::ENUM_FORM_STRING_XYZ, - ]; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['enum_form_string_array'] = isset($data['enum_form_string_array']) ? $data['enum_form_string_array'] : null; - $this->container['enum_form_string'] = isset($data['enum_form_string']) ? $data['enum_form_string'] : '-efg'; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getEnumFormStringAllowableValues(); - if (!is_null($this->container['enum_form_string']) && !in_array($this->container['enum_form_string'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value for 'enum_form_string', must be one of '%s'", - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets enum_form_string_array - * - * @return string[]|null - */ - public function getEnumFormStringArray() - { - return $this->container['enum_form_string_array']; - } - - /** - * Sets enum_form_string_array - * - * @param string[]|null $enum_form_string_array Form parameter enum test (string array) - * - * @return $this - */ - public function setEnumFormStringArray($enum_form_string_array) - { - $allowedValues = $this->getEnumFormStringArrayAllowableValues(); - if (!is_null($enum_form_string_array) && array_diff($enum_form_string_array, $allowedValues)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'enum_form_string_array', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['enum_form_string_array'] = $enum_form_string_array; - - return $this; - } - - /** - * Gets enum_form_string - * - * @return string|null - */ - public function getEnumFormString() - { - return $this->container['enum_form_string']; - } - - /** - * Sets enum_form_string - * - * @param string|null $enum_form_string Form parameter enum test (string) - * - * @return $this - */ - public function setEnumFormString($enum_form_string) - { - $allowedValues = $this->getEnumFormStringAllowableValues(); - if (!is_null($enum_form_string) && !in_array($enum_form_string, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value for 'enum_form_string', must be one of '%s'", - implode("', '", $allowedValues) - ) - ); - } - $this->container['enum_form_string'] = $enum_form_string; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } -} - - diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php deleted file mode 100644 index b6c4e18fbf3..00000000000 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php +++ /dev/null @@ -1,805 +0,0 @@ - 'int', - 'int32' => 'int', - 'int64' => 'int', - 'number' => 'float', - 'float' => 'float', - 'double' => 'double', - 'string' => 'string', - 'pattern_without_delimiter' => 'string', - 'byte' => 'string', - 'binary' => '\SplFileObject', - 'date' => '\DateTime', - 'date_time' => '\DateTime', - 'password' => 'string', - 'callback' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPIFormats = [ - 'integer' => 'int32', - 'int32' => 'int32', - 'int64' => 'int64', - 'number' => null, - 'float' => 'float', - 'double' => 'double', - 'string' => null, - 'pattern_without_delimiter' => null, - 'byte' => 'byte', - 'binary' => 'binary', - 'date' => 'date', - 'date_time' => 'date-time', - 'password' => 'password', - 'callback' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'integer' => 'integer', - 'int32' => 'int32', - 'int64' => 'int64', - 'number' => 'number', - 'float' => 'float', - 'double' => 'double', - 'string' => 'string', - 'pattern_without_delimiter' => 'pattern_without_delimiter', - 'byte' => 'byte', - 'binary' => 'binary', - 'date' => 'date', - 'date_time' => 'dateTime', - 'password' => 'password', - 'callback' => 'callback' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'integer' => 'setInteger', - 'int32' => 'setInt32', - 'int64' => 'setInt64', - 'number' => 'setNumber', - 'float' => 'setFloat', - 'double' => 'setDouble', - 'string' => 'setString', - 'pattern_without_delimiter' => 'setPatternWithoutDelimiter', - 'byte' => 'setByte', - 'binary' => 'setBinary', - 'date' => 'setDate', - 'date_time' => 'setDateTime', - 'password' => 'setPassword', - 'callback' => 'setCallback' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'integer' => 'getInteger', - 'int32' => 'getInt32', - 'int64' => 'getInt64', - 'number' => 'getNumber', - 'float' => 'getFloat', - 'double' => 'getDouble', - 'string' => 'getString', - 'pattern_without_delimiter' => 'getPatternWithoutDelimiter', - 'byte' => 'getByte', - 'binary' => 'getBinary', - 'date' => 'getDate', - 'date_time' => 'getDateTime', - 'password' => 'getPassword', - 'callback' => 'getCallback' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['integer'] = isset($data['integer']) ? $data['integer'] : null; - $this->container['int32'] = isset($data['int32']) ? $data['int32'] : null; - $this->container['int64'] = isset($data['int64']) ? $data['int64'] : null; - $this->container['number'] = isset($data['number']) ? $data['number'] : null; - $this->container['float'] = isset($data['float']) ? $data['float'] : null; - $this->container['double'] = isset($data['double']) ? $data['double'] : null; - $this->container['string'] = isset($data['string']) ? $data['string'] : null; - $this->container['pattern_without_delimiter'] = isset($data['pattern_without_delimiter']) ? $data['pattern_without_delimiter'] : null; - $this->container['byte'] = isset($data['byte']) ? $data['byte'] : null; - $this->container['binary'] = isset($data['binary']) ? $data['binary'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['callback'] = isset($data['callback']) ? $data['callback'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if (!is_null($this->container['integer']) && ($this->container['integer'] > 100)) { - $invalidProperties[] = "invalid value for 'integer', must be smaller than or equal to 100."; - } - - if (!is_null($this->container['integer']) && ($this->container['integer'] < 10)) { - $invalidProperties[] = "invalid value for 'integer', must be bigger than or equal to 10."; - } - - if (!is_null($this->container['int32']) && ($this->container['int32'] > 200)) { - $invalidProperties[] = "invalid value for 'int32', must be smaller than or equal to 200."; - } - - if (!is_null($this->container['int32']) && ($this->container['int32'] < 20)) { - $invalidProperties[] = "invalid value for 'int32', must be bigger than or equal to 20."; - } - - if ($this->container['number'] === null) { - $invalidProperties[] = "'number' can't be null"; - } - if (($this->container['number'] > 543.2)) { - $invalidProperties[] = "invalid value for 'number', must be smaller than or equal to 543.2."; - } - - if (($this->container['number'] < 32.1)) { - $invalidProperties[] = "invalid value for 'number', must be bigger than or equal to 32.1."; - } - - if (!is_null($this->container['float']) && ($this->container['float'] > 987.6)) { - $invalidProperties[] = "invalid value for 'float', must be smaller than or equal to 987.6."; - } - - if ($this->container['double'] === null) { - $invalidProperties[] = "'double' can't be null"; - } - if (($this->container['double'] > 123.4)) { - $invalidProperties[] = "invalid value for 'double', must be smaller than or equal to 123.4."; - } - - if (($this->container['double'] < 67.8)) { - $invalidProperties[] = "invalid value for 'double', must be bigger than or equal to 67.8."; - } - - if (!is_null($this->container['string']) && !preg_match("/[a-z]/i", $this->container['string'])) { - $invalidProperties[] = "invalid value for 'string', must be conform to the pattern /[a-z]/i."; - } - - if ($this->container['pattern_without_delimiter'] === null) { - $invalidProperties[] = "'pattern_without_delimiter' can't be null"; - } - if (!preg_match("/^[A-Z].*/", $this->container['pattern_without_delimiter'])) { - $invalidProperties[] = "invalid value for 'pattern_without_delimiter', must be conform to the pattern /^[A-Z].*/."; - } - - if ($this->container['byte'] === null) { - $invalidProperties[] = "'byte' can't be null"; - } - if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) > 64)) { - $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 64."; - } - - if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) < 10)) { - $invalidProperties[] = "invalid value for 'password', the character length must be bigger than or equal to 10."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets integer - * - * @return int|null - */ - public function getInteger() - { - return $this->container['integer']; - } - - /** - * Sets integer - * - * @param int|null $integer None - * - * @return $this - */ - public function setInteger($integer) - { - - if (!is_null($integer) && ($integer > 100)) { - throw new \InvalidArgumentException('invalid value for $integer when calling InlineObject3., must be smaller than or equal to 100.'); - } - if (!is_null($integer) && ($integer < 10)) { - throw new \InvalidArgumentException('invalid value for $integer when calling InlineObject3., must be bigger than or equal to 10.'); - } - - $this->container['integer'] = $integer; - - return $this; - } - - /** - * Gets int32 - * - * @return int|null - */ - public function getInt32() - { - return $this->container['int32']; - } - - /** - * Sets int32 - * - * @param int|null $int32 None - * - * @return $this - */ - public function setInt32($int32) - { - - if (!is_null($int32) && ($int32 > 200)) { - throw new \InvalidArgumentException('invalid value for $int32 when calling InlineObject3., must be smaller than or equal to 200.'); - } - if (!is_null($int32) && ($int32 < 20)) { - throw new \InvalidArgumentException('invalid value for $int32 when calling InlineObject3., must be bigger than or equal to 20.'); - } - - $this->container['int32'] = $int32; - - return $this; - } - - /** - * Gets int64 - * - * @return int|null - */ - public function getInt64() - { - return $this->container['int64']; - } - - /** - * Sets int64 - * - * @param int|null $int64 None - * - * @return $this - */ - public function setInt64($int64) - { - $this->container['int64'] = $int64; - - return $this; - } - - /** - * Gets number - * - * @return float - */ - public function getNumber() - { - return $this->container['number']; - } - - /** - * Sets number - * - * @param float $number None - * - * @return $this - */ - public function setNumber($number) - { - - if (($number > 543.2)) { - throw new \InvalidArgumentException('invalid value for $number when calling InlineObject3., must be smaller than or equal to 543.2.'); - } - if (($number < 32.1)) { - throw new \InvalidArgumentException('invalid value for $number when calling InlineObject3., must be bigger than or equal to 32.1.'); - } - - $this->container['number'] = $number; - - return $this; - } - - /** - * Gets float - * - * @return float|null - */ - public function getFloat() - { - return $this->container['float']; - } - - /** - * Sets float - * - * @param float|null $float None - * - * @return $this - */ - public function setFloat($float) - { - - if (!is_null($float) && ($float > 987.6)) { - throw new \InvalidArgumentException('invalid value for $float when calling InlineObject3., must be smaller than or equal to 987.6.'); - } - - $this->container['float'] = $float; - - return $this; - } - - /** - * Gets double - * - * @return double - */ - public function getDouble() - { - return $this->container['double']; - } - - /** - * Sets double - * - * @param double $double None - * - * @return $this - */ - public function setDouble($double) - { - - if (($double > 123.4)) { - throw new \InvalidArgumentException('invalid value for $double when calling InlineObject3., must be smaller than or equal to 123.4.'); - } - if (($double < 67.8)) { - throw new \InvalidArgumentException('invalid value for $double when calling InlineObject3., must be bigger than or equal to 67.8.'); - } - - $this->container['double'] = $double; - - return $this; - } - - /** - * Gets string - * - * @return string|null - */ - public function getString() - { - return $this->container['string']; - } - - /** - * Sets string - * - * @param string|null $string None - * - * @return $this - */ - public function setString($string) - { - - if (!is_null($string) && (!preg_match("/[a-z]/i", $string))) { - throw new \InvalidArgumentException("invalid value for $string when calling InlineObject3., must conform to the pattern /[a-z]/i."); - } - - $this->container['string'] = $string; - - return $this; - } - - /** - * Gets pattern_without_delimiter - * - * @return string - */ - public function getPatternWithoutDelimiter() - { - return $this->container['pattern_without_delimiter']; - } - - /** - * Sets pattern_without_delimiter - * - * @param string $pattern_without_delimiter None - * - * @return $this - */ - public function setPatternWithoutDelimiter($pattern_without_delimiter) - { - - if ((!preg_match("/^[A-Z].*/", $pattern_without_delimiter))) { - throw new \InvalidArgumentException("invalid value for $pattern_without_delimiter when calling InlineObject3., must conform to the pattern /^[A-Z].*/."); - } - - $this->container['pattern_without_delimiter'] = $pattern_without_delimiter; - - return $this; - } - - /** - * Gets byte - * - * @return string - */ - public function getByte() - { - return $this->container['byte']; - } - - /** - * Sets byte - * - * @param string $byte None - * - * @return $this - */ - public function setByte($byte) - { - $this->container['byte'] = $byte; - - return $this; - } - - /** - * Gets binary - * - * @return \SplFileObject|null - */ - public function getBinary() - { - return $this->container['binary']; - } - - /** - * Sets binary - * - * @param \SplFileObject|null $binary None - * - * @return $this - */ - public function setBinary($binary) - { - $this->container['binary'] = $binary; - - return $this; - } - - /** - * Gets date - * - * @return \DateTime|null - */ - public function getDate() - { - return $this->container['date']; - } - - /** - * Sets date - * - * @param \DateTime|null $date None - * - * @return $this - */ - public function setDate($date) - { - $this->container['date'] = $date; - - return $this; - } - - /** - * Gets date_time - * - * @return \DateTime|null - */ - public function getDateTime() - { - return $this->container['date_time']; - } - - /** - * Sets date_time - * - * @param \DateTime|null $date_time None - * - * @return $this - */ - public function setDateTime($date_time) - { - $this->container['date_time'] = $date_time; - - return $this; - } - - /** - * Gets password - * - * @return string|null - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string|null $password None - * - * @return $this - */ - public function setPassword($password) - { - if (!is_null($password) && (mb_strlen($password) > 64)) { - throw new \InvalidArgumentException('invalid length for $password when calling InlineObject3., must be smaller than or equal to 64.'); - } - if (!is_null($password) && (mb_strlen($password) < 10)) { - throw new \InvalidArgumentException('invalid length for $password when calling InlineObject3., must be bigger than or equal to 10.'); - } - - $this->container['password'] = $password; - - return $this; - } - - /** - * Gets callback - * - * @return string|null - */ - public function getCallback() - { - return $this->container['callback']; - } - - /** - * Sets callback - * - * @param string|null $callback None - * - * @return $this - */ - public function setCallback($callback) - { - $this->container['callback'] = $callback; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } -} - - diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php deleted file mode 100644 index e06180ca5a3..00000000000 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php +++ /dev/null @@ -1,333 +0,0 @@ - 'string', - 'param2' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPIFormats = [ - 'param' => null, - 'param2' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'param' => 'param', - 'param2' => 'param2' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'param' => 'setParam', - 'param2' => 'setParam2' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'param' => 'getParam', - 'param2' => 'getParam2' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['param'] = isset($data['param']) ? $data['param'] : null; - $this->container['param2'] = isset($data['param2']) ? $data['param2'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['param'] === null) { - $invalidProperties[] = "'param' can't be null"; - } - if ($this->container['param2'] === null) { - $invalidProperties[] = "'param2' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets param - * - * @return string - */ - public function getParam() - { - return $this->container['param']; - } - - /** - * Sets param - * - * @param string $param field1 - * - * @return $this - */ - public function setParam($param) - { - $this->container['param'] = $param; - - return $this; - } - - /** - * Gets param2 - * - * @return string - */ - public function getParam2() - { - return $this->container['param2']; - } - - /** - * Sets param2 - * - * @param string $param2 field2 - * - * @return $this - */ - public function setParam2($param2) - { - $this->container['param2'] = $param2; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } -} - - diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php deleted file mode 100644 index bf42a623537..00000000000 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php +++ /dev/null @@ -1,330 +0,0 @@ - 'string', - 'required_file' => '\SplFileObject' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPIFormats = [ - 'additional_metadata' => null, - 'required_file' => 'binary' - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'additional_metadata' => 'additionalMetadata', - 'required_file' => 'requiredFile' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'additional_metadata' => 'setAdditionalMetadata', - 'required_file' => 'setRequiredFile' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'additional_metadata' => 'getAdditionalMetadata', - 'required_file' => 'getRequiredFile' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['additional_metadata'] = isset($data['additional_metadata']) ? $data['additional_metadata'] : null; - $this->container['required_file'] = isset($data['required_file']) ? $data['required_file'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['required_file'] === null) { - $invalidProperties[] = "'required_file' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets additional_metadata - * - * @return string|null - */ - public function getAdditionalMetadata() - { - return $this->container['additional_metadata']; - } - - /** - * Sets additional_metadata - * - * @param string|null $additional_metadata Additional data to pass to server - * - * @return $this - */ - public function setAdditionalMetadata($additional_metadata) - { - $this->container['additional_metadata'] = $additional_metadata; - - return $this; - } - - /** - * Gets required_file - * - * @return \SplFileObject - */ - public function getRequiredFile() - { - return $this->container['required_file']; - } - - /** - * Sets required_file - * - * @param \SplFileObject $required_file file to upload - * - * @return $this - */ - public function setRequiredFile($required_file) - { - $this->container['required_file'] = $required_file; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } -} - - diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php deleted file mode 100644 index 9aab09e323e..00000000000 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php +++ /dev/null @@ -1,297 +0,0 @@ - '\OpenAPI\Client\Model\Foo' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPIFormats = [ - 'string' => null - ]; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'string' => 'string' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'string' => 'setString' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'string' => 'getString' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->container['string'] = isset($data['string']) ? $data['string'] : null; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets string - * - * @return \OpenAPI\Client\Model\Foo|null - */ - public function getString() - { - return $this->container['string']; - } - - /** - * Sets string - * - * @param \OpenAPI\Client\Model\Foo|null $string string - * - * @return $this - */ - public function setString($string) - { - $this->container['string'] = $string; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Sets value based on offset. - * - * @param integer $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } -} - - diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php index 56d11e0d64c..be76b2439b9 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php @@ -2,7 +2,7 @@ /** * MapTest * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php index 315fb892067..2522e4d5d52 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php @@ -2,7 +2,7 @@ /** * MixedPropertiesAndAdditionalPropertiesClass * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php index 548396b393d..5be747eb525 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php @@ -2,7 +2,7 @@ /** * Model200Response * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelInterface.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelInterface.php index 65d496f8591..fcfdd67eebf 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelInterface.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client\Model diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php index 3797ba6eef3..85335938efd 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php @@ -2,7 +2,7 @@ /** * ModelList * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php index f9bf057b4d6..7de6909e70b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php @@ -2,7 +2,7 @@ /** * ModelReturn * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php index 31d94ac67b2..a3eddb49986 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php @@ -2,7 +2,7 @@ /** * Name * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php index 0e6fab77fa0..17b092299c1 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php @@ -2,7 +2,7 @@ /** * NumberOnly * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php index d038fd963ea..0fce0df270c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php @@ -2,7 +2,7 @@ /** * Order * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php index 045913dd7d4..cab3e72a8c4 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php @@ -2,7 +2,7 @@ /** * OuterComposite * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterEnum.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterEnum.php index f76eb48cb8e..e9314682d6c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterEnum.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterEnum.php @@ -2,7 +2,7 @@ /** * OuterEnum * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php index e5e3097a074..4e341c3f60e 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php @@ -2,7 +2,7 @@ /** * Pet * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php index 51cd0d372e7..1cdb5ac74da 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php @@ -2,7 +2,7 @@ /** * ReadOnlyFirst * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php index 6bc71b537ba..9e0ca1118bd 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php @@ -2,7 +2,7 @@ /** * SpecialModelName * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php index 9b6ac589a47..1c3dd48126d 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php @@ -2,7 +2,7 @@ /** * Tag * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/TypeHolderDefault.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/TypeHolderDefault.php index 21585e0f0e9..1d0a089165e 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/TypeHolderDefault.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/TypeHolderDefault.php @@ -2,7 +2,7 @@ /** * TypeHolderDefault * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/TypeHolderExample.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/TypeHolderExample.php index 7fc22e386bd..ecadbe0ec23 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/TypeHolderExample.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/TypeHolderExample.php @@ -2,7 +2,7 @@ /** * TypeHolderExample * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php index af14d63c68e..859a2025249 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php @@ -2,7 +2,7 @@ /** * User * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/XmlItem.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/XmlItem.php index d4b763da92e..0b27d4ff57f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/XmlItem.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/XmlItem.php @@ -2,7 +2,7 @@ /** * XmlItem * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index cfc13fe19b0..1a12604649f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.1 + * PHP version 7.2 * * @category Class * @package OpenAPI\Client @@ -202,7 +202,7 @@ class ObjectSerializer { if ($value instanceof \DateTime) { // datetime in ISO8601 format return $value->format(self::$dateTimeFormat); - } else if (is_bool($value)) { + } elseif (is_bool($value)) { return $value ? 'true' : 'false'; } else { return $value; diff --git a/samples/client/petstore/php/OpenAPIClient-php/test/Api/AnotherFakeApiTest.php b/samples/client/petstore/php/OpenAPIClient-php/test/Api/AnotherFakeApiTest.php index d6f116e518d..e27cb94acc0 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/test/Api/AnotherFakeApiTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/test/Api/AnotherFakeApiTest.php @@ -1,7 +1,7 @@ api = new Api\PetApi(); @@ -58,15 +58,13 @@ class AsyncTest extends TestCase list($pet, $status, $headers) = $promise->wait(); $this->assertEquals(200, $status); - $this->assertInternalType('array', $headers); + $this->assertIsArray($headers); $this->assertInstanceOf(Pet::class, $pet); } - /** - * @expectedException \OpenAPI\Client\ApiException - */ public function testAsyncThrowingException() { + $this->expectException(\OpenAPI\Client\ApiException::class); $promise = $this->api->getPetByIdAsync(0); $promise->wait(); } @@ -80,11 +78,9 @@ class AsyncTest extends TestCase sleep(1); } - /** - * @expectedException \OpenAPI\Client\ApiException - */ public function testAsyncHttpInfoThrowingException() { + $this->expectException(\OpenAPI\Client\ApiException::class); $promise = $this->api->getPetByIdAsyncWithHttpInfo(0); $promise->wait(); } diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/EnumTestTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/EnumTestTest.php index 24fdbeabb7e..08151e35382 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/EnumTestTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/EnumTestTest.php @@ -32,11 +32,9 @@ class EnumTestTest extends TestCase $this->assertSame($expected, $enum->listInvalidProperties()); } - /** - * @expectedException \InvalidArgumentException - */ public function testThrowExceptionWhenInvalidAmbiguousValueHasPassed() { + $this->expectException(\InvalidArgumentException::class); $enum = new EnumTest(); $enum->setEnumString(0); } diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/ExceptionTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/ExceptionTest.php index ac69620fa2f..c12388187fd 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/ExceptionTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/ExceptionTest.php @@ -7,13 +7,11 @@ use PHPUnit\Framework\TestCase; class ExceptionTest extends TestCase { - /** - * @expectedException \OpenAPI\Client\ApiException - * @expectedExceptionCode 404 - * @expectedExceptionMessage http://petstore.swagger.io/INVALID_URL/store/inventory - */ public function testNotFound() { + $this->expectException(\OpenAPI\Client\ApiException::class); + $this->expectExceptionCode(404); + $this->expectExceptionMessage('http://petstore.swagger.io/INVALID_URL/store/inventory'); $config = new Configuration(); $config->setHost('http://petstore.swagger.io/INVALID_URL'); @@ -24,12 +22,11 @@ class ExceptionTest extends TestCase $api->getInventory(); } - /** - * @expectedException \OpenAPI\Client\ApiException - * @expectedExceptionMessage Could not resolve host - */ public function testWrongHost() { + $this->expectException(\OpenAPI\Client\ApiException::class); + $this->expectExceptionMessage('Could not resolve'); + $this->expectExceptionMessage('wrong_host.zxc'); $config = new Configuration(); $config->setHost('http://wrong_host.zxc'); diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/HeadersTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/HeadersTest.php index 4054876ee0e..989516cc0c6 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/HeadersTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/HeadersTest.php @@ -11,7 +11,7 @@ class HeadersTest extends TestCase /** @var FakeHttpClient */ private $fakeHttpClient; - public function setUp() + public function setUp(): void { $this->fakeHttpClient = new FakeHttpClient(); } diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/OrderApiTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/OrderApiTest.php index 60c1fc6f47e..3cfcc38f45a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/OrderApiTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/OrderApiTest.php @@ -8,7 +8,7 @@ class OrderApiTest extends TestCase { // add a new pet (id 10005) to ensure the pet object is available for all the tests - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { // for error reporting (need to run with php5.3 to get no warning) //ini_set('display_errors', 1); @@ -31,13 +31,11 @@ class OrderApiTest extends TestCase $order->setStatus("placed"); $this->assertSame("placed", $order->getStatus()); } - - /** - * @expectedException InvalidArgumentException - */ + public function testOrderException() { // initialize the API client + $this->expectException(\InvalidArgumentException::class); $order = new Model\Order(); $order->setStatus("invalid_value"); } diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/OuterEnumTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/OuterEnumTest.php index 71a28e466ce..00777968f9b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/OuterEnumTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/OuterEnumTest.php @@ -15,16 +15,14 @@ class OuterEnumTest extends TestCase OuterEnum::class ); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals('placed', $result); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value for enum - */ public function testDeserializeInvalidValue() { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value for enum'); ObjectSerializer::deserialize( "lkjfalgkdfjg", OuterEnum::class @@ -58,7 +56,7 @@ class OuterEnumTest extends TestCase $json ); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } public function testSanitizeNested() @@ -74,19 +72,17 @@ class OuterEnumTest extends TestCase $input ); - $this->assertInternalType('object', $result); + $this->assertIsObject($result); $this->assertInstanceOf(\stdClass::class, $result); - $this->assertInternalType('string', $result->outerEnum); + $this->assertIsString($result->outerEnum); $this->assertEquals('approved', $result->outerEnum); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value for enum - */ public function testSanitizeNestedInvalidValue() { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value for enum'); $input = new EnumTest([ 'enum_string' => 'UPPER', 'enum_integer' => -1, diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/ParametersTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/ParametersTest.php index c70a5c60e47..aed0fade808 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/ParametersTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/ParametersTest.php @@ -17,7 +17,7 @@ class ParametersTest extends TestCase /** @var UserApi */ private $userApi; - public function setUp() + public function setUp(): void { $this->fakeHttpClient = new FakeHttpClient(); $this->fakeApi = new Api\FakeApi($this->fakeHttpClient); diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php index 9e7f1c54b3a..a6645a0226d 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php @@ -15,7 +15,7 @@ class PetApiTest extends TestCase private $api; // add a new pet (id 10005) to ensure the pet object is available for all the tests - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { // increase memory limit to avoid fatal error due to findPetByStatus // returning a lot of data @@ -50,7 +50,7 @@ class PetApiTest extends TestCase Assert::assertEquals(200, $status); } - public function setUp() + public function setUp(): void { $this->api = new Api\PetApi(); } @@ -362,13 +362,12 @@ class PetApiTest extends TestCase /** * test invalid argument - * - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Missing the required parameter $status when calling findPetsByStatus */ public function testInvalidArgument() { // the argument is required, and we must specify one or some from 'available', 'pending', 'sold' + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Missing the required parameter $status when calling findPetsByStatus'); $this->api->findPetsByStatus([]); } diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/RequestTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/RequestTest.php index 3bec9156361..e833151d1de 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/RequestTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/RequestTest.php @@ -15,7 +15,7 @@ class RequestTest extends TestCase /** @var FakeHttpClient */ private $fakeClient; - public function setUp() + public function setUp(): void { $this->fakeClient = new FakeHttpClient(); $this->api = new Api\FakeApi($this->fakeClient); diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/ResponseTypesTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/ResponseTypesTest.php index 499007fa03e..5f09b4b0145 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/ResponseTypesTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/ResponseTypesTest.php @@ -16,7 +16,7 @@ class ResponseTypesTest extends TestCase /** @var FakeHttpClient */ private $fakeHttpClient; - public function setUp() + public function setUp(): void { $this->fakeHttpClient = new FakeHttpClient(); $this->api = new PetApi($this->fakeHttpClient); @@ -38,12 +38,10 @@ class ResponseTypesTest extends TestCase $this->assertInstanceOf(Pet::class, $result); } - /** - * @expectedException \OpenAPI\Client\ApiException - * @expectedExceptionCode 400 - */ public function testDefinedErrorException() { + $this->expectException(\OpenAPI\Client\ApiException::class); + $this->expectExceptionCode(400); $statusCode = 400; $this->fakeHttpClient->setResponse(new Response($statusCode, [], '{}')); @@ -69,12 +67,10 @@ class ResponseTypesTest extends TestCase // $this->assertInstanceOf(Error::class, $result); // } - /** - * @expectedException \OpenAPI\Client\ApiException - * @expectedExceptionCode 404 - */ public function testDefaultErrorException() { + $this->expectException(\OpenAPI\Client\ApiException::class); + $this->expectExceptionCode(404); $statusCode = 404; $this->fakeHttpClient->setResponse(new Response($statusCode, [], '{}')); diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/StoreApiTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/StoreApiTest.php index f18f3ce66ca..4bb85919dc5 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/StoreApiTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/StoreApiTest.php @@ -14,7 +14,7 @@ class StoreApiTest extends TestCase /** @var StoreApi */ private $api; - public function setUp() + public function setUp(): void { $this->api = new StoreApi(); } @@ -22,7 +22,7 @@ class StoreApiTest extends TestCase /** * Setup before running each test case */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { // add a new pet (id 10005) to ensure the pet object is available for all the tests // new pet @@ -51,7 +51,7 @@ class StoreApiTest extends TestCase { $result = $this->api->getInventory(); - $this->assertInternalType('array', $result); - $this->assertInternalType('int', $result['available']); + $this->assertIsArray($result); + $this->assertIsInt($result['available']); } } diff --git a/samples/client/petstore/php/OpenAPIClient-php/tests/UserApiTest.php b/samples/client/petstore/php/OpenAPIClient-php/tests/UserApiTest.php index 756fa58f177..929789670f9 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/tests/UserApiTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/tests/UserApiTest.php @@ -11,7 +11,7 @@ class UserApiTest extends TestCase /** @var UserApi*/ private $api; - public function setUp() + public function setUp(): void { $this->api = new Api\UserApi(); } @@ -23,11 +23,15 @@ class UserApiTest extends TestCase // login $response = $this->api->loginUser('xxxxx', 'yyyyyyyy'); - $this->assertInternalType('string', $response); - $this->assertRegExp( - '/logged in user session/', - $response, - "response string starts with 'logged in user session'" - ); + $this->assertIsString($response); + + $pattern = '/logged in user session/'; + $assertMessage = "response string starts with 'logged in user session'"; + $this->assertIsString($response); + if (method_exists($this, 'assertMatchesRegularExpression')) { + $this->assertMatchesRegularExpression($pattern, $response, $assertMessage); + } else { + $this->assertRegExp($pattern, $response, $assertMessage); + } } } diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/.gitignore b/samples/openapi3/client/petstore/php/OpenAPIClient-php/.gitignore index edcf63f6aee..e2316dd486c 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/.gitignore +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/.gitignore @@ -5,4 +5,10 @@ composer.phar # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file -composer.lock \ No newline at end of file +composer.lock + +# php-cs-fixer cache +.php_cs.cache + +# PHPUnit cache +.phpunit.result.cache diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/.travis.yml b/samples/openapi3/client/petstore/php/OpenAPIClient-php/.travis.yml index cf85d27981a..b4b1d0a6b5a 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/.travis.yml +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/.travis.yml @@ -1,6 +1,10 @@ language: php +# Bionic environment has preinstalled PHP from 7.1 to 7.4 +# https://docs.travis-ci.com/user/reference/bionic/#php-support +dist: bionic php: - - 7.1 - 7.2 + - 7.3 + - 7.4 before_install: "composer install" script: "vendor/bin/phpunit" diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md index a64571758a2..4a8f0287158 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md @@ -9,7 +9,7 @@ This PHP package is automatically generated by the [OpenAPI Generator](https://o ## Requirements -PHP 7.1 and later +PHP 7.2 and later ## Installation & Usage diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json b/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json index 4ca57f24d54..823e9f92a7b 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json @@ -19,14 +19,14 @@ } ], "require": { - "php": ">=7.1", + "php": ">=7.2", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", "guzzlehttp/guzzle": "^6.2" }, "require-dev": { - "phpunit/phpunit": "^7.4", + "phpunit/phpunit": "^8.0 || ^9.0", "friendsofphp/php-cs-fixer": "^2.12" }, "autoload": { diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index e315235789e..ecceb4cdc12 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -1,7 +1,7 @@ "http://{server}.swagger.io:{port}/v2", - "description" => "petstore server", - "variables" => array( - "server" => array( - "description" => "No description provided", - "default_value" => "petstore", - "enum_values" => array( - "petstore", - "qa-petstore", - "dev-petstore" - ) - ), - "port" => array( - "description" => "No description provided", - "default_value" => "80", - "enum_values" => array( - "80", - "8080" - ) - ) - ) - ), - array( - "url" => "https://localhost:8080/{version}", - "description" => "The local server", - "variables" => array( - "version" => array( - "description" => "No description provided", - "default_value" => "v2", - "enum_values" => array( - "v1", - "v2" - ) - ) - ) - ) - ); + return [ + [ + "url" => "http://{server}.swagger.io:{port}/v2", + "description" => "petstore server", + "variables" => [ + "server" => [ + "description" => "No description provided", + "default_value" => "petstore", + "enum_values" => [ + "petstore", + "qa-petstore", + "dev-petstore" + ] + ], + "port" => [ + "description" => "No description provided", + "default_value" => "80", + "enum_values" => [ + "80", + "8080" + ] + ] + ] + ], + [ + "url" => "https://localhost:8080/{version}", + "description" => "The local server", + "variables" => [ + "version" => [ + "description" => "No description provided", + "default_value" => "v2", + "enum_values" => [ + "v1", + "v2" + ] + ] + ] + ] + ]; } /** @@ -485,7 +485,7 @@ class Configuration public function getHostFromSettings($index, $variables = null) { if (null === $variables) { - $variables = array(); + $variables = []; } $hosts = $this->getHostSettings(); @@ -501,7 +501,7 @@ class Configuration // go through variable and assign a value foreach ($host["variables"] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (in_array($variables[$name], $variable["enum_values"])) { // check to see if the value is in the enum + if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php index d5fec659084..25a92414028 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php @@ -1,7 +1,7 @@ format(self::$dateTimeFormat); - } else if (is_bool($value)) { + } elseif (is_bool($value)) { return $value ? 'true' : 'false'; } else { return $value; diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/AnotherFakeApiTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/AnotherFakeApiTest.php index d6f116e518d..e27cb94acc0 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/AnotherFakeApiTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/AnotherFakeApiTest.php @@ -1,7 +1,7 @@ api = new Api\PetApi(); @@ -58,15 +58,13 @@ class AsyncTest extends TestCase list($pet, $status, $headers) = $promise->wait(); $this->assertEquals(200, $status); - $this->assertInternalType('array', $headers); + $this->assertIsArray($headers); $this->assertInstanceOf(Pet::class, $pet); } - /** - * @expectedException \OpenAPI\Client\ApiException - */ public function testAsyncThrowingException() { + $this->expectException(\OpenAPI\Client\ApiException::class); $promise = $this->api->getPetByIdAsync(0); $promise->wait(); } @@ -80,11 +78,9 @@ class AsyncTest extends TestCase sleep(1); } - /** - * @expectedException \OpenAPI\Client\ApiException - */ public function testAsyncHttpInfoThrowingException() { + $this->expectException(\OpenAPI\Client\ApiException::class); $promise = $this->api->getPetByIdAsyncWithHttpInfo(0); $promise->wait(); } diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ConfigurationTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ConfigurationTest.php index 4b2738841b4..4cc9954e90e 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ConfigurationTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ConfigurationTest.php @@ -43,23 +43,23 @@ class ConfigurationTest extends TestCase /** * Test invalid index - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Invalid index 2 when selecting the host. Must be less than 2 */ public function testInvalidIndex() { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid index 2 when selecting the host. Must be less than 2'); $config = new Configuration(); $url = $config->getHostFromSettings(2); } /** * Test host settings with invalid vaues - * @expectedException InvalidArgumentException - * @expectedExceptionMessage The variable `port` in the host URL has invalid value 8. Must be 80,8080 */ public function testHostUrlWithInvalidValues() { // using 2 variables with invalid values + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('The variable `port` in the host URL has invalid value 8. Must be 80,8080'); $config = new Configuration(); $url = $config->getHostFromSettings(0, array("server" => "dev-petstore", "port" => "8")); $this->assertSame("http://dev-petstore.swagger.io:8080/v2", $url); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/DebugTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/DebugTest.php index 4cf198f6603..b14dd018df0 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/DebugTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/DebugTest.php @@ -6,7 +6,7 @@ use PHPUnit\Framework\TestCase; class DebugTest extends TestCase { - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); $newPet = new Model\Pet; diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ExceptionTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ExceptionTest.php index ac69620fa2f..c12388187fd 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ExceptionTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ExceptionTest.php @@ -7,13 +7,11 @@ use PHPUnit\Framework\TestCase; class ExceptionTest extends TestCase { - /** - * @expectedException \OpenAPI\Client\ApiException - * @expectedExceptionCode 404 - * @expectedExceptionMessage http://petstore.swagger.io/INVALID_URL/store/inventory - */ public function testNotFound() { + $this->expectException(\OpenAPI\Client\ApiException::class); + $this->expectExceptionCode(404); + $this->expectExceptionMessage('http://petstore.swagger.io/INVALID_URL/store/inventory'); $config = new Configuration(); $config->setHost('http://petstore.swagger.io/INVALID_URL'); @@ -24,12 +22,11 @@ class ExceptionTest extends TestCase $api->getInventory(); } - /** - * @expectedException \OpenAPI\Client\ApiException - * @expectedExceptionMessage Could not resolve host - */ public function testWrongHost() { + $this->expectException(\OpenAPI\Client\ApiException::class); + $this->expectExceptionMessage('Could not resolve'); + $this->expectExceptionMessage('wrong_host.zxc'); $config = new Configuration(); $config->setHost('http://wrong_host.zxc'); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/HeadersTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/HeadersTest.php index 4054876ee0e..989516cc0c6 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/HeadersTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/HeadersTest.php @@ -11,7 +11,7 @@ class HeadersTest extends TestCase /** @var FakeHttpClient */ private $fakeHttpClient; - public function setUp() + public function setUp(): void { $this->fakeHttpClient = new FakeHttpClient(); } diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/OrderApiTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/OrderApiTest.php index 60c1fc6f47e..3cfcc38f45a 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/OrderApiTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/OrderApiTest.php @@ -8,7 +8,7 @@ class OrderApiTest extends TestCase { // add a new pet (id 10005) to ensure the pet object is available for all the tests - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { // for error reporting (need to run with php5.3 to get no warning) //ini_set('display_errors', 1); @@ -31,13 +31,11 @@ class OrderApiTest extends TestCase $order->setStatus("placed"); $this->assertSame("placed", $order->getStatus()); } - - /** - * @expectedException InvalidArgumentException - */ + public function testOrderException() { // initialize the API client + $this->expectException(\InvalidArgumentException::class); $order = new Model\Order(); $order->setStatus("invalid_value"); } diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/OuterEnumTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/OuterEnumTest.php index 71a28e466ce..00777968f9b 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/OuterEnumTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/OuterEnumTest.php @@ -15,16 +15,14 @@ class OuterEnumTest extends TestCase OuterEnum::class ); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals('placed', $result); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value for enum - */ public function testDeserializeInvalidValue() { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value for enum'); ObjectSerializer::deserialize( "lkjfalgkdfjg", OuterEnum::class @@ -58,7 +56,7 @@ class OuterEnumTest extends TestCase $json ); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } public function testSanitizeNested() @@ -74,19 +72,17 @@ class OuterEnumTest extends TestCase $input ); - $this->assertInternalType('object', $result); + $this->assertIsObject($result); $this->assertInstanceOf(\stdClass::class, $result); - $this->assertInternalType('string', $result->outerEnum); + $this->assertIsString($result->outerEnum); $this->assertEquals('approved', $result->outerEnum); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid value for enum - */ public function testSanitizeNestedInvalidValue() { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid value for enum'); $input = new EnumTest([ 'enum_string' => 'UPPER', 'enum_integer' => -1, diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ParametersTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ParametersTest.php index c70a5c60e47..aed0fade808 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ParametersTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ParametersTest.php @@ -17,7 +17,7 @@ class ParametersTest extends TestCase /** @var UserApi */ private $userApi; - public function setUp() + public function setUp(): void { $this->fakeHttpClient = new FakeHttpClient(); $this->fakeApi = new Api\FakeApi($this->fakeHttpClient); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php index 45b3072db4e..2a5bb49caa7 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/PetApiTest.php @@ -15,7 +15,7 @@ class PetApiTest extends TestCase private $api; // add a new pet (id 10005) to ensure the pet object is available for all the tests - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { // increase memory limit to avoid fatal error due to findPetByStatus // returning a lot of data @@ -50,7 +50,7 @@ class PetApiTest extends TestCase Assert::assertEquals(200, $status); } - public function setUp() + public function setUp(): void { $this->api = new Api\PetApi(); } @@ -362,13 +362,12 @@ class PetApiTest extends TestCase /** * test invalid argument - * - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Missing the required parameter $status when calling findPetsByStatus */ public function testInvalidArgument() { // the argument is required, and we must specify one or some from 'available', 'pending', 'sold' + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('Missing the required parameter $status when calling findPetsByStatus'); $this->api->findPetsByStatus([]); } diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/RequestTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/RequestTest.php index 26d431bc03e..834e27588a7 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/RequestTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/RequestTest.php @@ -14,7 +14,7 @@ class RequestTest extends TestCase /** @var FakeHttpClient */ private $fakeClient; - public function setUp() + public function setUp(): void { $this->fakeClient = new FakeHttpClient(); $this->api = new Api\FakeApi($this->fakeClient); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ResponseTypesTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ResponseTypesTest.php index 499007fa03e..8d65396ccbc 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ResponseTypesTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/ResponseTypesTest.php @@ -16,7 +16,7 @@ class ResponseTypesTest extends TestCase /** @var FakeHttpClient */ private $fakeHttpClient; - public function setUp() + public function setUp(): void { $this->fakeHttpClient = new FakeHttpClient(); $this->api = new PetApi($this->fakeHttpClient); @@ -38,12 +38,10 @@ class ResponseTypesTest extends TestCase $this->assertInstanceOf(Pet::class, $result); } - /** - * @expectedException \OpenAPI\Client\ApiException - * @expectedExceptionCode 400 - */ public function testDefinedErrorException() { + $this->expectExceptionCode(400); + $this->expectException(\OpenAPI\Client\ApiException::class); $statusCode = 400; $this->fakeHttpClient->setResponse(new Response($statusCode, [], '{}')); @@ -69,12 +67,10 @@ class ResponseTypesTest extends TestCase // $this->assertInstanceOf(Error::class, $result); // } - /** - * @expectedException \OpenAPI\Client\ApiException - * @expectedExceptionCode 404 - */ public function testDefaultErrorException() { + $this->expectExceptionCode(404); + $this->expectException(\OpenAPI\Client\ApiException::class); $statusCode = 404; $this->fakeHttpClient->setResponse(new Response($statusCode, [], '{}')); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/StoreApiTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/StoreApiTest.php index f18f3ce66ca..4bb85919dc5 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/StoreApiTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/StoreApiTest.php @@ -14,7 +14,7 @@ class StoreApiTest extends TestCase /** @var StoreApi */ private $api; - public function setUp() + public function setUp(): void { $this->api = new StoreApi(); } @@ -22,7 +22,7 @@ class StoreApiTest extends TestCase /** * Setup before running each test case */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { // add a new pet (id 10005) to ensure the pet object is available for all the tests // new pet @@ -51,7 +51,7 @@ class StoreApiTest extends TestCase { $result = $this->api->getInventory(); - $this->assertInternalType('array', $result); - $this->assertInternalType('int', $result['available']); + $this->assertIsArray($result); + $this->assertIsInt($result['available']); } } diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/UserApiTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/UserApiTest.php index 756fa58f177..929789670f9 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/UserApiTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/tests/UserApiTest.php @@ -11,7 +11,7 @@ class UserApiTest extends TestCase /** @var UserApi*/ private $api; - public function setUp() + public function setUp(): void { $this->api = new Api\UserApi(); } @@ -23,11 +23,15 @@ class UserApiTest extends TestCase // login $response = $this->api->loginUser('xxxxx', 'yyyyyyyy'); - $this->assertInternalType('string', $response); - $this->assertRegExp( - '/logged in user session/', - $response, - "response string starts with 'logged in user session'" - ); + $this->assertIsString($response); + + $pattern = '/logged in user session/'; + $assertMessage = "response string starts with 'logged in user session'"; + $this->assertIsString($response); + if (method_exists($this, 'assertMatchesRegularExpression')) { + $this->assertMatchesRegularExpression($pattern, $response, $assertMessage); + } else { + $this->assertRegExp($pattern, $response, $assertMessage); + } } }