From d58e68f8c0e4010b34d0445c22b1eef3c7da5cbd Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sat, 23 Sep 2023 15:28:43 +0800 Subject: [PATCH] update php samples --- .../php-nextgen/docs/Model/DefaultValue.md | 8 +- .../echo_api/php-nextgen/docs/Model/Query.md | 2 +- .../echo_api/php-nextgen/src/Api/AuthApi.php | 68 ++- .../echo_api/php-nextgen/src/Api/BodyApi.php | 378 ++++++++----- .../echo_api/php-nextgen/src/Api/FormApi.php | 241 +++++--- .../php-nextgen/src/Api/HeaderApi.php | 113 ++-- .../echo_api/php-nextgen/src/Api/PathApi.php | 82 ++- .../echo_api/php-nextgen/src/Api/QueryApi.php | 514 +++++++++++------- .../echo_api/php-nextgen/src/ApiException.php | 27 +- .../php-nextgen/src/Configuration.php | 102 ++-- .../echo_api/php-nextgen/src/Model/Bird.php | 116 ++-- .../php-nextgen/src/Model/Category.php | 116 ++-- .../php-nextgen/src/Model/DataQuery.php | 112 ++-- .../php-nextgen/src/Model/DefaultValue.php | 168 +++--- .../php-nextgen/src/Model/ModelInterface.php | 16 +- .../src/Model/NumberPropertiesOnly.php | 128 ++--- .../echo_api/php-nextgen/src/Model/Pet.php | 150 ++--- .../echo_api/php-nextgen/src/Model/Query.php | 120 ++-- .../php-nextgen/src/Model/StringEnumRef.php | 1 - .../echo_api/php-nextgen/src/Model/Tag.php | 116 ++-- ...odeTrueObjectAllOfQueryObjectParameter.php | 132 ++--- ...odeTrueArrayStringQueryObjectParameter.php | 108 ++-- .../php-nextgen/src/ObjectSerializer.php | 118 ++-- .../OpenAPIClient-php/src/Api/FakeApi.php | 90 ++- .../src/Model/ChildWithNullable.php | 96 ++-- .../src/Model/ParentWithNullable.php | 116 ++-- ...ineFreeformAdditionalPropertiesRequest.php | 108 ++-- 27 files changed, 1860 insertions(+), 1486 deletions(-) diff --git a/samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md b/samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md index a5000ed94ee..ad271999e3a 100644 --- a/samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md +++ b/samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional] -**array_string_enum_default** | **string[]** | | [optional] -**array_string_default** | **string[]** | | [optional] -**array_integer_default** | **int[]** | | [optional] +**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional] [default to [["success","failure"]]] +**array_string_enum_default** | **string[]** | | [optional] [default to [["success","failure"]]] +**array_string_default** | **string[]** | | [optional] [default to [["failure","skipped"]]] +**array_integer_default** | **int[]** | | [optional] [default to [[1,3]]] **array_string** | **string[]** | | [optional] **array_string_nullable** | **string[]** | | [optional] **array_string_extension_nullable** | **string[]** | | [optional] diff --git a/samples/client/echo_api/php-nextgen/docs/Model/Query.md b/samples/client/echo_api/php-nextgen/docs/Model/Query.md index 342a9f8ffb1..91d1e7e7feb 100644 --- a/samples/client/echo_api/php-nextgen/docs/Model/Query.md +++ b/samples/client/echo_api/php-nextgen/docs/Model/Query.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | Query | [optional] -**outcomes** | **string[]** | | [optional] +**outcomes** | **string[]** | | [optional] [default to [["SUCCESS","FAILURE"]]] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php b/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php index 53f05d5f1bb..0a1888cca45 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php @@ -28,6 +28,7 @@ namespace OpenAPI\Client\Api; +use InvalidArgumentException; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; @@ -35,6 +36,7 @@ use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use GuzzleHttp\Promise\PromiseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; @@ -53,22 +55,22 @@ class AuthApi /** * @var ClientInterface */ - protected $client; + protected ClientInterface $client; /** * @var Configuration */ - protected $config; + protected Configuration $config; /** * @var HeaderSelector */ - protected $headerSelector; + protected HeaderSelector $headerSelector; /** * @var int Host index */ - protected $hostIndex; + protected int $hostIndex; /** @var string[] $contentTypes **/ public const contentTypes = [ @@ -77,17 +79,17 @@ class AuthApi ], ]; -/** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, HeaderSelector $selector = null, - $hostIndex = 0 + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: new Configuration(); @@ -100,7 +102,7 @@ class AuthApi * * @param int $hostIndex Host index (required) */ - public function setHostIndex($hostIndex): void + public function setHostIndex(int $hostIndex): void { $this->hostIndex = $hostIndex; } @@ -110,7 +112,7 @@ class AuthApi * * @return int Host index */ - public function getHostIndex() + public function getHostIndex(): int { return $this->hostIndex; } @@ -118,7 +120,7 @@ class AuthApi /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -130,11 +132,13 @@ class AuthApi * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testAuthHttpBasic(string $contentType = self::contentTypes['testAuthHttpBasic'][0]) + public function testAuthHttpBasic( + string $contentType = self::contentTypes['testAuthHttpBasic'][0] + ): string { list($response) = $this->testAuthHttpBasicWithHttpInfo($contentType); return $response; @@ -147,11 +151,13 @@ class AuthApi * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testAuthHttpBasicWithHttpInfo(string $contentType = self::contentTypes['testAuthHttpBasic'][0]) + public function testAuthHttpBasicWithHttpInfo( + string $contentType = self::contentTypes['testAuthHttpBasic'][0] + ): array { $request = $this->testAuthHttpBasicRequest($contentType); @@ -246,10 +252,12 @@ class AuthApi * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testAuthHttpBasicAsync(string $contentType = self::contentTypes['testAuthHttpBasic'][0]) + public function testAuthHttpBasicAsync( + string $contentType = self::contentTypes['testAuthHttpBasic'][0] + ): PromiseInterface { return $this->testAuthHttpBasicAsyncWithHttpInfo($contentType) ->then( @@ -266,10 +274,12 @@ class AuthApi * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testAuthHttpBasicAsyncWithHttpInfo(string $contentType = self::contentTypes['testAuthHttpBasic'][0]) + public function testAuthHttpBasicAsyncWithHttpInfo( + string $contentType = self::contentTypes['testAuthHttpBasic'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testAuthHttpBasicRequest($contentType); @@ -315,10 +325,12 @@ class AuthApi * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testAuthHttpBasicRequest(string $contentType = self::contentTypes['testAuthHttpBasic'][0]) + public function testAuthHttpBasicRequest( + string $contentType = self::contentTypes['testAuthHttpBasic'][0] + ): Request { @@ -396,7 +408,7 @@ class AuthApi * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php index 4c26e74f299..dd5ceaf1b5e 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php @@ -28,6 +28,7 @@ namespace OpenAPI\Client\Api; +use InvalidArgumentException; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; @@ -35,6 +36,7 @@ use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use GuzzleHttp\Promise\PromiseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; @@ -53,22 +55,22 @@ class BodyApi /** * @var ClientInterface */ - protected $client; + protected ClientInterface $client; /** * @var Configuration */ - protected $config; + protected Configuration $config; /** * @var HeaderSelector */ - protected $headerSelector; + protected HeaderSelector $headerSelector; /** * @var int Host index */ - protected $hostIndex; + protected int $hostIndex; /** @var string[] $contentTypes **/ public const contentTypes = [ @@ -95,17 +97,17 @@ class BodyApi ], ]; -/** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, HeaderSelector $selector = null, - $hostIndex = 0 + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: new Configuration(); @@ -118,7 +120,7 @@ class BodyApi * * @param int $hostIndex Host index (required) */ - public function setHostIndex($hostIndex): void + public function setHostIndex(int $hostIndex): void { $this->hostIndex = $hostIndex; } @@ -128,7 +130,7 @@ class BodyApi * * @return int Host index */ - public function getHostIndex() + public function getHostIndex(): int { return $this->hostIndex; } @@ -136,7 +138,7 @@ class BodyApi /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -148,11 +150,13 @@ class BodyApi * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return \SplFileObject */ - public function testBinaryGif(string $contentType = self::contentTypes['testBinaryGif'][0]) + public function testBinaryGif( + string $contentType = self::contentTypes['testBinaryGif'][0] + ): \SplFileObject { list($response) = $this->testBinaryGifWithHttpInfo($contentType); return $response; @@ -165,11 +169,13 @@ class BodyApi * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings) */ - public function testBinaryGifWithHttpInfo(string $contentType = self::contentTypes['testBinaryGif'][0]) + public function testBinaryGifWithHttpInfo( + string $contentType = self::contentTypes['testBinaryGif'][0] + ): array { $request = $this->testBinaryGifRequest($contentType); @@ -264,10 +270,12 @@ class BodyApi * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testBinaryGifAsync(string $contentType = self::contentTypes['testBinaryGif'][0]) + public function testBinaryGifAsync( + string $contentType = self::contentTypes['testBinaryGif'][0] + ): PromiseInterface { return $this->testBinaryGifAsyncWithHttpInfo($contentType) ->then( @@ -284,10 +292,12 @@ class BodyApi * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testBinaryGifAsyncWithHttpInfo(string $contentType = self::contentTypes['testBinaryGif'][0]) + public function testBinaryGifAsyncWithHttpInfo( + string $contentType = self::contentTypes['testBinaryGif'][0] + ): PromiseInterface { $returnType = '\SplFileObject'; $request = $this->testBinaryGifRequest($contentType); @@ -333,10 +343,12 @@ class BodyApi * * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testBinaryGifRequest(string $contentType = self::contentTypes['testBinaryGif'][0]) + public function testBinaryGifRequest( + string $contentType = self::contentTypes['testBinaryGif'][0] + ): Request { @@ -409,14 +421,17 @@ class BodyApi * * Test body parameter(s) * - * @param \SplFileObject $body body (optional) + * @param \SplFileObject|null $body body (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testBodyApplicationOctetstreamBinary($body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]) + public function testBodyApplicationOctetstreamBinary( + ?\SplFileObject $body = null, + string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0] + ): string { list($response) = $this->testBodyApplicationOctetstreamBinaryWithHttpInfo($body, $contentType); return $response; @@ -427,14 +442,17 @@ class BodyApi * * Test body parameter(s) * - * @param \SplFileObject $body (optional) + * @param \SplFileObject|null $body (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testBodyApplicationOctetstreamBinaryWithHttpInfo($body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]) + public function testBodyApplicationOctetstreamBinaryWithHttpInfo( + ?\SplFileObject $body = null, + string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0] + ): array { $request = $this->testBodyApplicationOctetstreamBinaryRequest($body, $contentType); @@ -527,13 +545,16 @@ class BodyApi * * Test body parameter(s) * - * @param \SplFileObject $body (optional) + * @param \SplFileObject|null $body (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testBodyApplicationOctetstreamBinaryAsync($body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]) + public function testBodyApplicationOctetstreamBinaryAsync( + ?\SplFileObject $body = null, + string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0] + ): PromiseInterface { return $this->testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo($body, $contentType) ->then( @@ -548,13 +569,16 @@ class BodyApi * * Test body parameter(s) * - * @param \SplFileObject $body (optional) + * @param \SplFileObject|null $body (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo($body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]) + public function testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo( + $body = null, + string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testBodyApplicationOctetstreamBinaryRequest($body, $contentType); @@ -598,13 +622,16 @@ class BodyApi /** * Create request for operation 'testBodyApplicationOctetstreamBinary' * - * @param \SplFileObject $body (optional) + * @param \SplFileObject|null $body (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testBodyApplicationOctetstreamBinaryRequest($body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0]) + public function testBodyApplicationOctetstreamBinaryRequest( + $body = null, + string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0] + ): Request { @@ -688,11 +715,14 @@ class BodyApi * @param \SplFileObject[] $files files (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testBodyMultipartFormdataArrayOfBinary($files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]) + public function testBodyMultipartFormdataArrayOfBinary( + array $files, + string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0] + ): string { list($response) = $this->testBodyMultipartFormdataArrayOfBinaryWithHttpInfo($files, $contentType); return $response; @@ -706,11 +736,14 @@ class BodyApi * @param \SplFileObject[] $files (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testBodyMultipartFormdataArrayOfBinaryWithHttpInfo($files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]) + public function testBodyMultipartFormdataArrayOfBinaryWithHttpInfo( + array $files, + string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0] + ): array { $request = $this->testBodyMultipartFormdataArrayOfBinaryRequest($files, $contentType); @@ -806,10 +839,13 @@ class BodyApi * @param \SplFileObject[] $files (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testBodyMultipartFormdataArrayOfBinaryAsync($files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]) + public function testBodyMultipartFormdataArrayOfBinaryAsync( + array $files, + string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0] + ): PromiseInterface { return $this->testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo($files, $contentType) ->then( @@ -827,10 +863,13 @@ class BodyApi * @param \SplFileObject[] $files (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo($files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]) + public function testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo( + $files, + string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testBodyMultipartFormdataArrayOfBinaryRequest($files, $contentType); @@ -877,15 +916,18 @@ class BodyApi * @param \SplFileObject[] $files (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testBodyMultipartFormdataArrayOfBinaryRequest($files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0]) + public function testBodyMultipartFormdataArrayOfBinaryRequest( + $files, + string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0] + ): Request { // verify the required parameter 'files' is set if ($files === null || (is_array($files) && count($files) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $files when calling testBodyMultipartFormdataArrayOfBinary' ); } @@ -972,14 +1014,17 @@ class BodyApi * * Test free form object * - * @param object $body Free form object (optional) + * @param object|null $body Free form object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testEchoBodyFreeFormObjectResponseString($body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]) + public function testEchoBodyFreeFormObjectResponseString( + ?array $body = null, + string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] + ): string { list($response) = $this->testEchoBodyFreeFormObjectResponseStringWithHttpInfo($body, $contentType); return $response; @@ -990,14 +1035,17 @@ class BodyApi * * Test free form object * - * @param object $body Free form object (optional) + * @param object|null $body Free form object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo($body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]) + public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo( + ?array $body = null, + string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] + ): array { $request = $this->testEchoBodyFreeFormObjectResponseStringRequest($body, $contentType); @@ -1090,13 +1138,16 @@ class BodyApi * * Test free form object * - * @param object $body Free form object (optional) + * @param object|null $body Free form object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testEchoBodyFreeFormObjectResponseStringAsync($body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]) + public function testEchoBodyFreeFormObjectResponseStringAsync( + ?array $body = null, + string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] + ): PromiseInterface { return $this->testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo($body, $contentType) ->then( @@ -1111,13 +1162,16 @@ class BodyApi * * Test free form object * - * @param object $body Free form object (optional) + * @param object|null $body Free form object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo($body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]) + public function testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo( + $body = null, + string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testEchoBodyFreeFormObjectResponseStringRequest($body, $contentType); @@ -1161,13 +1215,16 @@ class BodyApi /** * Create request for operation 'testEchoBodyFreeFormObjectResponseString' * - * @param object $body Free form object (optional) + * @param object|null $body Free form object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testEchoBodyFreeFormObjectResponseStringRequest($body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0]) + public function testEchoBodyFreeFormObjectResponseStringRequest( + $body = null, + string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] + ): Request { @@ -1248,14 +1305,17 @@ class BodyApi * * Test body parameter(s) * - * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional) + * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return \OpenAPI\Client\Model\Pet */ - public function testEchoBodyPet($pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0]) + public function testEchoBodyPet( + ?\OpenAPI\Client\Model\Pet $pet = null, + string $contentType = self::contentTypes['testEchoBodyPet'][0] + ): \OpenAPI\Client\Model\Pet { list($response) = $this->testEchoBodyPetWithHttpInfo($pet, $contentType); return $response; @@ -1266,14 +1326,17 @@ class BodyApi * * Test body parameter(s) * - * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional) + * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of \OpenAPI\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings) */ - public function testEchoBodyPetWithHttpInfo($pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0]) + public function testEchoBodyPetWithHttpInfo( + ?\OpenAPI\Client\Model\Pet $pet = null, + string $contentType = self::contentTypes['testEchoBodyPet'][0] + ): array { $request = $this->testEchoBodyPetRequest($pet, $contentType); @@ -1366,13 +1429,16 @@ class BodyApi * * Test body parameter(s) * - * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional) + * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testEchoBodyPetAsync($pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0]) + public function testEchoBodyPetAsync( + ?\OpenAPI\Client\Model\Pet $pet = null, + string $contentType = self::contentTypes['testEchoBodyPet'][0] + ): PromiseInterface { return $this->testEchoBodyPetAsyncWithHttpInfo($pet, $contentType) ->then( @@ -1387,13 +1453,16 @@ class BodyApi * * Test body parameter(s) * - * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional) + * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testEchoBodyPetAsyncWithHttpInfo($pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0]) + public function testEchoBodyPetAsyncWithHttpInfo( + $pet = null, + string $contentType = self::contentTypes['testEchoBodyPet'][0] + ): PromiseInterface { $returnType = '\OpenAPI\Client\Model\Pet'; $request = $this->testEchoBodyPetRequest($pet, $contentType); @@ -1437,13 +1506,16 @@ class BodyApi /** * Create request for operation 'testEchoBodyPet' * - * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional) + * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testEchoBodyPetRequest($pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0]) + public function testEchoBodyPetRequest( + $pet = null, + string $contentType = self::contentTypes['testEchoBodyPet'][0] + ): Request { @@ -1524,14 +1596,17 @@ class BodyApi * * Test empty response body * - * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional) + * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testEchoBodyPetResponseString($pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]) + public function testEchoBodyPetResponseString( + ?\OpenAPI\Client\Model\Pet $pet = null, + string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0] + ): string { list($response) = $this->testEchoBodyPetResponseStringWithHttpInfo($pet, $contentType); return $response; @@ -1542,14 +1617,17 @@ class BodyApi * * Test empty response body * - * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional) + * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testEchoBodyPetResponseStringWithHttpInfo($pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]) + public function testEchoBodyPetResponseStringWithHttpInfo( + ?\OpenAPI\Client\Model\Pet $pet = null, + string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0] + ): array { $request = $this->testEchoBodyPetResponseStringRequest($pet, $contentType); @@ -1642,13 +1720,16 @@ class BodyApi * * Test empty response body * - * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional) + * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testEchoBodyPetResponseStringAsync($pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]) + public function testEchoBodyPetResponseStringAsync( + ?\OpenAPI\Client\Model\Pet $pet = null, + string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0] + ): PromiseInterface { return $this->testEchoBodyPetResponseStringAsyncWithHttpInfo($pet, $contentType) ->then( @@ -1663,13 +1744,16 @@ class BodyApi * * Test empty response body * - * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional) + * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testEchoBodyPetResponseStringAsyncWithHttpInfo($pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]) + public function testEchoBodyPetResponseStringAsyncWithHttpInfo( + $pet = null, + string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testEchoBodyPetResponseStringRequest($pet, $contentType); @@ -1713,13 +1797,16 @@ class BodyApi /** * Create request for operation 'testEchoBodyPetResponseString' * - * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional) + * @param \OpenAPI\Client\Model\Pet|null $pet Pet object that needs to be added to the store (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testEchoBodyPetResponseStringRequest($pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0]) + public function testEchoBodyPetResponseStringRequest( + $pet = null, + string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0] + ): Request { @@ -1800,14 +1887,17 @@ class BodyApi * * Test empty json (request body) * - * @param \OpenAPI\Client\Model\Tag $tag Tag object (optional) + * @param \OpenAPI\Client\Model\Tag|null $tag Tag object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testEchoBodyTagResponseString($tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]) + public function testEchoBodyTagResponseString( + ?\OpenAPI\Client\Model\Tag $tag = null, + string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0] + ): string { list($response) = $this->testEchoBodyTagResponseStringWithHttpInfo($tag, $contentType); return $response; @@ -1818,14 +1908,17 @@ class BodyApi * * Test empty json (request body) * - * @param \OpenAPI\Client\Model\Tag $tag Tag object (optional) + * @param \OpenAPI\Client\Model\Tag|null $tag Tag object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testEchoBodyTagResponseStringWithHttpInfo($tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]) + public function testEchoBodyTagResponseStringWithHttpInfo( + ?\OpenAPI\Client\Model\Tag $tag = null, + string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0] + ): array { $request = $this->testEchoBodyTagResponseStringRequest($tag, $contentType); @@ -1918,13 +2011,16 @@ class BodyApi * * Test empty json (request body) * - * @param \OpenAPI\Client\Model\Tag $tag Tag object (optional) + * @param \OpenAPI\Client\Model\Tag|null $tag Tag object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testEchoBodyTagResponseStringAsync($tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]) + public function testEchoBodyTagResponseStringAsync( + ?\OpenAPI\Client\Model\Tag $tag = null, + string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0] + ): PromiseInterface { return $this->testEchoBodyTagResponseStringAsyncWithHttpInfo($tag, $contentType) ->then( @@ -1939,13 +2035,16 @@ class BodyApi * * Test empty json (request body) * - * @param \OpenAPI\Client\Model\Tag $tag Tag object (optional) + * @param \OpenAPI\Client\Model\Tag|null $tag Tag object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testEchoBodyTagResponseStringAsyncWithHttpInfo($tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]) + public function testEchoBodyTagResponseStringAsyncWithHttpInfo( + $tag = null, + string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testEchoBodyTagResponseStringRequest($tag, $contentType); @@ -1989,13 +2088,16 @@ class BodyApi /** * Create request for operation 'testEchoBodyTagResponseString' * - * @param \OpenAPI\Client\Model\Tag $tag Tag object (optional) + * @param \OpenAPI\Client\Model\Tag|null $tag Tag object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testEchoBodyTagResponseStringRequest($tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0]) + public function testEchoBodyTagResponseStringRequest( + $tag = null, + string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0] + ): Request { @@ -2077,7 +2179,7 @@ class BodyApi * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php index 1106aef1a7b..3a31716e44f 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php @@ -28,6 +28,7 @@ namespace OpenAPI\Client\Api; +use InvalidArgumentException; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; @@ -35,6 +36,7 @@ use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use GuzzleHttp\Promise\PromiseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; @@ -53,22 +55,22 @@ class FormApi /** * @var ClientInterface */ - protected $client; + protected ClientInterface $client; /** * @var Configuration */ - protected $config; + protected Configuration $config; /** * @var HeaderSelector */ - protected $headerSelector; + protected HeaderSelector $headerSelector; /** * @var int Host index */ - protected $hostIndex; + protected int $hostIndex; /** @var string[] $contentTypes **/ public const contentTypes = [ @@ -80,17 +82,17 @@ class FormApi ], ]; -/** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, HeaderSelector $selector = null, - $hostIndex = 0 + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: new Configuration(); @@ -103,7 +105,7 @@ class FormApi * * @param int $hostIndex Host index (required) */ - public function setHostIndex($hostIndex): void + public function setHostIndex(int $hostIndex): void { $this->hostIndex = $hostIndex; } @@ -113,7 +115,7 @@ class FormApi * * @return int Host index */ - public function getHostIndex() + public function getHostIndex(): int { return $this->hostIndex; } @@ -121,7 +123,7 @@ class FormApi /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -131,16 +133,21 @@ class FormApi * * Test form parameter(s) * - * @param int $integer_form integer_form (optional) - * @param bool $boolean_form boolean_form (optional) - * @param string $string_form string_form (optional) + * @param int|null $integer_form integer_form (optional) + * @param bool|null $boolean_form boolean_form (optional) + * @param string|null $string_form string_form (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testFormIntegerBooleanString($integer_form = null, $boolean_form = null, $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]) + public function testFormIntegerBooleanString( + ?int $integer_form = null, + ?bool $boolean_form = null, + ?string $string_form = null, + string $contentType = self::contentTypes['testFormIntegerBooleanString'][0] + ): string { list($response) = $this->testFormIntegerBooleanStringWithHttpInfo($integer_form, $boolean_form, $string_form, $contentType); return $response; @@ -151,16 +158,21 @@ class FormApi * * Test form parameter(s) * - * @param int $integer_form (optional) - * @param bool $boolean_form (optional) - * @param string $string_form (optional) + * @param int|null $integer_form (optional) + * @param bool|null $boolean_form (optional) + * @param string|null $string_form (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testFormIntegerBooleanStringWithHttpInfo($integer_form = null, $boolean_form = null, $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]) + public function testFormIntegerBooleanStringWithHttpInfo( + ?int $integer_form = null, + ?bool $boolean_form = null, + ?string $string_form = null, + string $contentType = self::contentTypes['testFormIntegerBooleanString'][0] + ): array { $request = $this->testFormIntegerBooleanStringRequest($integer_form, $boolean_form, $string_form, $contentType); @@ -253,15 +265,20 @@ class FormApi * * Test form parameter(s) * - * @param int $integer_form (optional) - * @param bool $boolean_form (optional) - * @param string $string_form (optional) + * @param int|null $integer_form (optional) + * @param bool|null $boolean_form (optional) + * @param string|null $string_form (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testFormIntegerBooleanStringAsync($integer_form = null, $boolean_form = null, $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]) + public function testFormIntegerBooleanStringAsync( + ?int $integer_form = null, + ?bool $boolean_form = null, + ?string $string_form = null, + string $contentType = self::contentTypes['testFormIntegerBooleanString'][0] + ): PromiseInterface { return $this->testFormIntegerBooleanStringAsyncWithHttpInfo($integer_form, $boolean_form, $string_form, $contentType) ->then( @@ -276,15 +293,20 @@ class FormApi * * Test form parameter(s) * - * @param int $integer_form (optional) - * @param bool $boolean_form (optional) - * @param string $string_form (optional) + * @param int|null $integer_form (optional) + * @param bool|null $boolean_form (optional) + * @param string|null $string_form (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testFormIntegerBooleanStringAsyncWithHttpInfo($integer_form = null, $boolean_form = null, $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]) + public function testFormIntegerBooleanStringAsyncWithHttpInfo( + $integer_form = null, + $boolean_form = null, + $string_form = null, + string $contentType = self::contentTypes['testFormIntegerBooleanString'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testFormIntegerBooleanStringRequest($integer_form, $boolean_form, $string_form, $contentType); @@ -328,15 +350,20 @@ class FormApi /** * Create request for operation 'testFormIntegerBooleanString' * - * @param int $integer_form (optional) - * @param bool $boolean_form (optional) - * @param string $string_form (optional) + * @param int|null $integer_form (optional) + * @param bool|null $boolean_form (optional) + * @param string|null $string_form (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testFormIntegerBooleanStringRequest($integer_form = null, $boolean_form = null, $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0]) + public function testFormIntegerBooleanStringRequest( + $integer_form = null, + $boolean_form = null, + $string_form = null, + string $contentType = self::contentTypes['testFormIntegerBooleanString'][0] + ): Request { @@ -424,19 +451,27 @@ class FormApi * * Test form parameter(s) for oneOf schema * - * @param string $form1 form1 (optional) - * @param int $form2 form2 (optional) - * @param string $form3 form3 (optional) - * @param bool $form4 form4 (optional) - * @param int $id id (optional) - * @param string $name name (optional) + * @param string|null $form1 form1 (optional) + * @param int|null $form2 form2 (optional) + * @param string|null $form3 form3 (optional) + * @param bool|null $form4 form4 (optional) + * @param int|null $id id (optional) + * @param string|null $name name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testFormOneof($form1 = null, $form2 = null, $form3 = null, $form4 = null, $id = null, $name = null, string $contentType = self::contentTypes['testFormOneof'][0]) + public function testFormOneof( + ?string $form1 = null, + ?int $form2 = null, + ?string $form3 = null, + ?bool $form4 = null, + ?int $id = null, + ?string $name = null, + string $contentType = self::contentTypes['testFormOneof'][0] + ): string { list($response) = $this->testFormOneofWithHttpInfo($form1, $form2, $form3, $form4, $id, $name, $contentType); return $response; @@ -447,19 +482,27 @@ class FormApi * * Test form parameter(s) for oneOf schema * - * @param string $form1 (optional) - * @param int $form2 (optional) - * @param string $form3 (optional) - * @param bool $form4 (optional) - * @param int $id (optional) - * @param string $name (optional) + * @param string|null $form1 (optional) + * @param int|null $form2 (optional) + * @param string|null $form3 (optional) + * @param bool|null $form4 (optional) + * @param int|null $id (optional) + * @param string|null $name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testFormOneofWithHttpInfo($form1 = null, $form2 = null, $form3 = null, $form4 = null, $id = null, $name = null, string $contentType = self::contentTypes['testFormOneof'][0]) + public function testFormOneofWithHttpInfo( + ?string $form1 = null, + ?int $form2 = null, + ?string $form3 = null, + ?bool $form4 = null, + ?int $id = null, + ?string $name = null, + string $contentType = self::contentTypes['testFormOneof'][0] + ): array { $request = $this->testFormOneofRequest($form1, $form2, $form3, $form4, $id, $name, $contentType); @@ -552,18 +595,26 @@ class FormApi * * Test form parameter(s) for oneOf schema * - * @param string $form1 (optional) - * @param int $form2 (optional) - * @param string $form3 (optional) - * @param bool $form4 (optional) - * @param int $id (optional) - * @param string $name (optional) + * @param string|null $form1 (optional) + * @param int|null $form2 (optional) + * @param string|null $form3 (optional) + * @param bool|null $form4 (optional) + * @param int|null $id (optional) + * @param string|null $name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testFormOneofAsync($form1 = null, $form2 = null, $form3 = null, $form4 = null, $id = null, $name = null, string $contentType = self::contentTypes['testFormOneof'][0]) + public function testFormOneofAsync( + ?string $form1 = null, + ?int $form2 = null, + ?string $form3 = null, + ?bool $form4 = null, + ?int $id = null, + ?string $name = null, + string $contentType = self::contentTypes['testFormOneof'][0] + ): PromiseInterface { return $this->testFormOneofAsyncWithHttpInfo($form1, $form2, $form3, $form4, $id, $name, $contentType) ->then( @@ -578,18 +629,26 @@ class FormApi * * Test form parameter(s) for oneOf schema * - * @param string $form1 (optional) - * @param int $form2 (optional) - * @param string $form3 (optional) - * @param bool $form4 (optional) - * @param int $id (optional) - * @param string $name (optional) + * @param string|null $form1 (optional) + * @param int|null $form2 (optional) + * @param string|null $form3 (optional) + * @param bool|null $form4 (optional) + * @param int|null $id (optional) + * @param string|null $name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testFormOneofAsyncWithHttpInfo($form1 = null, $form2 = null, $form3 = null, $form4 = null, $id = null, $name = null, string $contentType = self::contentTypes['testFormOneof'][0]) + public function testFormOneofAsyncWithHttpInfo( + $form1 = null, + $form2 = null, + $form3 = null, + $form4 = null, + $id = null, + $name = null, + string $contentType = self::contentTypes['testFormOneof'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testFormOneofRequest($form1, $form2, $form3, $form4, $id, $name, $contentType); @@ -633,18 +692,26 @@ class FormApi /** * Create request for operation 'testFormOneof' * - * @param string $form1 (optional) - * @param int $form2 (optional) - * @param string $form3 (optional) - * @param bool $form4 (optional) - * @param int $id (optional) - * @param string $name (optional) + * @param string|null $form1 (optional) + * @param int|null $form2 (optional) + * @param string|null $form3 (optional) + * @param bool|null $form4 (optional) + * @param int|null $id (optional) + * @param string|null $name (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testFormOneofRequest($form1 = null, $form2 = null, $form3 = null, $form4 = null, $id = null, $name = null, string $contentType = self::contentTypes['testFormOneof'][0]) + public function testFormOneofRequest( + $form1 = null, + $form2 = null, + $form3 = null, + $form4 = null, + $id = null, + $name = null, + string $contentType = self::contentTypes['testFormOneof'][0] + ): Request { @@ -748,7 +815,7 @@ class FormApi * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php index b0c66c8a3d9..1ce6cf32cc1 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php @@ -28,6 +28,7 @@ namespace OpenAPI\Client\Api; +use InvalidArgumentException; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; @@ -35,6 +36,7 @@ use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use GuzzleHttp\Promise\PromiseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; @@ -53,22 +55,22 @@ class HeaderApi /** * @var ClientInterface */ - protected $client; + protected ClientInterface $client; /** * @var Configuration */ - protected $config; + protected Configuration $config; /** * @var HeaderSelector */ - protected $headerSelector; + protected HeaderSelector $headerSelector; /** * @var int Host index */ - protected $hostIndex; + protected int $hostIndex; /** @var string[] $contentTypes **/ public const contentTypes = [ @@ -77,17 +79,17 @@ class HeaderApi ], ]; -/** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, HeaderSelector $selector = null, - $hostIndex = 0 + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: new Configuration(); @@ -100,7 +102,7 @@ class HeaderApi * * @param int $hostIndex Host index (required) */ - public function setHostIndex($hostIndex): void + public function setHostIndex(int $hostIndex): void { $this->hostIndex = $hostIndex; } @@ -110,7 +112,7 @@ class HeaderApi * * @return int Host index */ - public function getHostIndex() + public function getHostIndex(): int { return $this->hostIndex; } @@ -118,7 +120,7 @@ class HeaderApi /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -128,16 +130,21 @@ class HeaderApi * * Test header parameter(s) * - * @param int $integer_header integer_header (optional) - * @param bool $boolean_header boolean_header (optional) - * @param string $string_header string_header (optional) + * @param int|null $integer_header integer_header (optional) + * @param bool|null $boolean_header boolean_header (optional) + * @param string|null $string_header string_header (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testHeaderIntegerBooleanString($integer_header = null, $boolean_header = null, $string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0]) + public function testHeaderIntegerBooleanString( + ?int $integer_header = null, + ?bool $boolean_header = null, + ?string $string_header = null, + string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0] + ): string { list($response) = $this->testHeaderIntegerBooleanStringWithHttpInfo($integer_header, $boolean_header, $string_header, $contentType); return $response; @@ -148,16 +155,21 @@ class HeaderApi * * Test header parameter(s) * - * @param int $integer_header (optional) - * @param bool $boolean_header (optional) - * @param string $string_header (optional) + * @param int|null $integer_header (optional) + * @param bool|null $boolean_header (optional) + * @param string|null $string_header (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testHeaderIntegerBooleanStringWithHttpInfo($integer_header = null, $boolean_header = null, $string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0]) + public function testHeaderIntegerBooleanStringWithHttpInfo( + ?int $integer_header = null, + ?bool $boolean_header = null, + ?string $string_header = null, + string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0] + ): array { $request = $this->testHeaderIntegerBooleanStringRequest($integer_header, $boolean_header, $string_header, $contentType); @@ -250,15 +262,20 @@ class HeaderApi * * Test header parameter(s) * - * @param int $integer_header (optional) - * @param bool $boolean_header (optional) - * @param string $string_header (optional) + * @param int|null $integer_header (optional) + * @param bool|null $boolean_header (optional) + * @param string|null $string_header (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testHeaderIntegerBooleanStringAsync($integer_header = null, $boolean_header = null, $string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0]) + public function testHeaderIntegerBooleanStringAsync( + ?int $integer_header = null, + ?bool $boolean_header = null, + ?string $string_header = null, + string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0] + ): PromiseInterface { return $this->testHeaderIntegerBooleanStringAsyncWithHttpInfo($integer_header, $boolean_header, $string_header, $contentType) ->then( @@ -273,15 +290,20 @@ class HeaderApi * * Test header parameter(s) * - * @param int $integer_header (optional) - * @param bool $boolean_header (optional) - * @param string $string_header (optional) + * @param int|null $integer_header (optional) + * @param bool|null $boolean_header (optional) + * @param string|null $string_header (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testHeaderIntegerBooleanStringAsyncWithHttpInfo($integer_header = null, $boolean_header = null, $string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0]) + public function testHeaderIntegerBooleanStringAsyncWithHttpInfo( + $integer_header = null, + $boolean_header = null, + $string_header = null, + string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testHeaderIntegerBooleanStringRequest($integer_header, $boolean_header, $string_header, $contentType); @@ -325,15 +347,20 @@ class HeaderApi /** * Create request for operation 'testHeaderIntegerBooleanString' * - * @param int $integer_header (optional) - * @param bool $boolean_header (optional) - * @param string $string_header (optional) + * @param int|null $integer_header (optional) + * @param bool|null $boolean_header (optional) + * @param string|null $string_header (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanString'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testHeaderIntegerBooleanStringRequest($integer_header = null, $boolean_header = null, $string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0]) + public function testHeaderIntegerBooleanStringRequest( + $integer_header = null, + $boolean_header = null, + $string_header = null, + string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0] + ): Request { @@ -422,7 +449,7 @@ class HeaderApi * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php index a71380ffbd2..d0d9836bc7a 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php @@ -28,6 +28,7 @@ namespace OpenAPI\Client\Api; +use InvalidArgumentException; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; @@ -35,6 +36,7 @@ use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use GuzzleHttp\Promise\PromiseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; @@ -53,22 +55,22 @@ class PathApi /** * @var ClientInterface */ - protected $client; + protected ClientInterface $client; /** * @var Configuration */ - protected $config; + protected Configuration $config; /** * @var HeaderSelector */ - protected $headerSelector; + protected HeaderSelector $headerSelector; /** * @var int Host index */ - protected $hostIndex; + protected int $hostIndex; /** @var string[] $contentTypes **/ public const contentTypes = [ @@ -77,17 +79,17 @@ class PathApi ], ]; -/** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, HeaderSelector $selector = null, - $hostIndex = 0 + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: new Configuration(); @@ -100,7 +102,7 @@ class PathApi * * @param int $hostIndex Host index (required) */ - public function setHostIndex($hostIndex): void + public function setHostIndex(int $hostIndex): void { $this->hostIndex = $hostIndex; } @@ -110,7 +112,7 @@ class PathApi * * @return int Host index */ - public function getHostIndex() + public function getHostIndex(): int { return $this->hostIndex; } @@ -118,7 +120,7 @@ class PathApi /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -132,11 +134,15 @@ class PathApi * @param int $path_integer path_integer (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathInteger'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testsPathStringPathStringIntegerPathInteger($path_string, $path_integer, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0]) + public function testsPathStringPathStringIntegerPathInteger( + string $path_string, + int $path_integer, + string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0] + ): string { list($response) = $this->testsPathStringPathStringIntegerPathIntegerWithHttpInfo($path_string, $path_integer, $contentType); return $response; @@ -151,11 +157,15 @@ class PathApi * @param int $path_integer (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathInteger'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testsPathStringPathStringIntegerPathIntegerWithHttpInfo($path_string, $path_integer, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0]) + public function testsPathStringPathStringIntegerPathIntegerWithHttpInfo( + string $path_string, + int $path_integer, + string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0] + ): array { $request = $this->testsPathStringPathStringIntegerPathIntegerRequest($path_string, $path_integer, $contentType); @@ -252,10 +262,14 @@ class PathApi * @param int $path_integer (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathInteger'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testsPathStringPathStringIntegerPathIntegerAsync($path_string, $path_integer, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0]) + public function testsPathStringPathStringIntegerPathIntegerAsync( + string $path_string, + int $path_integer, + string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0] + ): PromiseInterface { return $this->testsPathStringPathStringIntegerPathIntegerAsyncWithHttpInfo($path_string, $path_integer, $contentType) ->then( @@ -274,10 +288,14 @@ class PathApi * @param int $path_integer (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathInteger'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testsPathStringPathStringIntegerPathIntegerAsyncWithHttpInfo($path_string, $path_integer, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0]) + public function testsPathStringPathStringIntegerPathIntegerAsyncWithHttpInfo( + $path_string, + $path_integer, + string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testsPathStringPathStringIntegerPathIntegerRequest($path_string, $path_integer, $contentType); @@ -325,22 +343,26 @@ class PathApi * @param int $path_integer (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathInteger'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testsPathStringPathStringIntegerPathIntegerRequest($path_string, $path_integer, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0]) + public function testsPathStringPathStringIntegerPathIntegerRequest( + $path_string, + $path_integer, + string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0] + ): Request { // verify the required parameter 'path_string' is set if ($path_string === null || (is_array($path_string) && count($path_string) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $path_string when calling testsPathStringPathStringIntegerPathInteger' ); } // verify the required parameter 'path_integer' is set if ($path_integer === null || (is_array($path_integer) && count($path_integer) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $path_integer when calling testsPathStringPathStringIntegerPathInteger' ); } @@ -432,7 +454,7 @@ class PathApi * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php index 2aa16de6f70..7fc0dbe391e 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php @@ -28,6 +28,7 @@ namespace OpenAPI\Client\Api; +use InvalidArgumentException; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; @@ -35,6 +36,7 @@ use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use GuzzleHttp\Promise\PromiseInterface; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; use OpenAPI\Client\HeaderSelector; @@ -53,22 +55,22 @@ class QueryApi /** * @var ClientInterface */ - protected $client; + protected ClientInterface $client; /** * @var Configuration */ - protected $config; + protected Configuration $config; /** * @var HeaderSelector */ - protected $headerSelector; + protected HeaderSelector $headerSelector; /** * @var int Host index */ - protected $hostIndex; + protected int $hostIndex; /** @var string[] $contentTypes **/ public const contentTypes = [ @@ -98,17 +100,17 @@ class QueryApi ], ]; -/** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( ClientInterface $client = null, Configuration $config = null, HeaderSelector $selector = null, - $hostIndex = 0 + int $hostIndex = 0 ) { $this->client = $client ?: new Client(); $this->config = $config ?: new Configuration(); @@ -121,7 +123,7 @@ class QueryApi * * @param int $hostIndex Host index (required) */ - public function setHostIndex($hostIndex): void + public function setHostIndex(int $hostIndex): void { $this->hostIndex = $hostIndex; } @@ -131,7 +133,7 @@ class QueryApi * * @return int Host index */ - public function getHostIndex() + public function getHostIndex(): int { return $this->hostIndex; } @@ -139,7 +141,7 @@ class QueryApi /** * @return Configuration */ - public function getConfig() + public function getConfig(): Configuration { return $this->config; } @@ -149,14 +151,17 @@ class QueryApi * * Test query parameter(s) * - * @param StringEnumRef $enum_ref_string_query enum_ref_string_query (optional) + * @param StringEnumRef|null $enum_ref_string_query enum_ref_string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testEnumRefString($enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0]) + public function testEnumRefString( + ?StringEnumRef $enum_ref_string_query = null, + string $contentType = self::contentTypes['testEnumRefString'][0] + ): string { list($response) = $this->testEnumRefStringWithHttpInfo($enum_ref_string_query, $contentType); return $response; @@ -167,14 +172,17 @@ class QueryApi * * Test query parameter(s) * - * @param StringEnumRef $enum_ref_string_query (optional) + * @param StringEnumRef|null $enum_ref_string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testEnumRefStringWithHttpInfo($enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0]) + public function testEnumRefStringWithHttpInfo( + ?StringEnumRef $enum_ref_string_query = null, + string $contentType = self::contentTypes['testEnumRefString'][0] + ): array { $request = $this->testEnumRefStringRequest($enum_ref_string_query, $contentType); @@ -267,13 +275,16 @@ class QueryApi * * Test query parameter(s) * - * @param StringEnumRef $enum_ref_string_query (optional) + * @param StringEnumRef|null $enum_ref_string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testEnumRefStringAsync($enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0]) + public function testEnumRefStringAsync( + ?StringEnumRef $enum_ref_string_query = null, + string $contentType = self::contentTypes['testEnumRefString'][0] + ): PromiseInterface { return $this->testEnumRefStringAsyncWithHttpInfo($enum_ref_string_query, $contentType) ->then( @@ -288,13 +299,16 @@ class QueryApi * * Test query parameter(s) * - * @param StringEnumRef $enum_ref_string_query (optional) + * @param StringEnumRef|null $enum_ref_string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testEnumRefStringAsyncWithHttpInfo($enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0]) + public function testEnumRefStringAsyncWithHttpInfo( + $enum_ref_string_query = null, + string $contentType = self::contentTypes['testEnumRefString'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testEnumRefStringRequest($enum_ref_string_query, $contentType); @@ -338,13 +352,16 @@ class QueryApi /** * Create request for operation 'testEnumRefString' * - * @param StringEnumRef $enum_ref_string_query (optional) + * @param StringEnumRef|null $enum_ref_string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testEnumRefStringRequest($enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0]) + public function testEnumRefStringRequest( + $enum_ref_string_query = null, + string $contentType = self::contentTypes['testEnumRefString'][0] + ): Request { @@ -427,16 +444,21 @@ class QueryApi * * Test query parameter(s) * - * @param \DateTime $datetime_query datetime_query (optional) - * @param \DateTime $date_query date_query (optional) - * @param string $string_query string_query (optional) + * @param \DateTime|null $datetime_query datetime_query (optional) + * @param \DateTime|null $date_query date_query (optional) + * @param string|null $string_query string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testQueryDatetimeDateString($datetime_query = null, $date_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0]) + public function testQueryDatetimeDateString( + ?\DateTime $datetime_query = null, + ?\DateTime $date_query = null, + ?string $string_query = null, + string $contentType = self::contentTypes['testQueryDatetimeDateString'][0] + ): string { list($response) = $this->testQueryDatetimeDateStringWithHttpInfo($datetime_query, $date_query, $string_query, $contentType); return $response; @@ -447,16 +469,21 @@ class QueryApi * * Test query parameter(s) * - * @param \DateTime $datetime_query (optional) - * @param \DateTime $date_query (optional) - * @param string $string_query (optional) + * @param \DateTime|null $datetime_query (optional) + * @param \DateTime|null $date_query (optional) + * @param string|null $string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testQueryDatetimeDateStringWithHttpInfo($datetime_query = null, $date_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0]) + public function testQueryDatetimeDateStringWithHttpInfo( + ?\DateTime $datetime_query = null, + ?\DateTime $date_query = null, + ?string $string_query = null, + string $contentType = self::contentTypes['testQueryDatetimeDateString'][0] + ): array { $request = $this->testQueryDatetimeDateStringRequest($datetime_query, $date_query, $string_query, $contentType); @@ -549,15 +576,20 @@ class QueryApi * * Test query parameter(s) * - * @param \DateTime $datetime_query (optional) - * @param \DateTime $date_query (optional) - * @param string $string_query (optional) + * @param \DateTime|null $datetime_query (optional) + * @param \DateTime|null $date_query (optional) + * @param string|null $string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryDatetimeDateStringAsync($datetime_query = null, $date_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0]) + public function testQueryDatetimeDateStringAsync( + ?\DateTime $datetime_query = null, + ?\DateTime $date_query = null, + ?string $string_query = null, + string $contentType = self::contentTypes['testQueryDatetimeDateString'][0] + ): PromiseInterface { return $this->testQueryDatetimeDateStringAsyncWithHttpInfo($datetime_query, $date_query, $string_query, $contentType) ->then( @@ -572,15 +604,20 @@ class QueryApi * * Test query parameter(s) * - * @param \DateTime $datetime_query (optional) - * @param \DateTime $date_query (optional) - * @param string $string_query (optional) + * @param \DateTime|null $datetime_query (optional) + * @param \DateTime|null $date_query (optional) + * @param string|null $string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryDatetimeDateStringAsyncWithHttpInfo($datetime_query = null, $date_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0]) + public function testQueryDatetimeDateStringAsyncWithHttpInfo( + $datetime_query = null, + $date_query = null, + $string_query = null, + string $contentType = self::contentTypes['testQueryDatetimeDateString'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testQueryDatetimeDateStringRequest($datetime_query, $date_query, $string_query, $contentType); @@ -624,15 +661,20 @@ class QueryApi /** * Create request for operation 'testQueryDatetimeDateString' * - * @param \DateTime $datetime_query (optional) - * @param \DateTime $date_query (optional) - * @param string $string_query (optional) + * @param \DateTime|null $datetime_query (optional) + * @param \DateTime|null $date_query (optional) + * @param string|null $string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testQueryDatetimeDateStringRequest($datetime_query = null, $date_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0]) + public function testQueryDatetimeDateStringRequest( + $datetime_query = null, + $date_query = null, + $string_query = null, + string $contentType = self::contentTypes['testQueryDatetimeDateString'][0] + ): Request { @@ -735,16 +777,21 @@ class QueryApi * * Test query parameter(s) * - * @param int $integer_query integer_query (optional) - * @param bool $boolean_query boolean_query (optional) - * @param string $string_query string_query (optional) + * @param int|null $integer_query integer_query (optional) + * @param bool|null $boolean_query boolean_query (optional) + * @param string|null $string_query string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testQueryIntegerBooleanString($integer_query = null, $boolean_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0]) + public function testQueryIntegerBooleanString( + ?int $integer_query = null, + ?bool $boolean_query = null, + ?string $string_query = null, + string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0] + ): string { list($response) = $this->testQueryIntegerBooleanStringWithHttpInfo($integer_query, $boolean_query, $string_query, $contentType); return $response; @@ -755,16 +802,21 @@ class QueryApi * * Test query parameter(s) * - * @param int $integer_query (optional) - * @param bool $boolean_query (optional) - * @param string $string_query (optional) + * @param int|null $integer_query (optional) + * @param bool|null $boolean_query (optional) + * @param string|null $string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testQueryIntegerBooleanStringWithHttpInfo($integer_query = null, $boolean_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0]) + public function testQueryIntegerBooleanStringWithHttpInfo( + ?int $integer_query = null, + ?bool $boolean_query = null, + ?string $string_query = null, + string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0] + ): array { $request = $this->testQueryIntegerBooleanStringRequest($integer_query, $boolean_query, $string_query, $contentType); @@ -857,15 +909,20 @@ class QueryApi * * Test query parameter(s) * - * @param int $integer_query (optional) - * @param bool $boolean_query (optional) - * @param string $string_query (optional) + * @param int|null $integer_query (optional) + * @param bool|null $boolean_query (optional) + * @param string|null $string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryIntegerBooleanStringAsync($integer_query = null, $boolean_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0]) + public function testQueryIntegerBooleanStringAsync( + ?int $integer_query = null, + ?bool $boolean_query = null, + ?string $string_query = null, + string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0] + ): PromiseInterface { return $this->testQueryIntegerBooleanStringAsyncWithHttpInfo($integer_query, $boolean_query, $string_query, $contentType) ->then( @@ -880,15 +937,20 @@ class QueryApi * * Test query parameter(s) * - * @param int $integer_query (optional) - * @param bool $boolean_query (optional) - * @param string $string_query (optional) + * @param int|null $integer_query (optional) + * @param bool|null $boolean_query (optional) + * @param string|null $string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryIntegerBooleanStringAsyncWithHttpInfo($integer_query = null, $boolean_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0]) + public function testQueryIntegerBooleanStringAsyncWithHttpInfo( + $integer_query = null, + $boolean_query = null, + $string_query = null, + string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testQueryIntegerBooleanStringRequest($integer_query, $boolean_query, $string_query, $contentType); @@ -932,15 +994,20 @@ class QueryApi /** * Create request for operation 'testQueryIntegerBooleanString' * - * @param int $integer_query (optional) - * @param bool $boolean_query (optional) - * @param string $string_query (optional) + * @param int|null $integer_query (optional) + * @param bool|null $boolean_query (optional) + * @param string|null $string_query (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testQueryIntegerBooleanStringRequest($integer_query = null, $boolean_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0]) + public function testQueryIntegerBooleanStringRequest( + $integer_query = null, + $boolean_query = null, + $string_query = null, + string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0] + ): Request { @@ -1043,14 +1110,17 @@ class QueryApi * * Test query parameter(s) * - * @param Pet $query_object query_object (optional) + * @param Pet|null $query_object query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testQueryStyleDeepObjectExplodeTrueObject($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0]) + public function testQueryStyleDeepObjectExplodeTrueObject( + ?Pet $query_object = null, + string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0] + ): string { list($response) = $this->testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo($query_object, $contentType); return $response; @@ -1061,14 +1131,17 @@ class QueryApi * * Test query parameter(s) * - * @param Pet $query_object (optional) + * @param Pet|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0]) + public function testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo( + ?Pet $query_object = null, + string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0] + ): array { $request = $this->testQueryStyleDeepObjectExplodeTrueObjectRequest($query_object, $contentType); @@ -1161,13 +1234,16 @@ class QueryApi * * Test query parameter(s) * - * @param Pet $query_object (optional) + * @param Pet|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryStyleDeepObjectExplodeTrueObjectAsync($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0]) + public function testQueryStyleDeepObjectExplodeTrueObjectAsync( + ?Pet $query_object = null, + string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0] + ): PromiseInterface { return $this->testQueryStyleDeepObjectExplodeTrueObjectAsyncWithHttpInfo($query_object, $contentType) ->then( @@ -1182,13 +1258,16 @@ class QueryApi * * Test query parameter(s) * - * @param Pet $query_object (optional) + * @param Pet|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryStyleDeepObjectExplodeTrueObjectAsyncWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0]) + public function testQueryStyleDeepObjectExplodeTrueObjectAsyncWithHttpInfo( + $query_object = null, + string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testQueryStyleDeepObjectExplodeTrueObjectRequest($query_object, $contentType); @@ -1232,13 +1311,16 @@ class QueryApi /** * Create request for operation 'testQueryStyleDeepObjectExplodeTrueObject' * - * @param Pet $query_object (optional) + * @param Pet|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testQueryStyleDeepObjectExplodeTrueObjectRequest($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0]) + public function testQueryStyleDeepObjectExplodeTrueObjectRequest( + $query_object = null, + string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0] + ): Request { @@ -1321,14 +1403,17 @@ class QueryApi * * Test query parameter(s) * - * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object query_object (optional) + * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter|null $query_object query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testQueryStyleDeepObjectExplodeTrueObjectAllOf($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0]) + public function testQueryStyleDeepObjectExplodeTrueObjectAllOf( + ?TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object = null, + string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0] + ): string { list($response) = $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo($query_object, $contentType); return $response; @@ -1339,14 +1424,17 @@ class QueryApi * * Test query parameter(s) * - * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object (optional) + * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0]) + public function testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo( + ?TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object = null, + string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0] + ): array { $request = $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest($query_object, $contentType); @@ -1439,13 +1527,16 @@ class QueryApi * * Test query parameter(s) * - * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object (optional) + * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryStyleDeepObjectExplodeTrueObjectAllOfAsync($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0]) + public function testQueryStyleDeepObjectExplodeTrueObjectAllOfAsync( + ?TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object = null, + string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0] + ): PromiseInterface { return $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfAsyncWithHttpInfo($query_object, $contentType) ->then( @@ -1460,13 +1551,16 @@ class QueryApi * * Test query parameter(s) * - * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object (optional) + * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryStyleDeepObjectExplodeTrueObjectAllOfAsyncWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0]) + public function testQueryStyleDeepObjectExplodeTrueObjectAllOfAsyncWithHttpInfo( + $query_object = null, + string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest($query_object, $contentType); @@ -1510,13 +1604,16 @@ class QueryApi /** * Create request for operation 'testQueryStyleDeepObjectExplodeTrueObjectAllOf' * - * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object (optional) + * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0]) + public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest( + $query_object = null, + string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0] + ): Request { @@ -1599,14 +1696,17 @@ class QueryApi * * Test query parameter(s) * - * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object query_object (optional) + * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter|null $query_object query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testQueryStyleFormExplodeTrueArrayString($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0]) + public function testQueryStyleFormExplodeTrueArrayString( + ?TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0] + ): string { list($response) = $this->testQueryStyleFormExplodeTrueArrayStringWithHttpInfo($query_object, $contentType); return $response; @@ -1617,14 +1717,17 @@ class QueryApi * * Test query parameter(s) * - * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object (optional) + * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testQueryStyleFormExplodeTrueArrayStringWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0]) + public function testQueryStyleFormExplodeTrueArrayStringWithHttpInfo( + ?TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0] + ): array { $request = $this->testQueryStyleFormExplodeTrueArrayStringRequest($query_object, $contentType); @@ -1717,13 +1820,16 @@ class QueryApi * * Test query parameter(s) * - * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object (optional) + * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryStyleFormExplodeTrueArrayStringAsync($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0]) + public function testQueryStyleFormExplodeTrueArrayStringAsync( + ?TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0] + ): PromiseInterface { return $this->testQueryStyleFormExplodeTrueArrayStringAsyncWithHttpInfo($query_object, $contentType) ->then( @@ -1738,13 +1844,16 @@ class QueryApi * * Test query parameter(s) * - * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object (optional) + * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryStyleFormExplodeTrueArrayStringAsyncWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0]) + public function testQueryStyleFormExplodeTrueArrayStringAsyncWithHttpInfo( + $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testQueryStyleFormExplodeTrueArrayStringRequest($query_object, $contentType); @@ -1788,13 +1897,16 @@ class QueryApi /** * Create request for operation 'testQueryStyleFormExplodeTrueArrayString' * - * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object (optional) + * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testQueryStyleFormExplodeTrueArrayStringRequest($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0]) + public function testQueryStyleFormExplodeTrueArrayStringRequest( + $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0] + ): Request { @@ -1877,14 +1989,17 @@ class QueryApi * * Test query parameter(s) * - * @param Pet $query_object query_object (optional) + * @param Pet|null $query_object query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testQueryStyleFormExplodeTrueObject($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0]) + public function testQueryStyleFormExplodeTrueObject( + ?Pet $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0] + ): string { list($response) = $this->testQueryStyleFormExplodeTrueObjectWithHttpInfo($query_object, $contentType); return $response; @@ -1895,14 +2010,17 @@ class QueryApi * * Test query parameter(s) * - * @param Pet $query_object (optional) + * @param Pet|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testQueryStyleFormExplodeTrueObjectWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0]) + public function testQueryStyleFormExplodeTrueObjectWithHttpInfo( + ?Pet $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0] + ): array { $request = $this->testQueryStyleFormExplodeTrueObjectRequest($query_object, $contentType); @@ -1995,13 +2113,16 @@ class QueryApi * * Test query parameter(s) * - * @param Pet $query_object (optional) + * @param Pet|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryStyleFormExplodeTrueObjectAsync($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0]) + public function testQueryStyleFormExplodeTrueObjectAsync( + ?Pet $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0] + ): PromiseInterface { return $this->testQueryStyleFormExplodeTrueObjectAsyncWithHttpInfo($query_object, $contentType) ->then( @@ -2016,13 +2137,16 @@ class QueryApi * * Test query parameter(s) * - * @param Pet $query_object (optional) + * @param Pet|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryStyleFormExplodeTrueObjectAsyncWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0]) + public function testQueryStyleFormExplodeTrueObjectAsyncWithHttpInfo( + $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testQueryStyleFormExplodeTrueObjectRequest($query_object, $contentType); @@ -2066,13 +2190,16 @@ class QueryApi /** * Create request for operation 'testQueryStyleFormExplodeTrueObject' * - * @param Pet $query_object (optional) + * @param Pet|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testQueryStyleFormExplodeTrueObjectRequest($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0]) + public function testQueryStyleFormExplodeTrueObjectRequest( + $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0] + ): Request { @@ -2155,14 +2282,17 @@ class QueryApi * * Test query parameter(s) * - * @param DataQuery $query_object query_object (optional) + * @param DataQuery|null $query_object query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return string */ - public function testQueryStyleFormExplodeTrueObjectAllOf($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0]) + public function testQueryStyleFormExplodeTrueObjectAllOf( + ?DataQuery $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0] + ): string { list($response) = $this->testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo($query_object, $contentType); return $response; @@ -2173,14 +2303,17 @@ class QueryApi * * Test query parameter(s) * - * @param DataQuery $query_object (optional) + * @param DataQuery|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) */ - public function testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0]) + public function testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo( + ?DataQuery $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0] + ): array { $request = $this->testQueryStyleFormExplodeTrueObjectAllOfRequest($query_object, $contentType); @@ -2273,13 +2406,16 @@ class QueryApi * * Test query parameter(s) * - * @param DataQuery $query_object (optional) + * @param DataQuery|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryStyleFormExplodeTrueObjectAllOfAsync($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0]) + public function testQueryStyleFormExplodeTrueObjectAllOfAsync( + ?DataQuery $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0] + ): PromiseInterface { return $this->testQueryStyleFormExplodeTrueObjectAllOfAsyncWithHttpInfo($query_object, $contentType) ->then( @@ -2294,13 +2430,16 @@ class QueryApi * * Test query parameter(s) * - * @param DataQuery $query_object (optional) + * @param DataQuery|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testQueryStyleFormExplodeTrueObjectAllOfAsyncWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0]) + public function testQueryStyleFormExplodeTrueObjectAllOfAsyncWithHttpInfo( + $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0] + ): PromiseInterface { $returnType = 'string'; $request = $this->testQueryStyleFormExplodeTrueObjectAllOfRequest($query_object, $contentType); @@ -2344,13 +2483,16 @@ class QueryApi /** * Create request for operation 'testQueryStyleFormExplodeTrueObjectAllOf' * - * @param DataQuery $query_object (optional) + * @param DataQuery|null $query_object (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testQueryStyleFormExplodeTrueObjectAllOfRequest($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0]) + public function testQueryStyleFormExplodeTrueObjectAllOfRequest( + $query_object = null, + string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0] + ): Request { @@ -2434,7 +2576,7 @@ class QueryApi * @throws \RuntimeException on file opening failure * @return array of http client options */ - protected function createHttpClientOption() + protected function createHttpClientOption(): array { $options = []; if ($this->config->getDebug()) { diff --git a/samples/client/echo_api/php-nextgen/src/ApiException.php b/samples/client/echo_api/php-nextgen/src/ApiException.php index db9919eff9a..886493dd047 100644 --- a/samples/client/echo_api/php-nextgen/src/ApiException.php +++ b/samples/client/echo_api/php-nextgen/src/ApiException.php @@ -28,7 +28,8 @@ namespace OpenAPI\Client; -use \Exception; +use Exception; +use stdClass; /** * ApiException Class Doc Comment @@ -43,23 +44,23 @@ class ApiException extends Exception /** * The HTTP body of the server response either as Json or string. * - * @var \stdClass|string|null + * @var stdClass|string|null */ - protected $responseBody; + protected stdClass|string|null $responseBody; /** * The HTTP header of the server response. * * @var string[]|null */ - protected $responseHeaders; + protected ?array $responseHeaders; /** * The deserialized response object * - * @var \stdClass|string|null + * @var mixed */ - protected $responseObject; + protected mixed $responseObject; /** * Constructor @@ -67,9 +68,9 @@ class ApiException extends Exception * @param string $message Error message * @param int $code HTTP status code * @param string[]|null $responseHeaders HTTP response header - * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string + * @param mixed $responseBody HTTP decoded body of the server response either as stdClass or string */ - public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) + public function __construct(string $message = "", int $code = 0, ?array $responseHeaders = [], mixed $responseBody = null) { parent::__construct($message, $code); $this->responseHeaders = $responseHeaders; @@ -81,7 +82,7 @@ class ApiException extends Exception * * @return string[]|null HTTP response header */ - public function getResponseHeaders() + public function getResponseHeaders(): ?array { return $this->responseHeaders; } @@ -89,9 +90,9 @@ class ApiException extends Exception /** * Gets the HTTP body of the server response either as Json or string * - * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + * @return stdClass|string|null HTTP body of the server response either as \stdClass or string */ - public function getResponseBody() + public function getResponseBody(): stdClass|string|null { return $this->responseBody; } @@ -103,7 +104,7 @@ class ApiException extends Exception * * @return void */ - public function setResponseObject($obj) + public function setResponseObject(mixed $obj): void { $this->responseObject = $obj; } @@ -113,7 +114,7 @@ class ApiException extends Exception * * @return mixed the deserialized response object */ - public function getResponseObject() + public function getResponseObject(): mixed { return $this->responseObject; } diff --git a/samples/client/echo_api/php-nextgen/src/Configuration.php b/samples/client/echo_api/php-nextgen/src/Configuration.php index c3e83b87b2f..89415591183 100644 --- a/samples/client/echo_api/php-nextgen/src/Configuration.php +++ b/samples/client/echo_api/php-nextgen/src/Configuration.php @@ -28,6 +28,8 @@ namespace OpenAPI\Client; +use InvalidArgumentException; + /** * Configuration Class Doc Comment * @@ -42,86 +44,86 @@ class Configuration public const BOOLEAN_FORMAT_STRING = 'string'; /** - * @var Configuration + * @var Configuration|null */ - private static $defaultConfiguration; + private static ?Configuration $defaultConfiguration = null; /** * Associate array to store API key(s) * * @var string[] */ - protected $apiKeys = []; + protected array $apiKeys = []; /** * Associate array to store API prefix (e.g. Bearer) * * @var string[] */ - protected $apiKeyPrefixes = []; + protected array $apiKeyPrefixes = []; /** * Access token for OAuth/Bearer authentication * * @var string */ - protected $accessToken = ''; + protected string $accessToken = ''; /** * Boolean format for query string * * @var string */ - protected $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT; + protected string $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT; /** * Username for HTTP basic authentication * * @var string */ - protected $username = ''; + protected string $username = ''; /** * Password for HTTP basic authentication * * @var string */ - protected $password = ''; + protected string $password = ''; /** * The host * * @var string */ - protected $host = 'http://localhost:3000'; + protected string $host = 'http://localhost:3000'; /** * User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default * * @var string */ - protected $userAgent = 'OpenAPI-Generator/1.0.0/PHP'; + protected string $userAgent = 'OpenAPI-Generator/1.0.0/PHP'; /** * Debug switch (default set to false) * * @var bool */ - protected $debug = false; + protected bool $debug = false; /** * Debug file location (log to STDOUT by default) * * @var string */ - protected $debugFile = 'php://output'; + protected string $debugFile = 'php://output'; /** * Debug file location (log to STDOUT by default) * * @var string */ - protected $tempFolderPath; + protected string $tempFolderPath; /** * Constructor @@ -139,7 +141,7 @@ class Configuration * * @return $this */ - public function setApiKey($apiKeyIdentifier, $key) + public function setApiKey(string $apiKeyIdentifier, string $key): static { $this->apiKeys[$apiKeyIdentifier] = $key; return $this; @@ -152,9 +154,9 @@ class Configuration * * @return null|string API key or token */ - public function getApiKey($apiKeyIdentifier) + public function getApiKey(string $apiKeyIdentifier): ?string { - return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + return $this->apiKeys[$apiKeyIdentifier] ?? null; } /** @@ -165,7 +167,7 @@ class Configuration * * @return $this */ - public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static { $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; return $this; @@ -178,9 +180,9 @@ class Configuration * * @return null|string */ - public function getApiKeyPrefix($apiKeyIdentifier) + public function getApiKeyPrefix(string $apiKeyIdentifier): ?string { - return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null; } /** @@ -190,7 +192,7 @@ class Configuration * * @return $this */ - public function setAccessToken($accessToken) + public function setAccessToken(string $accessToken): static { $this->accessToken = $accessToken; return $this; @@ -201,7 +203,7 @@ class Configuration * * @return string Access token for OAuth */ - public function getAccessToken() + public function getAccessToken(): string { return $this->accessToken; } @@ -209,11 +211,11 @@ class Configuration /** * Sets boolean format for query string. * - * @param string $booleanFormatForQueryString Boolean format for query string + * @param string $booleanFormat Boolean format for query string * * @return $this */ - public function setBooleanFormatForQueryString(string $booleanFormat) + public function setBooleanFormatForQueryString(string $booleanFormat): static { $this->booleanFormatForQueryString = $booleanFormat; @@ -237,7 +239,7 @@ class Configuration * * @return $this */ - public function setUsername($username) + public function setUsername(string $username): static { $this->username = $username; return $this; @@ -248,7 +250,7 @@ class Configuration * * @return string Username for HTTP basic authentication */ - public function getUsername() + public function getUsername(): string { return $this->username; } @@ -260,7 +262,7 @@ class Configuration * * @return $this */ - public function setPassword($password) + public function setPassword(string $password): static { $this->password = $password; return $this; @@ -271,7 +273,7 @@ class Configuration * * @return string Password for HTTP basic authentication */ - public function getPassword() + public function getPassword(): string { return $this->password; } @@ -283,7 +285,7 @@ class Configuration * * @return $this */ - public function setHost($host) + public function setHost(string $host): static { $this->host = $host; return $this; @@ -294,7 +296,7 @@ class Configuration * * @return string Host */ - public function getHost() + public function getHost(): string { return $this->host; } @@ -304,15 +306,11 @@ class Configuration * * @param string $userAgent the user agent of the api client * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return $this */ - public function setUserAgent($userAgent) + public function setUserAgent(string $userAgent): static { - if (!is_string($userAgent)) { - throw new \InvalidArgumentException('User-agent must be a string.'); - } - $this->userAgent = $userAgent; return $this; } @@ -322,7 +320,7 @@ class Configuration * * @return string user agent */ - public function getUserAgent() + public function getUserAgent(): string { return $this->userAgent; } @@ -334,7 +332,7 @@ class Configuration * * @return $this */ - public function setDebug($debug) + public function setDebug(bool $debug): static { $this->debug = $debug; return $this; @@ -345,7 +343,7 @@ class Configuration * * @return bool */ - public function getDebug() + public function getDebug(): bool { return $this->debug; } @@ -357,7 +355,7 @@ class Configuration * * @return $this */ - public function setDebugFile($debugFile) + public function setDebugFile(string $debugFile): static { $this->debugFile = $debugFile; return $this; @@ -368,7 +366,7 @@ class Configuration * * @return string */ - public function getDebugFile() + public function getDebugFile(): string { return $this->debugFile; } @@ -380,7 +378,7 @@ class Configuration * * @return $this */ - public function setTempFolderPath($tempFolderPath) + public function setTempFolderPath(string $tempFolderPath): static { $this->tempFolderPath = $tempFolderPath; return $this; @@ -391,7 +389,7 @@ class Configuration * * @return string Temp folder path */ - public function getTempFolderPath() + public function getTempFolderPath(): string { return $this->tempFolderPath; } @@ -401,7 +399,7 @@ class Configuration * * @return Configuration */ - public static function getDefaultConfiguration() + public static function getDefaultConfiguration(): Configuration { if (self::$defaultConfiguration === null) { self::$defaultConfiguration = new Configuration(); @@ -417,7 +415,7 @@ class Configuration * * @return void */ - public static function setDefaultConfiguration(Configuration $config) + public static function setDefaultConfiguration(Configuration $config): void { self::$defaultConfiguration = $config; } @@ -427,7 +425,7 @@ class Configuration * * @return string The report for debugging */ - public static function toDebugReport() + public static function toDebugReport(): string { $report = 'PHP SDK (OpenAPI\Client) Debug Report:' . PHP_EOL; $report .= ' OS: ' . php_uname() . PHP_EOL; @@ -445,7 +443,7 @@ class Configuration * * @return null|string API key with the prefix */ - public function getApiKeyWithPrefix($apiKeyIdentifier) + public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string { $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); $apiKey = $this->getApiKey($apiKeyIdentifier); @@ -468,7 +466,7 @@ class Configuration * * @return array an array of host settings */ - public function getHostSettings() + public function getHostSettings(): array { return [ [ @@ -481,12 +479,12 @@ class Configuration /** * Returns URL based on host settings, index and variables * - * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param array $hostsSettings array of host settings, generated from getHostSettings() or equivalent from the API clients * @param int $hostIndex index of the host settings * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null) + public static function getHostString(array $hostsSettings, int $hostIndex, array $variables = null): string { if (null === $variables) { $variables = []; @@ -494,7 +492,7 @@ class Configuration // check array index out of bound if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) { - throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings)); + throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings)); } $host = $hostsSettings[$hostIndex]; @@ -506,7 +504,7 @@ class Configuration if (!isset($variable['enum_values']) || 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"])."."); + throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); } } else { // use default value @@ -524,7 +522,7 @@ class Configuration * @param array|null $variables hash of variable and the corresponding value (optional) * @return string URL based on host settings */ - public function getHostFromSettings($index, $variables = null) + public function getHostFromSettings(int $index, ?array $variables = null): string { return self::getHostString($this->getHostSettings(), $index, $variables); } diff --git a/samples/client/echo_api/php-nextgen/src/Model/Bird.php b/samples/client/echo_api/php-nextgen/src/Model/Bird.php index 58773f66cee..77574df55cb 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/Bird.php +++ b/samples/client/echo_api/php-nextgen/src/Model/Bird.php @@ -29,8 +29,11 @@ namespace OpenAPI\Client\Model; -use \ArrayAccess; -use \OpenAPI\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use OpenAPI\Client\ObjectSerializer; /** * Bird Class Doc Comment @@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ -class Bird implements ModelInterface, ArrayAccess, \JsonSerializable +class Bird implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; @@ -50,14 +53,14 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'Bird'; + protected static string $openAPIModelName = 'Bird'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'size' => 'string', 'color' => 'string' ]; @@ -65,11 +68,9 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'size' => null, 'color' => null ]; @@ -77,7 +78,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'size' => false, @@ -87,16 +88,16 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes; } @@ -104,9 +105,9 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats; } @@ -114,7 +115,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -124,7 +125,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -134,7 +135,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -167,9 +168,9 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'size' => 'size', 'color' => 'color' ]; @@ -177,9 +178,9 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'size' => 'setSize', 'color' => 'setColor' ]; @@ -187,9 +188,9 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'size' => 'getSize', 'color' => 'getColor' ]; @@ -198,9 +199,9 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -208,9 +209,9 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -218,9 +219,9 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } @@ -230,7 +231,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -239,15 +240,14 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { @@ -264,7 +264,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -276,9 +276,9 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -291,7 +291,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -302,7 +302,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string|null */ - public function getSize() + public function getSize(): ?string { return $this->container['size']; } @@ -312,12 +312,12 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string|null $size size * - * @return self + * @return $this */ - public function setSize($size) + public function setSize(?string $size): static { if (is_null($size)) { - throw new \InvalidArgumentException('non-nullable size cannot be null'); + throw new InvalidArgumentException('non-nullable size cannot be null'); } $this->container['size'] = $size; @@ -329,7 +329,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string|null */ - public function getColor() + public function getColor(): ?string { return $this->container['color']; } @@ -339,12 +339,12 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string|null $color color * - * @return self + * @return $this */ - public function setColor($color) + public function setColor(?string $color): static { if (is_null($color)) { - throw new \InvalidArgumentException('non-nullable color cannot be null'); + throw new InvalidArgumentException('non-nullable color cannot be null'); } $this->container['color'] = $color; @@ -357,7 +357,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -369,8 +369,8 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -383,7 +383,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -399,7 +399,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -411,8 +411,8 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -422,7 +422,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -435,7 +435,7 @@ class Bird implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/echo_api/php-nextgen/src/Model/Category.php b/samples/client/echo_api/php-nextgen/src/Model/Category.php index fca3463c950..e703bbe32c1 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/Category.php +++ b/samples/client/echo_api/php-nextgen/src/Model/Category.php @@ -29,8 +29,11 @@ namespace OpenAPI\Client\Model; -use \ArrayAccess; -use \OpenAPI\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use OpenAPI\Client\ObjectSerializer; /** * Category Class Doc Comment @@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ -class Category implements ModelInterface, ArrayAccess, \JsonSerializable +class Category implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; @@ -50,14 +53,14 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'Category'; + protected static string $openAPIModelName = 'Category'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,11 +68,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null ]; @@ -77,7 +78,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'id' => false, @@ -87,16 +88,16 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes; } @@ -104,9 +105,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats; } @@ -114,7 +115,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -124,7 +125,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -134,7 +135,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -167,9 +168,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name' ]; @@ -177,9 +178,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName' ]; @@ -187,9 +188,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName' ]; @@ -198,9 +199,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -208,9 +209,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -218,9 +219,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } @@ -230,7 +231,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -239,15 +240,14 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { @@ -264,7 +264,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -276,9 +276,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -291,7 +291,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -302,7 +302,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -312,12 +312,12 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @param int|null $id id * - * @return self + * @return $this */ - public function setId($id) + public function setId(?int $id): static { if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + throw new InvalidArgumentException('non-nullable id cannot be null'); } $this->container['id'] = $id; @@ -329,7 +329,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -339,12 +339,12 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string|null $name name * - * @return self + * @return $this */ - public function setName($name) + public function setName(?string $name): static { if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + throw new InvalidArgumentException('non-nullable name cannot be null'); } $this->container['name'] = $name; @@ -357,7 +357,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -369,8 +369,8 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -383,7 +383,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -399,7 +399,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -411,8 +411,8 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -422,7 +422,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -435,7 +435,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/echo_api/php-nextgen/src/Model/DataQuery.php b/samples/client/echo_api/php-nextgen/src/Model/DataQuery.php index c726810fb0b..91531e57e38 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/DataQuery.php +++ b/samples/client/echo_api/php-nextgen/src/Model/DataQuery.php @@ -28,7 +28,6 @@ */ namespace OpenAPI\Client\Model; -use \OpenAPI\Client\ObjectSerializer; /** * DataQuery Class Doc Comment @@ -37,7 +36,7 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ class DataQuery extends Query { @@ -48,14 +47,14 @@ class DataQuery extends Query * * @var string */ - protected static $openAPIModelName = 'DataQuery'; + protected static string $openAPIModelName = 'DataQuery'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'suffix' => 'string', 'text' => 'string', 'date' => '\DateTime' @@ -64,11 +63,9 @@ class DataQuery extends Query /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'suffix' => null, 'text' => null, 'date' => 'date-time' @@ -77,7 +74,7 @@ class DataQuery extends Query /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'suffix' => false, @@ -88,16 +85,16 @@ class DataQuery extends Query /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes + parent::openAPITypes(); } @@ -105,9 +102,9 @@ class DataQuery extends Query /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats + parent::openAPIFormats(); } @@ -115,7 +112,7 @@ class DataQuery extends Query /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -125,7 +122,7 @@ class DataQuery extends Query /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -135,7 +132,7 @@ class DataQuery extends Query /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -168,9 +165,9 @@ class DataQuery extends Query * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'suffix' => 'suffix', 'text' => 'text', 'date' => 'date' @@ -179,9 +176,9 @@ class DataQuery extends Query /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'suffix' => 'setSuffix', 'text' => 'setText', 'date' => 'setDate' @@ -190,9 +187,9 @@ class DataQuery extends Query /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'suffix' => 'getSuffix', 'text' => 'getText', 'date' => 'getDate' @@ -202,9 +199,9 @@ class DataQuery extends Query * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return parent::attributeMap() + self::$attributeMap; } @@ -212,9 +209,9 @@ class DataQuery extends Query /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return parent::setters() + self::$setters; } @@ -222,9 +219,9 @@ class DataQuery extends Query /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return parent::getters() + self::$getters; } @@ -234,7 +231,7 @@ class DataQuery extends Query * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -244,8 +241,7 @@ class DataQuery extends Query /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { @@ -265,7 +261,7 @@ class DataQuery extends Query * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -277,9 +273,9 @@ class DataQuery extends Query /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = parent::listInvalidProperties(); @@ -292,7 +288,7 @@ class DataQuery extends Query * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -303,7 +299,7 @@ class DataQuery extends Query * * @return string|null */ - public function getSuffix() + public function getSuffix(): ?string { return $this->container['suffix']; } @@ -313,12 +309,12 @@ class DataQuery extends Query * * @param string|null $suffix test suffix * - * @return self + * @return $this */ - public function setSuffix($suffix) + public function setSuffix(?string $suffix): static { if (is_null($suffix)) { - throw new \InvalidArgumentException('non-nullable suffix cannot be null'); + throw new InvalidArgumentException('non-nullable suffix cannot be null'); } $this->container['suffix'] = $suffix; @@ -330,7 +326,7 @@ class DataQuery extends Query * * @return string|null */ - public function getText() + public function getText(): ?string { return $this->container['text']; } @@ -340,12 +336,12 @@ class DataQuery extends Query * * @param string|null $text Some text containing white spaces * - * @return self + * @return $this */ - public function setText($text) + public function setText(?string $text): static { if (is_null($text)) { - throw new \InvalidArgumentException('non-nullable text cannot be null'); + throw new InvalidArgumentException('non-nullable text cannot be null'); } $this->container['text'] = $text; @@ -357,7 +353,7 @@ class DataQuery extends Query * * @return \DateTime|null */ - public function getDate() + public function getDate(): ?\DateTime { return $this->container['date']; } @@ -367,12 +363,12 @@ class DataQuery extends Query * * @param \DateTime|null $date A date * - * @return self + * @return $this */ - public function setDate($date) + public function setDate(?\DateTime $date): static { if (is_null($date)) { - throw new \InvalidArgumentException('non-nullable date cannot be null'); + throw new InvalidArgumentException('non-nullable date cannot be null'); } $this->container['date'] = $date; @@ -385,7 +381,7 @@ class DataQuery extends Query * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -397,8 +393,8 @@ class DataQuery extends Query * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -411,7 +407,7 @@ class DataQuery extends Query * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -427,7 +423,7 @@ class DataQuery extends Query * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -439,8 +435,8 @@ class DataQuery extends Query * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -450,7 +446,7 @@ class DataQuery extends Query * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -463,7 +459,7 @@ class DataQuery extends Query * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php b/samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php index 7ecd9e41b80..6baca867501 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php +++ b/samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php @@ -29,8 +29,11 @@ namespace OpenAPI\Client\Model; -use \ArrayAccess; -use \OpenAPI\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use OpenAPI\Client\ObjectSerializer; /** * DefaultValue Class Doc Comment @@ -40,9 +43,9 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ -class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable +class DefaultValue implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; @@ -51,14 +54,14 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'DefaultValue'; + protected static string $openAPIModelName = 'DefaultValue'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'array_string_enum_ref_default' => '\OpenAPI\Client\Model\StringEnumRef[]', 'array_string_enum_default' => 'string[]', 'array_string_default' => 'string[]', @@ -72,11 +75,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'array_string_enum_ref_default' => null, 'array_string_enum_default' => null, 'array_string_default' => null, @@ -90,7 +91,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'array_string_enum_ref_default' => false, @@ -106,16 +107,16 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes; } @@ -123,9 +124,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats; } @@ -133,7 +134,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -143,7 +144,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -153,7 +154,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -186,9 +187,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'array_string_enum_ref_default' => 'array_string_enum_ref_default', 'array_string_enum_default' => 'array_string_enum_default', 'array_string_default' => 'array_string_default', @@ -202,9 +203,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'array_string_enum_ref_default' => 'setArrayStringEnumRefDefault', 'array_string_enum_default' => 'setArrayStringEnumDefault', 'array_string_default' => 'setArrayStringDefault', @@ -218,9 +219,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'array_string_enum_ref_default' => 'getArrayStringEnumRefDefault', 'array_string_enum_default' => 'getArrayStringEnumDefault', 'array_string_default' => 'getArrayStringDefault', @@ -235,9 +236,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -245,9 +246,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -255,9 +256,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } @@ -267,7 +268,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -293,22 +294,21 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { - $this->setIfExists('array_string_enum_ref_default', $data ?? [], null); - $this->setIfExists('array_string_enum_default', $data ?? [], null); - $this->setIfExists('array_string_default', $data ?? [], null); - $this->setIfExists('array_integer_default', $data ?? [], null); + $this->setIfExists('array_string_enum_ref_default', $data ?? [], [["success","failure"]]); + $this->setIfExists('array_string_enum_default', $data ?? [], [["success","failure"]]); + $this->setIfExists('array_string_default', $data ?? [], [["failure","skipped"]]); + $this->setIfExists('array_integer_default', $data ?? [], [[1,3]]); $this->setIfExists('array_string', $data ?? [], null); $this->setIfExists('array_string_nullable', $data ?? [], null); $this->setIfExists('array_string_extension_nullable', $data ?? [], null); @@ -324,7 +324,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -336,9 +336,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -351,7 +351,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -362,7 +362,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return \OpenAPI\Client\Model\StringEnumRef[]|null */ - public function getArrayStringEnumRefDefault() + public function getArrayStringEnumRefDefault(): ?array { return $this->container['array_string_enum_ref_default']; } @@ -372,12 +372,12 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @param \OpenAPI\Client\Model\StringEnumRef[]|null $array_string_enum_ref_default array_string_enum_ref_default * - * @return self + * @return $this */ - public function setArrayStringEnumRefDefault($array_string_enum_ref_default) + public function setArrayStringEnumRefDefault(?array $array_string_enum_ref_default): static { if (is_null($array_string_enum_ref_default)) { - throw new \InvalidArgumentException('non-nullable array_string_enum_ref_default cannot be null'); + throw new InvalidArgumentException('non-nullable array_string_enum_ref_default cannot be null'); } $this->container['array_string_enum_ref_default'] = $array_string_enum_ref_default; @@ -389,7 +389,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string[]|null */ - public function getArrayStringEnumDefault() + public function getArrayStringEnumDefault(): ?array { return $this->container['array_string_enum_default']; } @@ -399,16 +399,16 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string[]|null $array_string_enum_default array_string_enum_default * - * @return self + * @return $this */ - public function setArrayStringEnumDefault($array_string_enum_default) + public function setArrayStringEnumDefault(?array $array_string_enum_default): static { if (is_null($array_string_enum_default)) { - throw new \InvalidArgumentException('non-nullable array_string_enum_default cannot be null'); + throw new InvalidArgumentException('non-nullable array_string_enum_default cannot be null'); } $allowedValues = $this->getArrayStringEnumDefaultAllowableValues(); if (array_diff($array_string_enum_default, $allowedValues)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( "Invalid value for 'array_string_enum_default', must be one of '%s'", implode("', '", $allowedValues) @@ -425,7 +425,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string[]|null */ - public function getArrayStringDefault() + public function getArrayStringDefault(): ?array { return $this->container['array_string_default']; } @@ -435,12 +435,12 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string[]|null $array_string_default array_string_default * - * @return self + * @return $this */ - public function setArrayStringDefault($array_string_default) + public function setArrayStringDefault(?array $array_string_default): static { if (is_null($array_string_default)) { - throw new \InvalidArgumentException('non-nullable array_string_default cannot be null'); + throw new InvalidArgumentException('non-nullable array_string_default cannot be null'); } $this->container['array_string_default'] = $array_string_default; @@ -452,7 +452,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return int[]|null */ - public function getArrayIntegerDefault() + public function getArrayIntegerDefault(): ?array { return $this->container['array_integer_default']; } @@ -462,12 +462,12 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @param int[]|null $array_integer_default array_integer_default * - * @return self + * @return $this */ - public function setArrayIntegerDefault($array_integer_default) + public function setArrayIntegerDefault(?array $array_integer_default): static { if (is_null($array_integer_default)) { - throw new \InvalidArgumentException('non-nullable array_integer_default cannot be null'); + throw new InvalidArgumentException('non-nullable array_integer_default cannot be null'); } $this->container['array_integer_default'] = $array_integer_default; @@ -479,7 +479,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string[]|null */ - public function getArrayString() + public function getArrayString(): ?array { return $this->container['array_string']; } @@ -489,12 +489,12 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string[]|null $array_string array_string * - * @return self + * @return $this */ - public function setArrayString($array_string) + public function setArrayString(?array $array_string): static { if (is_null($array_string)) { - throw new \InvalidArgumentException('non-nullable array_string cannot be null'); + throw new InvalidArgumentException('non-nullable array_string cannot be null'); } $this->container['array_string'] = $array_string; @@ -506,7 +506,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string[]|null */ - public function getArrayStringNullable() + public function getArrayStringNullable(): ?array { return $this->container['array_string_nullable']; } @@ -516,9 +516,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string[]|null $array_string_nullable array_string_nullable * - * @return self + * @return $this */ - public function setArrayStringNullable($array_string_nullable) + public function setArrayStringNullable(?array $array_string_nullable): static { if (is_null($array_string_nullable)) { array_push($this->openAPINullablesSetToNull, 'array_string_nullable'); @@ -540,7 +540,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string[]|null */ - public function getArrayStringExtensionNullable() + public function getArrayStringExtensionNullable(): ?array { return $this->container['array_string_extension_nullable']; } @@ -550,9 +550,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string[]|null $array_string_extension_nullable array_string_extension_nullable * - * @return self + * @return $this */ - public function setArrayStringExtensionNullable($array_string_extension_nullable) + public function setArrayStringExtensionNullable(?array $array_string_extension_nullable): static { if (is_null($array_string_extension_nullable)) { array_push($this->openAPINullablesSetToNull, 'array_string_extension_nullable'); @@ -574,7 +574,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string|null */ - public function getStringNullable() + public function getStringNullable(): ?string { return $this->container['string_nullable']; } @@ -584,9 +584,9 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string|null $string_nullable string_nullable * - * @return self + * @return $this */ - public function setStringNullable($string_nullable) + public function setStringNullable(?string $string_nullable): static { if (is_null($string_nullable)) { array_push($this->openAPINullablesSetToNull, 'string_nullable'); @@ -609,7 +609,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -621,8 +621,8 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -635,7 +635,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -651,7 +651,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -663,8 +663,8 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -674,7 +674,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -687,7 +687,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/echo_api/php-nextgen/src/Model/ModelInterface.php b/samples/client/echo_api/php-nextgen/src/Model/ModelInterface.php index 5fa11418479..81335252c9f 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/ModelInterface.php +++ b/samples/client/echo_api/php-nextgen/src/Model/ModelInterface.php @@ -42,49 +42,49 @@ interface ModelInterface * * @return string */ - public function getModelName(); + public function getModelName(): string; /** * Array of property to type mappings. Used for (de)serialization * * @return array */ - public static function openAPITypes(); + public static function openAPITypes(): array; /** * Array of property to format mappings. Used for (de)serialization * * @return array */ - public static function openAPIFormats(); + public static function openAPIFormats(): array; /** * Array of attributes where the key is the local name, and the value is the original name * * @return array */ - public static function attributeMap(); + public static function attributeMap(): array; /** * Array of attributes to setter functions (for deserialization of responses) * * @return array */ - public static function setters(); + public static function setters(): array; /** * Array of attributes to getter functions (for serialization of requests) * * @return array */ - public static function getters(); + public static function getters(): array; /** * Show all the invalid properties with reasons. * * @return array */ - public function listInvalidProperties(); + public function listInvalidProperties(): array; /** * Validate all the properties in the model @@ -92,7 +92,7 @@ interface ModelInterface * * @return bool */ - public function valid(); + public function valid(): bool; /** * Checks if a property is nullable diff --git a/samples/client/echo_api/php-nextgen/src/Model/NumberPropertiesOnly.php b/samples/client/echo_api/php-nextgen/src/Model/NumberPropertiesOnly.php index 3799ee96511..7feabc87075 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/NumberPropertiesOnly.php +++ b/samples/client/echo_api/php-nextgen/src/Model/NumberPropertiesOnly.php @@ -29,8 +29,11 @@ namespace OpenAPI\Client\Model; -use \ArrayAccess; -use \OpenAPI\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use OpenAPI\Client\ObjectSerializer; /** * NumberPropertiesOnly Class Doc Comment @@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ -class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializable +class NumberPropertiesOnly implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; @@ -50,14 +53,14 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @var string */ - protected static $openAPIModelName = 'NumberPropertiesOnly'; + protected static string $openAPIModelName = 'NumberPropertiesOnly'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'number' => 'float', 'float' => 'float', 'double' => 'float' @@ -66,11 +69,9 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'number' => null, 'float' => 'float', 'double' => 'double' @@ -79,7 +80,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'number' => false, @@ -90,16 +91,16 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes; } @@ -107,9 +108,9 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats; } @@ -117,7 +118,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -127,7 +128,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -137,7 +138,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -170,9 +171,9 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'number' => 'number', 'float' => 'float', 'double' => 'double' @@ -181,9 +182,9 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'number' => 'setNumber', 'float' => 'setFloat', 'double' => 'setDouble' @@ -192,9 +193,9 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'number' => 'getNumber', 'float' => 'getFloat', 'double' => 'getDouble' @@ -204,9 +205,9 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -214,9 +215,9 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -224,9 +225,9 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } @@ -236,7 +237,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -245,15 +246,14 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { @@ -271,7 +271,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -283,9 +283,9 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -306,7 +306,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -317,7 +317,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @return float|null */ - public function getNumber() + public function getNumber(): ?float { return $this->container['number']; } @@ -327,12 +327,12 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @param float|null $number number * - * @return self + * @return $this */ - public function setNumber($number) + public function setNumber(?float $number): static { if (is_null($number)) { - throw new \InvalidArgumentException('non-nullable number cannot be null'); + throw new InvalidArgumentException('non-nullable number cannot be null'); } $this->container['number'] = $number; @@ -344,7 +344,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @return float|null */ - public function getFloat() + public function getFloat(): ?float { return $this->container['float']; } @@ -354,12 +354,12 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @param float|null $float float * - * @return self + * @return $this */ - public function setFloat($float) + public function setFloat(?float $float): static { if (is_null($float)) { - throw new \InvalidArgumentException('non-nullable float cannot be null'); + throw new InvalidArgumentException('non-nullable float cannot be null'); } $this->container['float'] = $float; @@ -371,7 +371,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @return float|null */ - public function getDouble() + public function getDouble(): ?float { return $this->container['double']; } @@ -381,19 +381,19 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @param float|null $double double * - * @return self + * @return $this */ - public function setDouble($double) + public function setDouble(?float $double): static { if (is_null($double)) { - throw new \InvalidArgumentException('non-nullable double cannot be null'); + throw new InvalidArgumentException('non-nullable double cannot be null'); } if (($double > 50.2)) { - throw new \InvalidArgumentException('invalid value for $double when calling NumberPropertiesOnly., must be smaller than or equal to 50.2.'); + throw new InvalidArgumentException('invalid value for $double when calling NumberPropertiesOnly., must be smaller than or equal to 50.2.'); } if (($double < 0.8)) { - throw new \InvalidArgumentException('invalid value for $double when calling NumberPropertiesOnly., must be bigger than or equal to 0.8.'); + throw new InvalidArgumentException('invalid value for $double when calling NumberPropertiesOnly., must be bigger than or equal to 0.8.'); } $this->container['double'] = $double; @@ -407,7 +407,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -419,8 +419,8 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -433,7 +433,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -449,7 +449,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -461,8 +461,8 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -472,7 +472,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -485,7 +485,7 @@ class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializ * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/echo_api/php-nextgen/src/Model/Pet.php b/samples/client/echo_api/php-nextgen/src/Model/Pet.php index e1d5a793229..7e4caa17594 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/Pet.php +++ b/samples/client/echo_api/php-nextgen/src/Model/Pet.php @@ -29,8 +29,11 @@ namespace OpenAPI\Client\Model; -use \ArrayAccess; -use \OpenAPI\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use OpenAPI\Client\ObjectSerializer; /** * Pet Class Doc Comment @@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ -class Pet implements ModelInterface, ArrayAccess, \JsonSerializable +class Pet implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; @@ -50,14 +53,14 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'Pet'; + protected static string $openAPIModelName = 'Pet'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string', 'category' => '\OpenAPI\Client\Model\Category', @@ -69,11 +72,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null, 'category' => null, @@ -85,7 +86,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'id' => false, @@ -99,16 +100,16 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes; } @@ -116,9 +117,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats; } @@ -126,7 +127,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -136,7 +137,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -146,7 +147,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -179,9 +180,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name', 'category' => 'category', @@ -193,9 +194,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName', 'category' => 'setCategory', @@ -207,9 +208,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName', 'category' => 'getCategory', @@ -222,9 +223,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -232,9 +233,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -242,9 +243,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } @@ -254,7 +255,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -280,15 +281,14 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { @@ -309,7 +309,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -321,9 +321,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -351,7 +351,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -362,7 +362,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -372,12 +372,12 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @param int|null $id id * - * @return self + * @return $this */ - public function setId($id) + public function setId(?int $id): static { if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + throw new InvalidArgumentException('non-nullable id cannot be null'); } $this->container['id'] = $id; @@ -389,7 +389,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function getName() + public function getName(): string { return $this->container['name']; } @@ -399,12 +399,12 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string $name name * - * @return self + * @return $this */ - public function setName($name) + public function setName(string $name): static { if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + throw new InvalidArgumentException('non-nullable name cannot be null'); } $this->container['name'] = $name; @@ -416,7 +416,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return \OpenAPI\Client\Model\Category|null */ - public function getCategory() + public function getCategory(): ?\OpenAPI\Client\Model\Category { return $this->container['category']; } @@ -426,12 +426,12 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @param \OpenAPI\Client\Model\Category|null $category category * - * @return self + * @return $this */ - public function setCategory($category) + public function setCategory(?\OpenAPI\Client\Model\Category $category): static { if (is_null($category)) { - throw new \InvalidArgumentException('non-nullable category cannot be null'); + throw new InvalidArgumentException('non-nullable category cannot be null'); } $this->container['category'] = $category; @@ -443,7 +443,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string[] */ - public function getPhotoUrls() + public function getPhotoUrls(): array { return $this->container['photo_urls']; } @@ -453,12 +453,12 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string[] $photo_urls photo_urls * - * @return self + * @return $this */ - public function setPhotoUrls($photo_urls) + public function setPhotoUrls(array $photo_urls): static { if (is_null($photo_urls)) { - throw new \InvalidArgumentException('non-nullable photo_urls cannot be null'); + throw new InvalidArgumentException('non-nullable photo_urls cannot be null'); } $this->container['photo_urls'] = $photo_urls; @@ -470,7 +470,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return \OpenAPI\Client\Model\Tag[]|null */ - public function getTags() + public function getTags(): ?array { return $this->container['tags']; } @@ -480,12 +480,12 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @param \OpenAPI\Client\Model\Tag[]|null $tags tags * - * @return self + * @return $this */ - public function setTags($tags) + public function setTags(?array $tags): static { if (is_null($tags)) { - throw new \InvalidArgumentException('non-nullable tags cannot be null'); + throw new InvalidArgumentException('non-nullable tags cannot be null'); } $this->container['tags'] = $tags; @@ -497,7 +497,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string|null */ - public function getStatus() + public function getStatus(): ?string { return $this->container['status']; } @@ -507,16 +507,16 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string|null $status pet status in the store * - * @return self + * @return $this */ - public function setStatus($status) + public function setStatus(?string $status): static { if (is_null($status)) { - throw new \InvalidArgumentException('non-nullable status cannot be null'); + throw new InvalidArgumentException('non-nullable status cannot be null'); } $allowedValues = $this->getStatusAllowableValues(); if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'status', must be one of '%s'", $status, @@ -535,7 +535,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -547,8 +547,8 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -561,7 +561,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -577,7 +577,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -589,8 +589,8 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -600,7 +600,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -613,7 +613,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/echo_api/php-nextgen/src/Model/Query.php b/samples/client/echo_api/php-nextgen/src/Model/Query.php index 9644ce0096c..b6ccda99b3f 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/Query.php +++ b/samples/client/echo_api/php-nextgen/src/Model/Query.php @@ -29,8 +29,11 @@ namespace OpenAPI\Client\Model; -use \ArrayAccess; -use \OpenAPI\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use OpenAPI\Client\ObjectSerializer; /** * Query Class Doc Comment @@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ -class Query implements ModelInterface, ArrayAccess, \JsonSerializable +class Query implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; @@ -50,14 +53,14 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'Query'; + protected static string $openAPIModelName = 'Query'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'outcomes' => 'string[]' ]; @@ -65,11 +68,9 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'outcomes' => null ]; @@ -77,7 +78,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'id' => false, @@ -87,16 +88,16 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes; } @@ -104,9 +105,9 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats; } @@ -114,7 +115,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -124,7 +125,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -134,7 +135,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -167,9 +168,9 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'outcomes' => 'outcomes' ]; @@ -177,9 +178,9 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'outcomes' => 'setOutcomes' ]; @@ -187,9 +188,9 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'outcomes' => 'getOutcomes' ]; @@ -198,9 +199,9 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -208,9 +209,9 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -218,9 +219,9 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } @@ -230,7 +231,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -256,20 +257,19 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('outcomes', $data ?? [], null); + $this->setIfExists('outcomes', $data ?? [], [["SUCCESS","FAILURE"]]); } /** @@ -281,7 +281,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -293,9 +293,9 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -308,7 +308,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -319,7 +319,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -329,12 +329,12 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @param int|null $id Query * - * @return self + * @return $this */ - public function setId($id) + public function setId(?int $id): static { if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + throw new InvalidArgumentException('non-nullable id cannot be null'); } $this->container['id'] = $id; @@ -346,7 +346,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string[]|null */ - public function getOutcomes() + public function getOutcomes(): ?array { return $this->container['outcomes']; } @@ -356,16 +356,16 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string[]|null $outcomes outcomes * - * @return self + * @return $this */ - public function setOutcomes($outcomes) + public function setOutcomes(?array $outcomes): static { if (is_null($outcomes)) { - throw new \InvalidArgumentException('non-nullable outcomes cannot be null'); + throw new InvalidArgumentException('non-nullable outcomes cannot be null'); } $allowedValues = $this->getOutcomesAllowableValues(); if (array_diff($outcomes, $allowedValues)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( "Invalid value for 'outcomes', must be one of '%s'", implode("', '", $allowedValues) @@ -383,7 +383,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -395,8 +395,8 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -409,7 +409,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,7 +425,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -437,8 +437,8 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -448,7 +448,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -461,7 +461,7 @@ class Query implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/echo_api/php-nextgen/src/Model/StringEnumRef.php b/samples/client/echo_api/php-nextgen/src/Model/StringEnumRef.php index f0c9cbc70d6..89c69d74803 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/StringEnumRef.php +++ b/samples/client/echo_api/php-nextgen/src/Model/StringEnumRef.php @@ -28,7 +28,6 @@ */ namespace OpenAPI\Client\Model; -use \OpenAPI\Client\ObjectSerializer; /** * StringEnumRef Class Doc Comment diff --git a/samples/client/echo_api/php-nextgen/src/Model/Tag.php b/samples/client/echo_api/php-nextgen/src/Model/Tag.php index 5f5f5c3e8ab..d3d5bebd6f1 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/Tag.php +++ b/samples/client/echo_api/php-nextgen/src/Model/Tag.php @@ -29,8 +29,11 @@ namespace OpenAPI\Client\Model; -use \ArrayAccess; -use \OpenAPI\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use OpenAPI\Client\ObjectSerializer; /** * Tag Class Doc Comment @@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ -class Tag implements ModelInterface, ArrayAccess, \JsonSerializable +class Tag implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; @@ -50,14 +53,14 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'Tag'; + protected static string $openAPIModelName = 'Tag'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'id' => 'int', 'name' => 'string' ]; @@ -65,11 +68,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'id' => 'int64', 'name' => null ]; @@ -77,7 +78,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'id' => false, @@ -87,16 +88,16 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes; } @@ -104,9 +105,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats; } @@ -114,7 +115,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -124,7 +125,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -134,7 +135,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -167,9 +168,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'id' => 'id', 'name' => 'name' ]; @@ -177,9 +178,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'id' => 'setId', 'name' => 'setName' ]; @@ -187,9 +188,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'id' => 'getId', 'name' => 'getName' ]; @@ -198,9 +199,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -208,9 +209,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -218,9 +219,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } @@ -230,7 +231,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -239,15 +240,14 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { @@ -264,7 +264,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -276,9 +276,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -291,7 +291,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -302,7 +302,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -312,12 +312,12 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @param int|null $id id * - * @return self + * @return $this */ - public function setId($id) + public function setId(?int $id): static { if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + throw new InvalidArgumentException('non-nullable id cannot be null'); } $this->container['id'] = $id; @@ -329,7 +329,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -339,12 +339,12 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @param string|null $name name * - * @return self + * @return $this */ - public function setName($name) + public function setName(?string $name): static { if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + throw new InvalidArgumentException('non-nullable name cannot be null'); } $this->container['name'] = $name; @@ -357,7 +357,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -369,8 +369,8 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -383,7 +383,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -399,7 +399,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -411,8 +411,8 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -422,7 +422,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -435,7 +435,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php b/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php index 7055dc17443..7600cd21bb6 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php +++ b/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php @@ -29,8 +29,11 @@ namespace OpenAPI\Client\Model; -use \ArrayAccess; -use \OpenAPI\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use OpenAPI\Client\ObjectSerializer; /** * TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter Class Doc Comment @@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ -class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter implements ModelInterface, ArrayAccess, \JsonSerializable +class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; @@ -50,14 +53,14 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @var string */ - protected static $openAPIModelName = 'test_query_style_deepObject_explode_true_object_allOf_query_object_parameter'; + protected static string $openAPIModelName = 'test_query_style_deepObject_explode_true_object_allOf_query_object_parameter'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'size' => 'string', 'color' => 'string', 'id' => 'int', @@ -67,11 +70,9 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'size' => null, 'color' => null, 'id' => 'int64', @@ -81,7 +82,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'size' => false, @@ -93,16 +94,16 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes; } @@ -110,9 +111,9 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats; } @@ -120,7 +121,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -130,7 +131,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -140,7 +141,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -173,9 +174,9 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'size' => 'size', 'color' => 'color', 'id' => 'id', @@ -185,9 +186,9 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'size' => 'setSize', 'color' => 'setColor', 'id' => 'setId', @@ -197,9 +198,9 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'size' => 'getSize', 'color' => 'getColor', 'id' => 'getId', @@ -210,9 +211,9 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -220,9 +221,9 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -230,9 +231,9 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } @@ -242,7 +243,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -251,15 +252,14 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { @@ -278,7 +278,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -290,9 +290,9 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -305,7 +305,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -316,7 +316,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return string|null */ - public function getSize() + public function getSize(): ?string { return $this->container['size']; } @@ -326,12 +326,12 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @param string|null $size size * - * @return self + * @return $this */ - public function setSize($size) + public function setSize(?string $size): static { if (is_null($size)) { - throw new \InvalidArgumentException('non-nullable size cannot be null'); + throw new InvalidArgumentException('non-nullable size cannot be null'); } $this->container['size'] = $size; @@ -343,7 +343,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return string|null */ - public function getColor() + public function getColor(): ?string { return $this->container['color']; } @@ -353,12 +353,12 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @param string|null $color color * - * @return self + * @return $this */ - public function setColor($color) + public function setColor(?string $color): static { if (is_null($color)) { - throw new \InvalidArgumentException('non-nullable color cannot be null'); + throw new InvalidArgumentException('non-nullable color cannot be null'); } $this->container['color'] = $color; @@ -370,7 +370,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return int|null */ - public function getId() + public function getId(): ?int { return $this->container['id']; } @@ -380,12 +380,12 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @param int|null $id id * - * @return self + * @return $this */ - public function setId($id) + public function setId(?int $id): static { if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); + throw new InvalidArgumentException('non-nullable id cannot be null'); } $this->container['id'] = $id; @@ -397,7 +397,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return string|null */ - public function getName() + public function getName(): ?string { return $this->container['name']; } @@ -407,12 +407,12 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @param string|null $name name * - * @return self + * @return $this */ - public function setName($name) + public function setName(?string $name): static { if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); + throw new InvalidArgumentException('non-nullable name cannot be null'); } $this->container['name'] = $name; @@ -425,7 +425,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -437,8 +437,8 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -451,7 +451,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -467,7 +467,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -479,8 +479,8 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -490,7 +490,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -503,7 +503,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter impleme * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php b/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php index 4e08b3939e5..1f8bae6f631 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php +++ b/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php @@ -29,8 +29,11 @@ namespace OpenAPI\Client\Model; -use \ArrayAccess; -use \OpenAPI\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use OpenAPI\Client\ObjectSerializer; /** * TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter Class Doc Comment @@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ -class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements ModelInterface, ArrayAccess, \JsonSerializable +class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; @@ -50,32 +53,30 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * * @var string */ - protected static $openAPIModelName = 'test_query_style_form_explode_true_array_string_query_object_parameter'; + protected static string $openAPIModelName = 'test_query_style_form_explode_true_array_string_query_object_parameter'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'values' => 'string[]' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'values' => null ]; /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'values' => false @@ -84,16 +85,16 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes; } @@ -101,9 +102,9 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats; } @@ -111,7 +112,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -121,7 +122,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -131,7 +132,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -164,27 +165,27 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'values' => 'values' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'values' => 'setValues' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'values' => 'getValues' ]; @@ -192,9 +193,9 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -202,9 +203,9 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -212,9 +213,9 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } @@ -224,7 +225,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -233,15 +234,14 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { @@ -257,7 +257,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -269,9 +269,9 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -284,7 +284,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -295,7 +295,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * * @return string[]|null */ - public function getValues() + public function getValues(): ?array { return $this->container['values']; } @@ -305,12 +305,12 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * * @param string[]|null $values values * - * @return self + * @return $this */ - public function setValues($values) + public function setValues(?array $values): static { if (is_null($values)) { - throw new \InvalidArgumentException('non-nullable values cannot be null'); + throw new InvalidArgumentException('non-nullable values cannot be null'); } $this->container['values'] = $values; @@ -323,7 +323,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -335,8 +335,8 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -349,7 +349,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,7 +365,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -377,8 +377,8 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -388,7 +388,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -401,7 +401,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements Mo * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php b/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php index 88bada64feb..0ce7e928bb6 100644 --- a/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php +++ b/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php @@ -29,6 +29,8 @@ namespace OpenAPI\Client; +use DateTimeInterface; +use DateTime; use GuzzleHttp\Psr7\Utils; use OpenAPI\Client\Model\ModelInterface; @@ -43,14 +45,16 @@ use OpenAPI\Client\Model\ModelInterface; class ObjectSerializer { /** @var string */ - private static $dateTimeFormat = \DateTime::ATOM; + private static string $dateTimeFormat = DateTimeInterface::ATOM; /** * Change the date format * * @param string $format the new date format to use + * + * @return void */ - public static function setDateTimeFormat($format) + public static function setDateTimeFormat(string $format): void { self::$dateTimeFormat = $format; } @@ -58,19 +62,19 @@ class ObjectSerializer /** * Serialize data * - * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param mixed $data the data to serialize + * @param string|null $type the OpenAPIToolsType of the data + * @param string|null $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ - public static function sanitizeForSerialization($data, $type = null, $format = null) + public static function sanitizeForSerialization(mixed $data, string $type = null, string $format = null): mixed { if (is_scalar($data) || null === $data) { return $data; } - if ($data instanceof \DateTime) { + if ($data instanceof DateTime) { return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat); } @@ -120,7 +124,7 @@ class ObjectSerializer * * @return string the sanitized filename */ - public static function sanitizeFilename($filename) + public static function sanitizeFilename(string $filename): string { if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { return $match[1]; @@ -136,10 +140,8 @@ class ObjectSerializer * * @return string the shorten timestamp */ - public static function sanitizeTimestamp($timestamp) + public static function sanitizeTimestamp(string $timestamp): string { - if (!is_string($timestamp)) return $timestamp; - return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); } @@ -151,7 +153,7 @@ class ObjectSerializer * * @return string the serialized object */ - public static function toPathValue($value) + public static function toPathValue(string $value): string { return rawurlencode(self::toString($value)); } @@ -164,7 +166,7 @@ class ObjectSerializer * * @return bool true if $value is empty */ - private static function isEmptyValue($value, string $openApiType): bool + private static function isEmptyValue(mixed $value, string $openApiType): bool { # If empty() returns false, it is not empty regardless of its type. if (!empty($value)) { @@ -176,27 +178,19 @@ class ObjectSerializer return true; } - switch ($openApiType) { + return match ($openApiType) { # For numeric values, false and '' are considered empty. # This comparison is safe for floating point values, since the previous call to empty() will # filter out values that don't match 0. - case 'int': - case 'integer': - return $value !== 0; - - case 'number': - case 'float': - return $value !== 0 && $value !== 0.0; + 'int','integer' => $value !== 0, + 'number'|'float' => $value !== 0 && $value !== 0.0, # For boolean values, '' is considered empty - case 'bool': - case 'boolean': - return !in_array($value, [false, 0], true); + 'bool','boolean' => !in_array($value, [false, 0], true), # For all the other types, any value at this point can be considered empty. - default: - return true; - } + default => true + }; } /** @@ -205,7 +199,7 @@ class ObjectSerializer * * @param mixed $value Parameter value * @param string $paramName Parameter name - * @param string $openApiType OpenAPIType eg. array or object + * @param string $openApiType OpenAPIType e.g. array or object * @param string $style Parameter serialization style * @param bool $explode Parameter explode option * @param bool $required Whether query param is required or not @@ -213,7 +207,7 @@ class ObjectSerializer * @return array */ public static function toQueryValue( - $value, + mixed $value, string $paramName, string $openApiType = 'string', string $style = 'form', @@ -234,7 +228,7 @@ class ObjectSerializer } # Handle DateTime objects in query - if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + if($openApiType === "\DateTime" && $value instanceof DateTime) { return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; } @@ -247,7 +241,7 @@ class ObjectSerializer if (!is_array($arr)) return $arr; foreach ($arr as $k => $v) { - $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + $prop = ($style === 'deepObject') ? "{$name}[{$k}]" : $k; if (is_array($v)) { $flattenArray($v, $prop, $result); @@ -285,7 +279,7 @@ class ObjectSerializer * * @return int|string Boolean value in format */ - public static function convertBoolToQueryStringFormat(bool $value) + public static function convertBoolToQueryStringFormat(bool $value): int|string { if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { return $value ? 'true' : 'false'; @@ -303,7 +297,7 @@ class ObjectSerializer * * @return string the header string */ - public static function toHeaderValue($value) + public static function toHeaderValue(string $value): string { $callable = [$value, 'toHeaderValue']; if (is_callable($callable)) { @@ -322,7 +316,7 @@ class ObjectSerializer * * @return string the form string */ - public static function toFormValue($value) + public static function toFormValue(string|\SplFileObject $value): string { if ($value instanceof \SplFileObject) { return $value->getRealPath(); @@ -337,13 +331,13 @@ class ObjectSerializer * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param string|bool|DateTime $value the value of the parameter * * @return string the header string */ - public static function toString($value) + public static function toString(string|bool|DateTime $value): string { - if ($value instanceof \DateTime) { // datetime in ISO8601 format + if ($value instanceof DateTime) { // datetime in ISO8601 format return $value->format(self::$dateTimeFormat); } elseif (is_bool($value)) { return $value ? 'true' : 'false'; @@ -362,44 +356,32 @@ class ObjectSerializer * * @return string */ - public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + public static function serializeCollection(array $collection, string $style, bool $allowCollectionFormatMulti = false): string { if ($allowCollectionFormatMulti && ('multi' === $style)) { // http_build_query() almost does the job for us. We just // need to fix the result of multidimensional arrays. return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); } - switch ($style) { - case 'pipeDelimited': - case 'pipes': - return implode('|', $collection); - - case 'tsv': - return implode("\t", $collection); - - case 'spaceDelimited': - case 'ssv': - return implode(' ', $collection); - - case 'simple': - case 'csv': - // Deliberate fall through. CSV is default format. - default: - return implode(',', $collection); - } + return match ($style) { + 'pipeDelimited', 'pipes' => implode('|', $collection), + 'tsv' => implode("\t", $collection), + 'spaceDelimited', 'ssv' => implode(' ', $collection), + default => implode(',', $collection), + }; } /** * Deserialize a JSON string into an object * - * @param mixed $data object or primitive to be deserialized - * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[]|null $httpHeaders HTTP headers + * @param string|null $discriminator discriminator if polymorphism is used * * @return object|array|null a single or an array of $class instances */ - public static function deserialize($data, $class, $httpHeaders = null) + public static function deserialize(mixed $data, string $class, string $httpHeaders = null): object|array|null { if (null === $data) { return null; @@ -443,7 +425,7 @@ class ObjectSerializer return $data; } - if ($class === '\DateTime') { + if ($class === 'DateTime') { // Some APIs return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not @@ -452,12 +434,12 @@ class ObjectSerializer // this graceful. if (!empty($data)) { try { - return new \DateTime($data); + return new DateTime($data); } catch (\Exception $exception) { // Some APIs return a date-time with too high nanosecond // precision for php's DateTime to handle. // With provided regexp 6 digits of microseconds saved - return new \DateTime(self::sanitizeTimestamp($data)); + return new DateTime(self::sanitizeTimestamp($data)); } } else { return null; @@ -557,10 +539,10 @@ class ObjectSerializer * @return string */ public static function buildQuery( - $data, - string $numeric_prefix = '', - ?string $arg_separator = null, - int $encoding_type = \PHP_QUERY_RFC3986 + array|object $data, + string $numeric_prefix = '', + ?string $arg_separator = null, + int $encoding_type = \PHP_QUERY_RFC3986 ): string { return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); } diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php index 548a9083794..cc740cf1ff7 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php @@ -4923,11 +4923,14 @@ class FakeApi * @param \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request request body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineFreeformAdditionalProperties'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return void */ - public function testInlineFreeformAdditionalProperties($test_inline_freeform_additional_properties_request, string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0]) + public function testInlineFreeformAdditionalProperties( + \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request, + string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0] + ): void { $this->testInlineFreeformAdditionalPropertiesWithHttpInfo($test_inline_freeform_additional_properties_request, $contentType); } @@ -4940,11 +4943,14 @@ class FakeApi * @param \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request request body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineFreeformAdditionalProperties'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function testInlineFreeformAdditionalPropertiesWithHttpInfo($test_inline_freeform_additional_properties_request, string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0]) + public function testInlineFreeformAdditionalPropertiesWithHttpInfo( + \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request, + string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0] + ): array { $request = $this->testInlineFreeformAdditionalPropertiesRequest($test_inline_freeform_additional_properties_request, $contentType); @@ -5000,10 +5006,13 @@ class FakeApi * @param \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request request body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineFreeformAdditionalProperties'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testInlineFreeformAdditionalPropertiesAsync($test_inline_freeform_additional_properties_request, string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0]) + public function testInlineFreeformAdditionalPropertiesAsync( + \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request, + string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0] + ): PromiseInterface { return $this->testInlineFreeformAdditionalPropertiesAsyncWithHttpInfo($test_inline_freeform_additional_properties_request, $contentType) ->then( @@ -5021,10 +5030,13 @@ class FakeApi * @param \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request request body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineFreeformAdditionalProperties'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testInlineFreeformAdditionalPropertiesAsyncWithHttpInfo($test_inline_freeform_additional_properties_request, string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0]) + public function testInlineFreeformAdditionalPropertiesAsyncWithHttpInfo( + $test_inline_freeform_additional_properties_request, + string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0] + ): PromiseInterface { $returnType = ''; $request = $this->testInlineFreeformAdditionalPropertiesRequest($test_inline_freeform_additional_properties_request, $contentType); @@ -5058,15 +5070,18 @@ class FakeApi * @param \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request request body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testInlineFreeformAdditionalProperties'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testInlineFreeformAdditionalPropertiesRequest($test_inline_freeform_additional_properties_request, string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0]) + public function testInlineFreeformAdditionalPropertiesRequest( + $test_inline_freeform_additional_properties_request, + string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0] + ): Request { // verify the required parameter 'test_inline_freeform_additional_properties_request' is set if ($test_inline_freeform_additional_properties_request === null || (is_array($test_inline_freeform_additional_properties_request) && count($test_inline_freeform_additional_properties_request) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $test_inline_freeform_additional_properties_request when calling testInlineFreeformAdditionalProperties' ); } @@ -5412,11 +5427,14 @@ class FakeApi * @param \OpenAPI\Client\Model\ChildWithNullable $child_with_nullable request body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNullable'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return void */ - public function testNullable($child_with_nullable, string $contentType = self::contentTypes['testNullable'][0]) + public function testNullable( + \OpenAPI\Client\Model\ChildWithNullable $child_with_nullable, + string $contentType = self::contentTypes['testNullable'][0] + ): void { $this->testNullableWithHttpInfo($child_with_nullable, $contentType); } @@ -5429,11 +5447,14 @@ class FakeApi * @param \OpenAPI\Client\Model\ChildWithNullable $child_with_nullable request body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNullable'] to see the possible values for this operation * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException + * @throws ApiException on non-2xx response + * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function testNullableWithHttpInfo($child_with_nullable, string $contentType = self::contentTypes['testNullable'][0]) + public function testNullableWithHttpInfo( + \OpenAPI\Client\Model\ChildWithNullable $child_with_nullable, + string $contentType = self::contentTypes['testNullable'][0] + ): array { $request = $this->testNullableRequest($child_with_nullable, $contentType); @@ -5489,10 +5510,13 @@ class FakeApi * @param \OpenAPI\Client\Model\ChildWithNullable $child_with_nullable request body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNullable'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testNullableAsync($child_with_nullable, string $contentType = self::contentTypes['testNullable'][0]) + public function testNullableAsync( + \OpenAPI\Client\Model\ChildWithNullable $child_with_nullable, + string $contentType = self::contentTypes['testNullable'][0] + ): PromiseInterface { return $this->testNullableAsyncWithHttpInfo($child_with_nullable, $contentType) ->then( @@ -5510,10 +5534,13 @@ class FakeApi * @param \OpenAPI\Client\Model\ChildWithNullable $child_with_nullable request body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNullable'] to see the possible values for this operation * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface + * @throws InvalidArgumentException + * @return PromiseInterface */ - public function testNullableAsyncWithHttpInfo($child_with_nullable, string $contentType = self::contentTypes['testNullable'][0]) + public function testNullableAsyncWithHttpInfo( + $child_with_nullable, + string $contentType = self::contentTypes['testNullable'][0] + ): PromiseInterface { $returnType = ''; $request = $this->testNullableRequest($child_with_nullable, $contentType); @@ -5547,15 +5574,18 @@ class FakeApi * @param \OpenAPI\Client\Model\ChildWithNullable $child_with_nullable request body (required) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testNullable'] to see the possible values for this operation * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function testNullableRequest($child_with_nullable, string $contentType = self::contentTypes['testNullable'][0]) + public function testNullableRequest( + $child_with_nullable, + string $contentType = self::contentTypes['testNullable'][0] + ): Request { // verify the required parameter 'child_with_nullable' is set if ($child_with_nullable === null || (is_array($child_with_nullable) && count($child_with_nullable) === 0)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Missing the required parameter $child_with_nullable when calling testNullable' ); } diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ChildWithNullable.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ChildWithNullable.php index 1fcbc2e09d9..735c7b17c27 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ChildWithNullable.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ChildWithNullable.php @@ -27,7 +27,6 @@ */ namespace OpenAPI\Client\Model; -use \OpenAPI\Client\ObjectSerializer; /** * ChildWithNullable Class Doc Comment @@ -36,7 +35,7 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ class ChildWithNullable extends ParentWithNullable { @@ -47,32 +46,30 @@ class ChildWithNullable extends ParentWithNullable * * @var string */ - protected static $openAPIModelName = 'ChildWithNullable'; + protected static string $openAPIModelName = 'ChildWithNullable'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'other_property' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'other_property' => null ]; /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'other_property' => false @@ -81,16 +78,16 @@ class ChildWithNullable extends ParentWithNullable /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes + parent::openAPITypes(); } @@ -98,9 +95,9 @@ class ChildWithNullable extends ParentWithNullable /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats + parent::openAPIFormats(); } @@ -108,7 +105,7 @@ class ChildWithNullable extends ParentWithNullable /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -118,7 +115,7 @@ class ChildWithNullable extends ParentWithNullable /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -128,7 +125,7 @@ class ChildWithNullable extends ParentWithNullable /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -161,27 +158,27 @@ class ChildWithNullable extends ParentWithNullable * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'other_property' => 'otherProperty' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'other_property' => 'setOtherProperty' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'other_property' => 'getOtherProperty' ]; @@ -189,9 +186,9 @@ class ChildWithNullable extends ParentWithNullable * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return parent::attributeMap() + self::$attributeMap; } @@ -199,9 +196,9 @@ class ChildWithNullable extends ParentWithNullable /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return parent::setters() + self::$setters; } @@ -209,9 +206,9 @@ class ChildWithNullable extends ParentWithNullable /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return parent::getters() + self::$getters; } @@ -221,7 +218,7 @@ class ChildWithNullable extends ParentWithNullable * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -231,8 +228,7 @@ class ChildWithNullable extends ParentWithNullable /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { @@ -250,7 +246,7 @@ class ChildWithNullable extends ParentWithNullable * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -262,9 +258,9 @@ class ChildWithNullable extends ParentWithNullable /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = parent::listInvalidProperties(); @@ -277,7 +273,7 @@ class ChildWithNullable extends ParentWithNullable * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -288,7 +284,7 @@ class ChildWithNullable extends ParentWithNullable * * @return string|null */ - public function getOtherProperty() + public function getOtherProperty(): ?string { return $this->container['other_property']; } @@ -298,12 +294,12 @@ class ChildWithNullable extends ParentWithNullable * * @param string|null $other_property other_property * - * @return self + * @return $this */ - public function setOtherProperty($other_property) + public function setOtherProperty(?string $other_property): static { if (is_null($other_property)) { - throw new \InvalidArgumentException('non-nullable other_property cannot be null'); + throw new InvalidArgumentException('non-nullable other_property cannot be null'); } $this->container['other_property'] = $other_property; @@ -316,7 +312,7 @@ class ChildWithNullable extends ParentWithNullable * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -328,8 +324,8 @@ class ChildWithNullable extends ParentWithNullable * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -342,7 +338,7 @@ class ChildWithNullable extends ParentWithNullable * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -358,7 +354,7 @@ class ChildWithNullable extends ParentWithNullable * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -370,8 +366,8 @@ class ChildWithNullable extends ParentWithNullable * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -381,7 +377,7 @@ class ChildWithNullable extends ParentWithNullable * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -394,7 +390,7 @@ class ChildWithNullable extends ParentWithNullable * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ParentWithNullable.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ParentWithNullable.php index b58ad2ee964..92632528609 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ParentWithNullable.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ParentWithNullable.php @@ -28,8 +28,11 @@ namespace OpenAPI\Client\Model; -use \ArrayAccess; -use \OpenAPI\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use OpenAPI\Client\ObjectSerializer; /** * ParentWithNullable Class Doc Comment @@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ -class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializable +class ParentWithNullable implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = 'type'; @@ -49,14 +52,14 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @var string */ - protected static $openAPIModelName = 'ParentWithNullable'; + protected static string $openAPIModelName = 'ParentWithNullable'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'type' => 'string', 'nullable_property' => 'string' ]; @@ -64,11 +67,9 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'type' => null, 'nullable_property' => null ]; @@ -76,7 +77,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'type' => false, @@ -86,16 +87,16 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes; } @@ -103,9 +104,9 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats; } @@ -113,7 +114,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -123,7 +124,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -133,7 +134,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -166,9 +167,9 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'type' => 'type', 'nullable_property' => 'nullableProperty' ]; @@ -176,9 +177,9 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'type' => 'setType', 'nullable_property' => 'setNullableProperty' ]; @@ -186,9 +187,9 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'type' => 'getType', 'nullable_property' => 'getNullableProperty' ]; @@ -197,9 +198,9 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -207,9 +208,9 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -217,9 +218,9 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } @@ -229,7 +230,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -251,15 +252,14 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { @@ -279,7 +279,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -291,9 +291,9 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -315,7 +315,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -326,7 +326,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @return string|null */ - public function getType() + public function getType(): ?string { return $this->container['type']; } @@ -336,16 +336,16 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @param string|null $type type * - * @return self + * @return $this */ - public function setType($type) + public function setType(?string $type): static { if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); + throw new InvalidArgumentException('non-nullable type cannot be null'); } $allowedValues = $this->getTypeAllowableValues(); if (!in_array($type, $allowedValues, true)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'type', must be one of '%s'", $type, @@ -363,7 +363,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @return string|null */ - public function getNullableProperty() + public function getNullableProperty(): ?string { return $this->container['nullable_property']; } @@ -373,9 +373,9 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @param string|null $nullable_property nullable_property * - * @return self + * @return $this */ - public function setNullableProperty($nullable_property) + public function setNullableProperty(?string $nullable_property): static { if (is_null($nullable_property)) { array_push($this->openAPINullablesSetToNull, 'nullable_property'); @@ -398,7 +398,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -410,8 +410,8 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -424,7 +424,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -440,7 +440,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -452,8 +452,8 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -463,7 +463,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -476,7 +476,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, \JsonSerializab * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/TestInlineFreeformAdditionalPropertiesRequest.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/TestInlineFreeformAdditionalPropertiesRequest.php index 48c5588bbe6..3f0c28ec8d1 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/TestInlineFreeformAdditionalPropertiesRequest.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/TestInlineFreeformAdditionalPropertiesRequest.php @@ -28,8 +28,11 @@ namespace OpenAPI\Client\Model; -use \ArrayAccess; -use \OpenAPI\Client\ObjectSerializer; +use ArrayAccess; +use JsonSerializable; +use InvalidArgumentException; +use ReturnTypeWillChange; +use OpenAPI\Client\ObjectSerializer; /** * TestInlineFreeformAdditionalPropertiesRequest Class Doc Comment @@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer; * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements ArrayAccess */ -class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, ArrayAccess, \JsonSerializable +class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; @@ -49,32 +52,30 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * * @var string */ - protected static $openAPIModelName = 'testInlineFreeformAdditionalProperties_request'; + protected static string $openAPIModelName = 'testInlineFreeformAdditionalProperties_request'; /** * Array of property to type mappings. Used for (de)serialization * - * @var string[] + * @var array */ - protected static $openAPITypes = [ + protected static array $openAPITypes = [ 'some_property' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * - * @var string[] - * @phpstan-var array - * @psalm-var array + * @var array */ - protected static $openAPIFormats = [ + protected static array $openAPIFormats = [ 'some_property' => null ]; /** * Array of nullable properties. Used for (de)serialization * - * @var boolean[] + * @var array */ protected static array $openAPINullables = [ 'some_property' => false @@ -83,16 +84,16 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A /** * If a nullable field gets set to null, insert it here * - * @var boolean[] + * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPITypes() + public static function openAPITypes(): array { return self::$openAPITypes; } @@ -100,9 +101,9 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A /** * Array of property to format mappings. Used for (de)serialization * - * @return array + * @return array */ - public static function openAPIFormats() + public static function openAPIFormats(): array { return self::$openAPIFormats; } @@ -110,7 +111,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A /** * Array of nullable properties * - * @return array + * @return array */ protected static function openAPINullables(): array { @@ -120,7 +121,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A /** * Array of nullable field names deliberately set to null * - * @return boolean[] + * @return array */ private function getOpenAPINullablesSetToNull(): array { @@ -130,7 +131,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A /** * Setter - Array of nullable field names deliberately set to null * - * @param boolean[] $openAPINullablesSetToNull + * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { @@ -163,27 +164,27 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * Array of attributes where the key is the local name, * and the value is the original name * - * @var string[] + * @var array */ - protected static $attributeMap = [ + protected static array $attributeMap = [ 'some_property' => 'someProperty' ]; /** * Array of attributes to setter functions (for deserialization of responses) * - * @var string[] + * @var array */ - protected static $setters = [ + protected static array $setters = [ 'some_property' => 'setSomeProperty' ]; /** * Array of attributes to getter functions (for serialization of requests) * - * @var string[] + * @var array */ - protected static $getters = [ + protected static array $getters = [ 'some_property' => 'getSomeProperty' ]; @@ -191,9 +192,9 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * Array of attributes where the key is the local name, * and the value is the original name * - * @return array + * @return array */ - public static function attributeMap() + public static function attributeMap(): array { return self::$attributeMap; } @@ -201,9 +202,9 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A /** * Array of attributes to setter functions (for deserialization of responses) * - * @return array + * @return array */ - public static function setters() + public static function setters(): array { return self::$setters; } @@ -211,9 +212,9 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A /** * Array of attributes to getter functions (for serialization of requests) * - * @return array + * @return array */ - public static function getters() + public static function getters(): array { return self::$getters; } @@ -223,7 +224,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * * @return string */ - public function getModelName() + public function getModelName(): string { return self::$openAPIModelName; } @@ -232,15 +233,14 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A /** * Associative array for storing property values * - * @var mixed[] + * @var array */ - protected $container = []; + protected array $container = []; /** * Constructor * - * @param mixed[] $data Associated array of property values - * initializing the model + * @param array $data Associated array of property values initializing the model */ public function __construct(array $data = null) { @@ -256,7 +256,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * @param array $fields * @param mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; @@ -268,9 +268,9 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A /** * Show all the invalid properties with reasons. * - * @return array invalid properties with reasons + * @return string[] invalid properties with reasons */ - public function listInvalidProperties() + public function listInvalidProperties(): array { $invalidProperties = []; @@ -283,7 +283,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * * @return bool True if all properties are valid */ - public function valid() + public function valid(): bool { return count($this->listInvalidProperties()) === 0; } @@ -294,7 +294,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * * @return string|null */ - public function getSomeProperty() + public function getSomeProperty(): ?string { return $this->container['some_property']; } @@ -304,12 +304,12 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * * @param string|null $some_property some_property * - * @return self + * @return $this */ - public function setSomeProperty($some_property) + public function setSomeProperty(?string $some_property): static { if (is_null($some_property)) { - throw new \InvalidArgumentException('non-nullable some_property cannot be null'); + throw new InvalidArgumentException('non-nullable some_property cannot be null'); } $this->container['some_property'] = $some_property; @@ -322,7 +322,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } @@ -334,8 +334,8 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * * @return mixed|null */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } @@ -348,7 +348,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -364,7 +364,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } @@ -376,8 +376,8 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] - public function jsonSerialize() + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } @@ -387,7 +387,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * * @return string */ - public function __toString() + public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), @@ -400,7 +400,7 @@ class TestInlineFreeformAdditionalPropertiesRequest implements ModelInterface, A * * @return string */ - public function toHeaderValue() + public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); }