diff --git a/modules/openapi-generator/src/main/resources/php/ApiException.mustache b/modules/openapi-generator/src/main/resources/php/ApiException.mustache index 185be1a0a0a2..dcba96b0e43a 100644 --- a/modules/openapi-generator/src/main/resources/php/ApiException.mustache +++ b/modules/openapi-generator/src/main/resources/php/ApiException.mustache @@ -34,7 +34,7 @@ class ApiException extends Exception /** * The HTTP body of the server response either as Json or string. * - * @var mixed + * @var \stdClass|string|null */ protected $responseBody; @@ -48,17 +48,17 @@ class ApiException extends Exception /** * The deserialized response object * - * @var $responseObject; + * @var \stdClass|string|null */ protected $responseObject; /** * Constructor * - * @param string $message Error message - * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header - * @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string + * @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 */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) { @@ -80,7 +80,7 @@ class ApiException extends Exception /** * Gets the HTTP body of the server response either as Json or string * - * @return mixed HTTP body of the server response either as \stdClass or string + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string */ public function getResponseBody() { diff --git a/modules/openapi-generator/src/main/resources/php/Configuration.mustache b/modules/openapi-generator/src/main/resources/php/Configuration.mustache index c5885598ae3f..d5244a727bf2 100644 --- a/modules/openapi-generator/src/main/resources/php/Configuration.mustache +++ b/modules/openapi-generator/src/main/resources/php/Configuration.mustache @@ -29,6 +29,9 @@ namespace {{invokerPackage}}; */ class Configuration { + /** + * @var Configuration + */ private static $defaultConfiguration; /** @@ -128,7 +131,7 @@ class Configuration * * @param string $apiKeyIdentifier API key identifier (authentication scheme) * - * @return string API key or token + * @return null|string API key or token */ public function getApiKey($apiKeyIdentifier) { @@ -154,7 +157,7 @@ class Configuration * * @param string $apiKeyIdentifier API key identifier (authentication scheme) * - * @return string + * @return null|string */ public function getApiKeyPrefix($apiKeyIdentifier) { @@ -400,7 +403,7 @@ class Configuration * * @param string $apiKeyIdentifier name of apikey * - * @return string API key with the prefix + * @return null|string API key with the prefix */ public function getApiKeyWithPrefix($apiKeyIdentifier) { @@ -423,7 +426,7 @@ class Configuration /** * Returns an array of host settings * - * @return an array of host settings + * @return array an array of host settings */ public function getHostSettings() { @@ -461,9 +464,9 @@ class Configuration /** * Returns URL based on the index and variables * - * @param index array index of the host settings - * @param variables hash of variable and the corresponding value (optional) - * @return URL based on host settings + * @param int $index 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 function getHostFromSettings($index, $variables = null) { diff --git a/modules/openapi-generator/src/main/resources/php/HeaderSelector.mustache b/modules/openapi-generator/src/main/resources/php/HeaderSelector.mustache index 2fdc0ab204fc..5f8e65587279 100644 --- a/modules/openapi-generator/src/main/resources/php/HeaderSelector.mustache +++ b/modules/openapi-generator/src/main/resources/php/HeaderSelector.mustache @@ -66,7 +66,7 @@ class HeaderSelector * * @param string[] $accept Array of header * - * @return string Accept (e.g. application/json) + * @return null|string Accept (e.g. application/json) */ private function selectAcceptHeader($accept) { diff --git a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache index 2694de44fe76..31dd9fc33764 100644 --- a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache @@ -51,20 +51,26 @@ class ObjectSerializer * @param string $type the OpenAPIToolsType of the data * @param string $format the format of the OpenAPITools type of the data * - * @return string|object serialized form of $data + * @return scalar|object|array|null serialized form of $data */ public static function sanitizeForSerialization($data, $type = null, $format = null) { if (is_scalar($data) || null === $data) { return $data; - } elseif ($data instanceof \DateTime) { + } + + if ($data instanceof \DateTime) { return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat); - } elseif (is_array($data)) { + } + + if (is_array($data)) { foreach ($data as $property => $value) { $data[$property] = self::sanitizeForSerialization($value); } return $data; - } elseif (is_object($data)) { + } + + if (is_object($data)) { $values = []; if ($data instanceof ModelInterface) { $formats = $data::openAPIFormats(); @@ -250,7 +256,9 @@ class ObjectSerializer { if (null === $data) { return null; - } elseif (strcasecmp(substr($class, -2), '[]') === 0) { + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { $data = is_string($data) ? json_decode($data) : $data; if (!is_array($data)) { @@ -263,7 +271,9 @@ class ObjectSerializer $values[] = self::deserialize($value, $subClass, null); } return $values; - } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + } + + if (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] $data = is_string($data) ? json_decode($data) : $data; settype($data, 'array'); $inner = substr($class, 4, -1); @@ -276,10 +286,14 @@ class ObjectSerializer } } return $deserialized; - } elseif ($class === 'object') { + } + + if ($class === 'object') { settype($data, 'array'); return $data; - } elseif ($class === '\DateTime') { + } + + if ($class === '\DateTime') { // Some API's return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not @@ -291,10 +305,14 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, [{{&primitives}}], true)) { + } + + if (in_array($class, [{{&primitives}}], true)) { settype($data, $class); return $data; - } elseif ($class === '\SplFileObject') { + } + + if ($class === '\SplFileObject') { /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 9ec54edeb0d4..a80d08486bda 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -80,17 +80,17 @@ use {{invokerPackage}}\ObjectSerializer; /** * Set the host index * - * @param int Host index (required) + * @param int $hostIndex Host index (required) */ - public function setHostIndex($host_index) + public function setHostIndex($hostIndex) { - $this->hostIndex = $host_index; + $this->hostIndex = $hostIndex; } /** * Get the host index * - * @return Host index + * @return int Host index */ public function getHostIndex() { diff --git a/modules/openapi-generator/src/main/resources/php/api_test.mustache b/modules/openapi-generator/src/main/resources/php/api_test.mustache index e8c8905c961c..f46fdbac144b 100644 --- a/modules/openapi-generator/src/main/resources/php/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/php/api_test.mustache @@ -16,7 +16,7 @@ * Please update the test case below to test the endpoint. */ -namespace {{invokerPackage}}; +namespace {{invokerPackage}}\Test\Api; use \{{invokerPackage}}\Configuration; use \{{invokerPackage}}\ApiException; @@ -71,6 +71,8 @@ use PHPUnit\Framework\TestCase; */ public function test{{vendorExtensions.x-test-operation-id}}() { + // TODO: implement + $this->markTestIncomplete('Not implemented'); } {{/operation}} } diff --git a/modules/openapi-generator/src/main/resources/php/composer.mustache b/modules/openapi-generator/src/main/resources/php/composer.mustache index fdfd0e2438aa..265bd713d521 100644 --- a/modules/openapi-generator/src/main/resources/php/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php/composer.mustache @@ -36,6 +36,6 @@ "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } }, "autoload-dev": { - "psr-4": { "{{escapedInvokerPackage}}\\" : "{{testBasePath}}/" } + "psr-4": { "{{escapedInvokerPackage}}\\Test\\" : "{{testBasePath}}/" } } } diff --git a/modules/openapi-generator/src/main/resources/php/model.mustache b/modules/openapi-generator/src/main/resources/php/model.mustache index 45157dd05209..3c0b819822cb 100644 --- a/modules/openapi-generator/src/main/resources/php/model.mustache +++ b/modules/openapi-generator/src/main/resources/php/model.mustache @@ -38,6 +38,11 @@ use \{{invokerPackage}}\ObjectSerializer; * @package {{invokerPackage}} * @author OpenAPI Generator team * @link https://openapi-generator.tech +{{^isEnum}} + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null +{{/isEnum}} */ {{#isEnum}}{{>model_enum}}{{/isEnum}}{{^isEnum}}{{>model_generic}}{{/isEnum}} {{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/php/model_generic.mustache b/modules/openapi-generator/src/main/resources/php/model_generic.mustache index adc72e548797..408027158297 100644 --- a/modules/openapi-generator/src/main/resources/php/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/php/model_generic.mustache @@ -1,6 +1,6 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^parentSchema}}implements ModelInterface, ArrayAccess{{/parentSchema}} { - const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}}; + public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}}; /** * The original name of the model. @@ -23,6 +23,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ {{#vars}}'{{name}}' => {{#dataFormat}}'{{{dataFormat}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{#hasMore}}, @@ -161,7 +163,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa {{/parentSchema}} {{#vars}} - $this->container['{{name}}'] = isset($data['{{name}}']) ? $data['{{name}}'] : {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}; + $this->container['{{name}}'] = $data['{{name}}'] ?? {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}; {{/vars}} {{#discriminator}} @@ -278,7 +280,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa * * @param {{dataType}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{description}}}{{/description}}{{^description}} {{{name}}}{{/description}} * - * @return $this + * @return self */ public function {{setter}}(${{name}}) { @@ -362,18 +364,18 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/modules/openapi-generator/src/main/resources/php/model_test.mustache b/modules/openapi-generator/src/main/resources/php/model_test.mustache index 848a24b5492b..af9df8ae19b8 100644 --- a/modules/openapi-generator/src/main/resources/php/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/php/model_test.mustache @@ -19,7 +19,7 @@ * Please update the test case below to test the model. */ -namespace {{invokerPackage}}; +namespace {{invokerPackage}}\Test\Model; use PHPUnit\Framework\TestCase; @@ -68,6 +68,8 @@ class {{classname}}Test extends TestCase */ public function test{{classname}}() { + // TODO: implement + $this->markTestIncomplete('Not implemented'); } {{#vars}} @@ -76,6 +78,8 @@ class {{classname}}Test extends TestCase */ public function testProperty{{nameInCamelCase}}() { + // TODO: implement + $this->markTestIncomplete('Not implemented'); } {{/vars}} } diff --git a/samples/client/petstore/php/OpenAPIClient-php/composer.json b/samples/client/petstore/php/OpenAPIClient-php/composer.json index 823e9f92a7b9..08efaa27b921 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/composer.json +++ b/samples/client/petstore/php/OpenAPIClient-php/composer.json @@ -33,6 +33,6 @@ "psr-4": { "OpenAPI\\Client\\" : "lib/" } }, "autoload-dev": { - "psr-4": { "OpenAPI\\Client\\" : "test/" } + "psr-4": { "OpenAPI\\Client\\Test\\" : "test/" } } } diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index dd8f5426398c..b328c2627c4e 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -90,17 +90,17 @@ public function __construct( /** * Set the host index * - * @param int Host index (required) + * @param int $hostIndex Host index (required) */ - public function setHostIndex($host_index) + public function setHostIndex($hostIndex) { - $this->hostIndex = $host_index; + $this->hostIndex = $hostIndex; } /** * Get the host index * - * @return Host index + * @return int Host index */ public function getHostIndex() { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php index 033120cc5573..00c5f27ccee4 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/DefaultApi.php @@ -90,17 +90,17 @@ public function __construct( /** * Set the host index * - * @param int Host index (required) + * @param int $hostIndex Host index (required) */ - public function setHostIndex($host_index) + public function setHostIndex($hostIndex) { - $this->hostIndex = $host_index; + $this->hostIndex = $hostIndex; } /** * Get the host index * - * @return Host index + * @return int Host index */ public function getHostIndex() { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 026ce251fcec..0b99c8e9aab3 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -90,17 +90,17 @@ public function __construct( /** * Set the host index * - * @param int Host index (required) + * @param int $hostIndex Host index (required) */ - public function setHostIndex($host_index) + public function setHostIndex($hostIndex) { - $this->hostIndex = $host_index; + $this->hostIndex = $hostIndex; } /** * Get the host index * - * @return Host index + * @return int Host index */ public function getHostIndex() { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php index a17dc5fd6729..094e5e914983 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -90,17 +90,17 @@ public function __construct( /** * Set the host index * - * @param int Host index (required) + * @param int $hostIndex Host index (required) */ - public function setHostIndex($host_index) + public function setHostIndex($hostIndex) { - $this->hostIndex = $host_index; + $this->hostIndex = $hostIndex; } /** * Get the host index * - * @return Host index + * @return int Host index */ public function getHostIndex() { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index 6d8554cce908..e92065f162b2 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -90,17 +90,17 @@ public function __construct( /** * Set the host index * - * @param int Host index (required) + * @param int $hostIndex Host index (required) */ - public function setHostIndex($host_index) + public function setHostIndex($hostIndex) { - $this->hostIndex = $host_index; + $this->hostIndex = $hostIndex; } /** * Get the host index * - * @return Host index + * @return int Host index */ public function getHostIndex() { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php index d05718f74946..d4e853de9c3c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -90,17 +90,17 @@ public function __construct( /** * Set the host index * - * @param int Host index (required) + * @param int $hostIndex Host index (required) */ - public function setHostIndex($host_index) + public function setHostIndex($hostIndex) { - $this->hostIndex = $host_index; + $this->hostIndex = $hostIndex; } /** * Get the host index * - * @return Host index + * @return int Host index */ public function getHostIndex() { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php index a9fede94b862..5e26aa165b3b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -90,17 +90,17 @@ public function __construct( /** * Set the host index * - * @param int Host index (required) + * @param int $hostIndex Host index (required) */ - public function setHostIndex($host_index) + public function setHostIndex($hostIndex) { - $this->hostIndex = $host_index; + $this->hostIndex = $hostIndex; } /** * Get the host index * - * @return Host index + * @return int Host index */ public function getHostIndex() { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/ApiException.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ApiException.php index f041f3e77239..db8899ae4e73 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/ApiException.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ApiException.php @@ -44,7 +44,7 @@ class ApiException extends Exception /** * The HTTP body of the server response either as Json or string. * - * @var mixed + * @var \stdClass|string|null */ protected $responseBody; @@ -58,17 +58,17 @@ class ApiException extends Exception /** * The deserialized response object * - * @var $responseObject; + * @var \stdClass|string|null */ protected $responseObject; /** * Constructor * - * @param string $message Error message - * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header - * @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string + * @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 */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) { @@ -90,7 +90,7 @@ public function getResponseHeaders() /** * Gets the HTTP body of the server response either as Json or string * - * @return mixed 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() { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Configuration.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Configuration.php index 3ab5eda04ec4..beeafcb0dac9 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Configuration.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Configuration.php @@ -39,6 +39,9 @@ */ class Configuration { + /** + * @var Configuration + */ private static $defaultConfiguration; /** @@ -138,7 +141,7 @@ public function setApiKey($apiKeyIdentifier, $key) * * @param string $apiKeyIdentifier API key identifier (authentication scheme) * - * @return string API key or token + * @return null|string API key or token */ public function getApiKey($apiKeyIdentifier) { @@ -164,7 +167,7 @@ public function setApiKeyPrefix($apiKeyIdentifier, $prefix) * * @param string $apiKeyIdentifier API key identifier (authentication scheme) * - * @return string + * @return null|string */ public function getApiKeyPrefix($apiKeyIdentifier) { @@ -407,7 +410,7 @@ public static function toDebugReport() * * @param string $apiKeyIdentifier name of apikey * - * @return string API key with the prefix + * @return null|string API key with the prefix */ public function getApiKeyWithPrefix($apiKeyIdentifier) { @@ -430,7 +433,7 @@ public function getApiKeyWithPrefix($apiKeyIdentifier) /** * Returns an array of host settings * - * @return an array of host settings + * @return array an array of host settings */ public function getHostSettings() { @@ -478,9 +481,9 @@ public function getHostSettings() /** * Returns URL based on the index and variables * - * @param index array index of the host settings - * @param variables hash of variable and the corresponding value (optional) - * @return URL based on host settings + * @param int $index 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 function getHostFromSettings($index, $variables = null) { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php b/samples/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php index 25a92414028b..eca0ee2693fe 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/HeaderSelector.php @@ -76,7 +76,7 @@ public function selectHeadersForMultipart($accept) * * @param string[] $accept Array of header * - * @return string Accept (e.g. application/json) + * @return null|string Accept (e.g. application/json) */ private function selectAcceptHeader($accept) { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php index 2811e834099b..023ecf32ec26 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'map_property' => null, @@ -182,8 +187,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['map_property'] = isset($data['map_property']) ? $data['map_property'] : null; - $this->container['map_of_map_property'] = isset($data['map_of_map_property']) ? $data['map_of_map_property'] : null; + $this->container['map_property'] = $data['map_property'] ?? null; + $this->container['map_of_map_property'] = $data['map_of_map_property'] ?? null; } /** @@ -225,7 +230,7 @@ public function getMapProperty() * * @param map[string,string]|null $map_property map_property * - * @return $this + * @return self */ public function setMapProperty($map_property) { @@ -249,7 +254,7 @@ public function getMapOfMapProperty() * * @param map[string,map[string,string]]|null $map_of_map_property map_of_map_property * - * @return $this + * @return self */ public function setMapOfMapProperty($map_of_map_property) { @@ -274,18 +279,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php index 145ecc65ac0f..aad9487cc945 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Animal implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = 'class_name'; + public const DISCRIMINATOR = 'class_name'; /** * The original name of the model. @@ -65,6 +68,8 @@ class Animal implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'class_name' => null, @@ -182,8 +187,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['class_name'] = isset($data['class_name']) ? $data['class_name'] : null; - $this->container['color'] = isset($data['color']) ? $data['color'] : 'red'; + $this->container['class_name'] = $data['class_name'] ?? null; + $this->container['color'] = $data['color'] ?? 'red'; // Initialize discriminator property with the model name. $this->container['class_name'] = static::$openAPIModelName; @@ -231,7 +236,7 @@ public function getClassName() * * @param string $class_name class_name * - * @return $this + * @return self */ public function setClassName($class_name) { @@ -255,7 +260,7 @@ public function getColor() * * @param string|null $color color * - * @return $this + * @return self */ public function setColor($color) { @@ -280,18 +285,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php index 43244c474eea..d21fa35621f5 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ApiResponse implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -66,6 +69,8 @@ class ApiResponse implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'code' => 'int32', @@ -187,9 +192,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['code'] = isset($data['code']) ? $data['code'] : null; - $this->container['type'] = isset($data['type']) ? $data['type'] : null; - $this->container['message'] = isset($data['message']) ? $data['message'] : null; + $this->container['code'] = $data['code'] ?? null; + $this->container['type'] = $data['type'] ?? null; + $this->container['message'] = $data['message'] ?? null; } /** @@ -231,7 +236,7 @@ public function getCode() * * @param int|null $code code * - * @return $this + * @return self */ public function setCode($code) { @@ -255,7 +260,7 @@ public function getType() * * @param string|null $type type * - * @return $this + * @return self */ public function setType($type) { @@ -279,7 +284,7 @@ public function getMessage() * * @param string|null $message message * - * @return $this + * @return self */ public function setMessage($message) { @@ -304,18 +309,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php index a0f5ccfd05a7..4deeb067f680 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -64,6 +67,8 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'array_array_number' => null @@ -177,7 +182,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['array_array_number'] = isset($data['array_array_number']) ? $data['array_array_number'] : null; + $this->container['array_array_number'] = $data['array_array_number'] ?? null; } /** @@ -219,7 +224,7 @@ public function getArrayArrayNumber() * * @param float[][]|null $array_array_number array_array_number * - * @return $this + * @return self */ public function setArrayArrayNumber($array_array_number) { @@ -244,18 +249,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php index 483ea4fbd9e7..cf6fe89d16e6 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -64,6 +67,8 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'array_number' => null @@ -177,7 +182,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['array_number'] = isset($data['array_number']) ? $data['array_number'] : null; + $this->container['array_number'] = $data['array_number'] ?? null; } /** @@ -219,7 +224,7 @@ public function getArrayNumber() * * @param float[]|null $array_number array_number * - * @return $this + * @return self */ public function setArrayNumber($array_number) { @@ -244,18 +249,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php index bad6739097d4..7f598ae04fa7 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ArrayTest implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -66,6 +69,8 @@ class ArrayTest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'array_of_string' => null, @@ -187,9 +192,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['array_of_string'] = isset($data['array_of_string']) ? $data['array_of_string'] : null; - $this->container['array_array_of_integer'] = isset($data['array_array_of_integer']) ? $data['array_array_of_integer'] : null; - $this->container['array_array_of_model'] = isset($data['array_array_of_model']) ? $data['array_array_of_model'] : null; + $this->container['array_of_string'] = $data['array_of_string'] ?? null; + $this->container['array_array_of_integer'] = $data['array_array_of_integer'] ?? null; + $this->container['array_array_of_model'] = $data['array_array_of_model'] ?? null; } /** @@ -231,7 +236,7 @@ public function getArrayOfString() * * @param string[]|null $array_of_string array_of_string * - * @return $this + * @return self */ public function setArrayOfString($array_of_string) { @@ -255,7 +260,7 @@ public function getArrayArrayOfInteger() * * @param int[][]|null $array_array_of_integer array_array_of_integer * - * @return $this + * @return self */ public function setArrayArrayOfInteger($array_array_of_integer) { @@ -279,7 +284,7 @@ public function getArrayArrayOfModel() * * @param \OpenAPI\Client\Model\ReadOnlyFirst[][]|null $array_array_of_model array_array_of_model * - * @return $this + * @return self */ public function setArrayArrayOfModel($array_array_of_model) { @@ -304,18 +309,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php index 973de7be8fce..5fa154bee4ad 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Capitalization implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -69,6 +72,8 @@ class Capitalization implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'small_camel' => null, @@ -202,12 +207,12 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['small_camel'] = isset($data['small_camel']) ? $data['small_camel'] : null; - $this->container['capital_camel'] = isset($data['capital_camel']) ? $data['capital_camel'] : null; - $this->container['small_snake'] = isset($data['small_snake']) ? $data['small_snake'] : null; - $this->container['capital_snake'] = isset($data['capital_snake']) ? $data['capital_snake'] : null; - $this->container['sca_eth_flow_points'] = isset($data['sca_eth_flow_points']) ? $data['sca_eth_flow_points'] : null; - $this->container['att_name'] = isset($data['att_name']) ? $data['att_name'] : null; + $this->container['small_camel'] = $data['small_camel'] ?? null; + $this->container['capital_camel'] = $data['capital_camel'] ?? null; + $this->container['small_snake'] = $data['small_snake'] ?? null; + $this->container['capital_snake'] = $data['capital_snake'] ?? null; + $this->container['sca_eth_flow_points'] = $data['sca_eth_flow_points'] ?? null; + $this->container['att_name'] = $data['att_name'] ?? null; } /** @@ -249,7 +254,7 @@ public function getSmallCamel() * * @param string|null $small_camel small_camel * - * @return $this + * @return self */ public function setSmallCamel($small_camel) { @@ -273,7 +278,7 @@ public function getCapitalCamel() * * @param string|null $capital_camel capital_camel * - * @return $this + * @return self */ public function setCapitalCamel($capital_camel) { @@ -297,7 +302,7 @@ public function getSmallSnake() * * @param string|null $small_snake small_snake * - * @return $this + * @return self */ public function setSmallSnake($small_snake) { @@ -321,7 +326,7 @@ public function getCapitalSnake() * * @param string|null $capital_snake capital_snake * - * @return $this + * @return self */ public function setCapitalSnake($capital_snake) { @@ -345,7 +350,7 @@ public function getScaEthFlowPoints() * * @param string|null $sca_eth_flow_points sca_eth_flow_points * - * @return $this + * @return self */ public function setScaEthFlowPoints($sca_eth_flow_points) { @@ -369,7 +374,7 @@ public function getAttName() * * @param string|null $att_name Name of the pet * - * @return $this + * @return self */ public function setAttName($att_name) { @@ -394,18 +399,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php index 5603aab4c7df..75e10661e9fc 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php @@ -37,10 +37,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Cat extends Animal { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -62,6 +65,8 @@ class Cat extends Animal * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'declawed' => null @@ -171,7 +176,7 @@ public function __construct(array $data = null) { parent::__construct($data); - $this->container['declawed'] = isset($data['declawed']) ? $data['declawed'] : null; + $this->container['declawed'] = $data['declawed'] ?? null; } /** @@ -213,7 +218,7 @@ public function getDeclawed() * * @param bool|null $declawed declawed * - * @return $this + * @return self */ public function setDeclawed($declawed) { @@ -238,18 +243,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php index 8d31dffa0f55..d40c515390f7 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class CatAllOf implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -64,6 +67,8 @@ class CatAllOf implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'declawed' => null @@ -177,7 +182,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['declawed'] = isset($data['declawed']) ? $data['declawed'] : null; + $this->container['declawed'] = $data['declawed'] ?? null; } /** @@ -219,7 +224,7 @@ public function getDeclawed() * * @param bool|null $declawed declawed * - * @return $this + * @return self */ public function setDeclawed($declawed) { @@ -244,18 +249,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php index 174fdd9b84f1..6137a3246008 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Category implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class Category implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'id' => 'int64', @@ -182,8 +187,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : 'default-name'; + $this->container['id'] = $data['id'] ?? null; + $this->container['name'] = $data['name'] ?? 'default-name'; } /** @@ -228,7 +233,7 @@ public function getId() * * @param int|null $id id * - * @return $this + * @return self */ public function setId($id) { @@ -252,7 +257,7 @@ public function getName() * * @param string $name name * - * @return $this + * @return self */ public function setName($name) { @@ -277,18 +282,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php index f833dea74f39..9754dc5466c9 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php @@ -40,10 +40,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ClassModel implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class ClassModel implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ '_class' => null @@ -178,7 +183,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['_class'] = isset($data['_class']) ? $data['_class'] : null; + $this->container['_class'] = $data['_class'] ?? null; } /** @@ -220,7 +225,7 @@ public function getClass() * * @param string|null $_class _class * - * @return $this + * @return self */ public function setClass($_class) { @@ -245,18 +250,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php index 564b89cec449..8099e47db035 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Client implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -64,6 +67,8 @@ class Client implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'client' => null @@ -177,7 +182,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['client'] = isset($data['client']) ? $data['client'] : null; + $this->container['client'] = $data['client'] ?? null; } /** @@ -219,7 +224,7 @@ public function getClient() * * @param string|null $client client * - * @return $this + * @return self */ public function setClient($client) { @@ -244,18 +249,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php index 4a205e6a0acd..8e60b41c02c0 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php @@ -37,10 +37,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Dog extends Animal { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -62,6 +65,8 @@ class Dog extends Animal * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'breed' => null @@ -171,7 +176,7 @@ public function __construct(array $data = null) { parent::__construct($data); - $this->container['breed'] = isset($data['breed']) ? $data['breed'] : null; + $this->container['breed'] = $data['breed'] ?? null; } /** @@ -213,7 +218,7 @@ public function getBreed() * * @param string|null $breed breed * - * @return $this + * @return self */ public function setBreed($breed) { @@ -238,18 +243,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php index dc8ac5fefe7f..d6edf67ccee2 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class DogAllOf implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -64,6 +67,8 @@ class DogAllOf implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'breed' => null @@ -177,7 +182,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['breed'] = isset($data['breed']) ? $data['breed'] : null; + $this->container['breed'] = $data['breed'] ?? null; } /** @@ -219,7 +224,7 @@ public function getBreed() * * @param string|null $breed breed * - * @return $this + * @return self */ public function setBreed($breed) { @@ -244,18 +249,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php index b26906a75cc4..ed05ebfacf75 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class EnumArrays implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class EnumArrays implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'just_symbol' => null, @@ -212,8 +217,8 @@ public function getArrayEnumAllowableValues() */ public function __construct(array $data = null) { - $this->container['just_symbol'] = isset($data['just_symbol']) ? $data['just_symbol'] : null; - $this->container['array_enum'] = isset($data['array_enum']) ? $data['array_enum'] : null; + $this->container['just_symbol'] = $data['just_symbol'] ?? null; + $this->container['array_enum'] = $data['array_enum'] ?? null; } /** @@ -263,7 +268,7 @@ public function getJustSymbol() * * @param string|null $just_symbol just_symbol * - * @return $this + * @return self */ public function setJustSymbol($just_symbol) { @@ -296,7 +301,7 @@ public function getArrayEnum() * * @param string[]|null $array_enum array_enum * - * @return $this + * @return self */ public function setArrayEnum($array_enum) { @@ -330,18 +335,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php index 005a3fea0b3c..8d4bd318cee9 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class EnumTest implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -71,6 +74,8 @@ class EnumTest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'enum_string' => null, @@ -276,14 +281,14 @@ public function getEnumNumberAllowableValues() */ public function __construct(array $data = null) { - $this->container['enum_string'] = isset($data['enum_string']) ? $data['enum_string'] : null; - $this->container['enum_string_required'] = isset($data['enum_string_required']) ? $data['enum_string_required'] : null; - $this->container['enum_integer'] = isset($data['enum_integer']) ? $data['enum_integer'] : null; - $this->container['enum_number'] = isset($data['enum_number']) ? $data['enum_number'] : null; - $this->container['outer_enum'] = isset($data['outer_enum']) ? $data['outer_enum'] : null; - $this->container['outer_enum_integer'] = isset($data['outer_enum_integer']) ? $data['outer_enum_integer'] : null; - $this->container['outer_enum_default_value'] = isset($data['outer_enum_default_value']) ? $data['outer_enum_default_value'] : null; - $this->container['outer_enum_integer_default_value'] = isset($data['outer_enum_integer_default_value']) ? $data['outer_enum_integer_default_value'] : null; + $this->container['enum_string'] = $data['enum_string'] ?? null; + $this->container['enum_string_required'] = $data['enum_string_required'] ?? null; + $this->container['enum_integer'] = $data['enum_integer'] ?? null; + $this->container['enum_number'] = $data['enum_number'] ?? null; + $this->container['outer_enum'] = $data['outer_enum'] ?? null; + $this->container['outer_enum_integer'] = $data['outer_enum_integer'] ?? null; + $this->container['outer_enum_default_value'] = $data['outer_enum_default_value'] ?? null; + $this->container['outer_enum_integer_default_value'] = $data['outer_enum_integer_default_value'] ?? null; } /** @@ -360,7 +365,7 @@ public function getEnumString() * * @param string|null $enum_string enum_string * - * @return $this + * @return self */ public function setEnumString($enum_string) { @@ -393,7 +398,7 @@ public function getEnumStringRequired() * * @param string $enum_string_required enum_string_required * - * @return $this + * @return self */ public function setEnumStringRequired($enum_string_required) { @@ -426,7 +431,7 @@ public function getEnumInteger() * * @param int|null $enum_integer enum_integer * - * @return $this + * @return self */ public function setEnumInteger($enum_integer) { @@ -459,7 +464,7 @@ public function getEnumNumber() * * @param double|null $enum_number enum_number * - * @return $this + * @return self */ public function setEnumNumber($enum_number) { @@ -492,7 +497,7 @@ public function getOuterEnum() * * @param \OpenAPI\Client\Model\OuterEnum|null $outer_enum outer_enum * - * @return $this + * @return self */ public function setOuterEnum($outer_enum) { @@ -516,7 +521,7 @@ public function getOuterEnumInteger() * * @param \OpenAPI\Client\Model\OuterEnumInteger|null $outer_enum_integer outer_enum_integer * - * @return $this + * @return self */ public function setOuterEnumInteger($outer_enum_integer) { @@ -540,7 +545,7 @@ public function getOuterEnumDefaultValue() * * @param \OpenAPI\Client\Model\OuterEnumDefaultValue|null $outer_enum_default_value outer_enum_default_value * - * @return $this + * @return self */ public function setOuterEnumDefaultValue($outer_enum_default_value) { @@ -564,7 +569,7 @@ public function getOuterEnumIntegerDefaultValue() * * @param \OpenAPI\Client\Model\OuterEnumIntegerDefaultValue|null $outer_enum_integer_default_value outer_enum_integer_default_value * - * @return $this + * @return self */ public function setOuterEnumIntegerDefaultValue($outer_enum_integer_default_value) { @@ -589,18 +594,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php index 03a15d5b8021..cb0a923af33b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php @@ -40,10 +40,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class File implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class File implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'source_uri' => null @@ -178,7 +183,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['source_uri'] = isset($data['source_uri']) ? $data['source_uri'] : null; + $this->container['source_uri'] = $data['source_uri'] ?? null; } /** @@ -220,7 +225,7 @@ public function getSourceUri() * * @param string|null $source_uri Test capitalization * - * @return $this + * @return self */ public function setSourceUri($source_uri) { @@ -245,18 +250,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php index 4f8ffd8d9de8..165c679fdc3f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class FileSchemaTestClass implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'file' => null, @@ -182,8 +187,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['file'] = isset($data['file']) ? $data['file'] : null; - $this->container['files'] = isset($data['files']) ? $data['files'] : null; + $this->container['file'] = $data['file'] ?? null; + $this->container['files'] = $data['files'] ?? null; } /** @@ -225,7 +230,7 @@ public function getFile() * * @param \OpenAPI\Client\Model\File|null $file file * - * @return $this + * @return self */ public function setFile($file) { @@ -249,7 +254,7 @@ public function getFiles() * * @param \OpenAPI\Client\Model\File[]|null $files files * - * @return $this + * @return self */ public function setFiles($files) { @@ -274,18 +279,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php index 8213f1d0e348..b7562e157007 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Foo implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -64,6 +67,8 @@ class Foo implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'bar' => null @@ -177,7 +182,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['bar'] = isset($data['bar']) ? $data['bar'] : 'bar'; + $this->container['bar'] = $data['bar'] ?? 'bar'; } /** @@ -219,7 +224,7 @@ public function getBar() * * @param string|null $bar bar * - * @return $this + * @return self */ public function setBar($bar) { @@ -244,18 +249,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php index 0394d187aca0..49b33571f0ca 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class FormatTest implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -78,6 +81,8 @@ class FormatTest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'integer' => null, @@ -247,21 +252,21 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['integer'] = isset($data['integer']) ? $data['integer'] : null; - $this->container['int32'] = isset($data['int32']) ? $data['int32'] : null; - $this->container['int64'] = isset($data['int64']) ? $data['int64'] : null; - $this->container['number'] = isset($data['number']) ? $data['number'] : null; - $this->container['float'] = isset($data['float']) ? $data['float'] : null; - $this->container['double'] = isset($data['double']) ? $data['double'] : null; - $this->container['string'] = isset($data['string']) ? $data['string'] : null; - $this->container['byte'] = isset($data['byte']) ? $data['byte'] : null; - $this->container['binary'] = isset($data['binary']) ? $data['binary'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null; - $this->container['uuid'] = isset($data['uuid']) ? $data['uuid'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['pattern_with_digits'] = isset($data['pattern_with_digits']) ? $data['pattern_with_digits'] : null; - $this->container['pattern_with_digits_and_delimiter'] = isset($data['pattern_with_digits_and_delimiter']) ? $data['pattern_with_digits_and_delimiter'] : null; + $this->container['integer'] = $data['integer'] ?? null; + $this->container['int32'] = $data['int32'] ?? null; + $this->container['int64'] = $data['int64'] ?? null; + $this->container['number'] = $data['number'] ?? null; + $this->container['float'] = $data['float'] ?? null; + $this->container['double'] = $data['double'] ?? null; + $this->container['string'] = $data['string'] ?? null; + $this->container['byte'] = $data['byte'] ?? null; + $this->container['binary'] = $data['binary'] ?? null; + $this->container['date'] = $data['date'] ?? null; + $this->container['date_time'] = $data['date_time'] ?? null; + $this->container['uuid'] = $data['uuid'] ?? null; + $this->container['password'] = $data['password'] ?? null; + $this->container['pattern_with_digits'] = $data['pattern_with_digits'] ?? null; + $this->container['pattern_with_digits_and_delimiter'] = $data['pattern_with_digits_and_delimiter'] ?? null; } /** @@ -375,7 +380,7 @@ public function getInteger() * * @param int|null $integer integer * - * @return $this + * @return self */ public function setInteger($integer) { @@ -407,7 +412,7 @@ public function getInt32() * * @param int|null $int32 int32 * - * @return $this + * @return self */ public function setInt32($int32) { @@ -439,7 +444,7 @@ public function getInt64() * * @param int|null $int64 int64 * - * @return $this + * @return self */ public function setInt64($int64) { @@ -463,7 +468,7 @@ public function getNumber() * * @param float $number number * - * @return $this + * @return self */ public function setNumber($number) { @@ -495,7 +500,7 @@ public function getFloat() * * @param float|null $float float * - * @return $this + * @return self */ public function setFloat($float) { @@ -527,7 +532,7 @@ public function getDouble() * * @param double|null $double double * - * @return $this + * @return self */ public function setDouble($double) { @@ -559,7 +564,7 @@ public function getString() * * @param string|null $string string * - * @return $this + * @return self */ public function setString($string) { @@ -588,7 +593,7 @@ public function getByte() * * @param string $byte byte * - * @return $this + * @return self */ public function setByte($byte) { @@ -612,7 +617,7 @@ public function getBinary() * * @param \SplFileObject|null $binary binary * - * @return $this + * @return self */ public function setBinary($binary) { @@ -636,7 +641,7 @@ public function getDate() * * @param \DateTime $date date * - * @return $this + * @return self */ public function setDate($date) { @@ -660,7 +665,7 @@ public function getDateTime() * * @param \DateTime|null $date_time date_time * - * @return $this + * @return self */ public function setDateTime($date_time) { @@ -684,7 +689,7 @@ public function getUuid() * * @param string|null $uuid uuid * - * @return $this + * @return self */ public function setUuid($uuid) { @@ -708,7 +713,7 @@ public function getPassword() * * @param string $password password * - * @return $this + * @return self */ public function setPassword($password) { @@ -739,7 +744,7 @@ public function getPatternWithDigits() * * @param string|null $pattern_with_digits A string that is a 10 digit number. Can have leading zeros. * - * @return $this + * @return self */ public function setPatternWithDigits($pattern_with_digits) { @@ -768,7 +773,7 @@ public function getPatternWithDigitsAndDelimiter() * * @param string|null $pattern_with_digits_and_delimiter A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. * - * @return $this + * @return self */ public function setPatternWithDigitsAndDelimiter($pattern_with_digits_and_delimiter) { @@ -798,18 +803,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php index 40a8e5584fc3..eb7571b26510 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class HasOnlyReadOnly implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'bar' => null, @@ -182,8 +187,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['bar'] = isset($data['bar']) ? $data['bar'] : null; - $this->container['foo'] = isset($data['foo']) ? $data['foo'] : null; + $this->container['bar'] = $data['bar'] ?? null; + $this->container['foo'] = $data['foo'] ?? null; } /** @@ -225,7 +230,7 @@ public function getBar() * * @param string|null $bar bar * - * @return $this + * @return self */ public function setBar($bar) { @@ -249,7 +254,7 @@ public function getFoo() * * @param string|null $foo foo * - * @return $this + * @return self */ public function setFoo($foo) { @@ -274,18 +279,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php index 1f959f71635f..ec6b27724c85 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php @@ -40,10 +40,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class HealthCheckResult implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class HealthCheckResult implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'nullable_message' => null @@ -178,7 +183,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['nullable_message'] = isset($data['nullable_message']) ? $data['nullable_message'] : null; + $this->container['nullable_message'] = $data['nullable_message'] ?? null; } /** @@ -220,7 +225,7 @@ public function getNullableMessage() * * @param string|null $nullable_message nullable_message * - * @return $this + * @return self */ public function setNullableMessage($nullable_message) { @@ -245,18 +250,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php index 17808cab18ec..05aed891fbba 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class InlineObject implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class InlineObject implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'name' => null, @@ -182,8 +187,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['name'] = $data['name'] ?? null; + $this->container['status'] = $data['status'] ?? null; } /** @@ -225,7 +230,7 @@ public function getName() * * @param string|null $name Updated name of the pet * - * @return $this + * @return self */ public function setName($name) { @@ -249,7 +254,7 @@ public function getStatus() * * @param string|null $status Updated status of the pet * - * @return $this + * @return self */ public function setStatus($status) { @@ -274,18 +279,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php index 7c16738bc07b..a1dbbb404ab5 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject1.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class InlineObject1 implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class InlineObject1 implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'additional_metadata' => null, @@ -182,8 +187,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['additional_metadata'] = isset($data['additional_metadata']) ? $data['additional_metadata'] : null; - $this->container['file'] = isset($data['file']) ? $data['file'] : null; + $this->container['additional_metadata'] = $data['additional_metadata'] ?? null; + $this->container['file'] = $data['file'] ?? null; } /** @@ -225,7 +230,7 @@ public function getAdditionalMetadata() * * @param string|null $additional_metadata Additional data to pass to server * - * @return $this + * @return self */ public function setAdditionalMetadata($additional_metadata) { @@ -249,7 +254,7 @@ public function getFile() * * @param \SplFileObject|null $file file to upload * - * @return $this + * @return self */ public function setFile($file) { @@ -274,18 +279,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php index 5459e3475bca..d5849b237440 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject2.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class InlineObject2 implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class InlineObject2 implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'enum_form_string_array' => null, @@ -214,8 +219,8 @@ public function getEnumFormStringAllowableValues() */ public function __construct(array $data = null) { - $this->container['enum_form_string_array'] = isset($data['enum_form_string_array']) ? $data['enum_form_string_array'] : null; - $this->container['enum_form_string'] = isset($data['enum_form_string']) ? $data['enum_form_string'] : '-efg'; + $this->container['enum_form_string_array'] = $data['enum_form_string_array'] ?? null; + $this->container['enum_form_string'] = $data['enum_form_string'] ?? '-efg'; } /** @@ -265,7 +270,7 @@ public function getEnumFormStringArray() * * @param string[]|null $enum_form_string_array Form parameter enum test (string array) * - * @return $this + * @return self */ public function setEnumFormStringArray($enum_form_string_array) { @@ -298,7 +303,7 @@ public function getEnumFormString() * * @param string|null $enum_form_string Form parameter enum test (string) * - * @return $this + * @return self */ public function setEnumFormString($enum_form_string) { @@ -332,18 +337,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php index c1383f808038..4fa7ba14dd78 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject3.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class InlineObject3 implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -77,6 +80,8 @@ class InlineObject3 implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'integer' => null, @@ -242,20 +247,20 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['integer'] = isset($data['integer']) ? $data['integer'] : null; - $this->container['int32'] = isset($data['int32']) ? $data['int32'] : null; - $this->container['int64'] = isset($data['int64']) ? $data['int64'] : null; - $this->container['number'] = isset($data['number']) ? $data['number'] : null; - $this->container['float'] = isset($data['float']) ? $data['float'] : null; - $this->container['double'] = isset($data['double']) ? $data['double'] : null; - $this->container['string'] = isset($data['string']) ? $data['string'] : null; - $this->container['pattern_without_delimiter'] = isset($data['pattern_without_delimiter']) ? $data['pattern_without_delimiter'] : null; - $this->container['byte'] = isset($data['byte']) ? $data['byte'] : null; - $this->container['binary'] = isset($data['binary']) ? $data['binary'] : null; - $this->container['date'] = isset($data['date']) ? $data['date'] : null; - $this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['callback'] = isset($data['callback']) ? $data['callback'] : null; + $this->container['integer'] = $data['integer'] ?? null; + $this->container['int32'] = $data['int32'] ?? null; + $this->container['int64'] = $data['int64'] ?? null; + $this->container['number'] = $data['number'] ?? null; + $this->container['float'] = $data['float'] ?? null; + $this->container['double'] = $data['double'] ?? null; + $this->container['string'] = $data['string'] ?? null; + $this->container['pattern_without_delimiter'] = $data['pattern_without_delimiter'] ?? null; + $this->container['byte'] = $data['byte'] ?? null; + $this->container['binary'] = $data['binary'] ?? null; + $this->container['date'] = $data['date'] ?? null; + $this->container['date_time'] = $data['date_time'] ?? null; + $this->container['password'] = $data['password'] ?? null; + $this->container['callback'] = $data['callback'] ?? null; } /** @@ -361,7 +366,7 @@ public function getInteger() * * @param int|null $integer None * - * @return $this + * @return self */ public function setInteger($integer) { @@ -393,7 +398,7 @@ public function getInt32() * * @param int|null $int32 None * - * @return $this + * @return self */ public function setInt32($int32) { @@ -425,7 +430,7 @@ public function getInt64() * * @param int|null $int64 None * - * @return $this + * @return self */ public function setInt64($int64) { @@ -449,7 +454,7 @@ public function getNumber() * * @param float $number None * - * @return $this + * @return self */ public function setNumber($number) { @@ -481,7 +486,7 @@ public function getFloat() * * @param float|null $float None * - * @return $this + * @return self */ public function setFloat($float) { @@ -510,7 +515,7 @@ public function getDouble() * * @param double $double None * - * @return $this + * @return self */ public function setDouble($double) { @@ -542,7 +547,7 @@ public function getString() * * @param string|null $string None * - * @return $this + * @return self */ public function setString($string) { @@ -571,7 +576,7 @@ public function getPatternWithoutDelimiter() * * @param string $pattern_without_delimiter None * - * @return $this + * @return self */ public function setPatternWithoutDelimiter($pattern_without_delimiter) { @@ -600,7 +605,7 @@ public function getByte() * * @param string $byte None * - * @return $this + * @return self */ public function setByte($byte) { @@ -624,7 +629,7 @@ public function getBinary() * * @param \SplFileObject|null $binary None * - * @return $this + * @return self */ public function setBinary($binary) { @@ -648,7 +653,7 @@ public function getDate() * * @param \DateTime|null $date None * - * @return $this + * @return self */ public function setDate($date) { @@ -672,7 +677,7 @@ public function getDateTime() * * @param \DateTime|null $date_time None * - * @return $this + * @return self */ public function setDateTime($date_time) { @@ -696,7 +701,7 @@ public function getPassword() * * @param string|null $password None * - * @return $this + * @return self */ public function setPassword($password) { @@ -727,7 +732,7 @@ public function getCallback() * * @param string|null $callback None * - * @return $this + * @return self */ public function setCallback($callback) { @@ -752,18 +757,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php index 67120fcf6a47..04a9d0743434 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject4.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class InlineObject4 implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class InlineObject4 implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'param' => null, @@ -182,8 +187,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['param'] = isset($data['param']) ? $data['param'] : null; - $this->container['param2'] = isset($data['param2']) ? $data['param2'] : null; + $this->container['param'] = $data['param'] ?? null; + $this->container['param2'] = $data['param2'] ?? null; } /** @@ -231,7 +236,7 @@ public function getParam() * * @param string $param field1 * - * @return $this + * @return self */ public function setParam($param) { @@ -255,7 +260,7 @@ public function getParam2() * * @param string $param2 field2 * - * @return $this + * @return self */ public function setParam2($param2) { @@ -280,18 +285,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php index fe0456b3a838..fba00cddf6a6 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineObject5.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class InlineObject5 implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class InlineObject5 implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'additional_metadata' => null, @@ -182,8 +187,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['additional_metadata'] = isset($data['additional_metadata']) ? $data['additional_metadata'] : null; - $this->container['required_file'] = isset($data['required_file']) ? $data['required_file'] : null; + $this->container['additional_metadata'] = $data['additional_metadata'] ?? null; + $this->container['required_file'] = $data['required_file'] ?? null; } /** @@ -228,7 +233,7 @@ public function getAdditionalMetadata() * * @param string|null $additional_metadata Additional data to pass to server * - * @return $this + * @return self */ public function setAdditionalMetadata($additional_metadata) { @@ -252,7 +257,7 @@ public function getRequiredFile() * * @param \SplFileObject $required_file file to upload * - * @return $this + * @return self */ public function setRequiredFile($required_file) { @@ -277,18 +282,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php index 53146c15e459..b2ff1f1b8f1e 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/InlineResponseDefault.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class InlineResponseDefault implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -64,6 +67,8 @@ class InlineResponseDefault implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'string' => null @@ -177,7 +182,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['string'] = isset($data['string']) ? $data['string'] : null; + $this->container['string'] = $data['string'] ?? null; } /** @@ -219,7 +224,7 @@ public function getString() * * @param \OpenAPI\Client\Model\Foo|null $string string * - * @return $this + * @return self */ public function setString($string) { @@ -244,18 +249,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php index be76b2439b92..e6f4a1294552 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class MapTest implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -67,6 +70,8 @@ class MapTest implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'map_map_of_string' => null, @@ -207,10 +212,10 @@ public function getMapOfEnumStringAllowableValues() */ public function __construct(array $data = null) { - $this->container['map_map_of_string'] = isset($data['map_map_of_string']) ? $data['map_map_of_string'] : null; - $this->container['map_of_enum_string'] = isset($data['map_of_enum_string']) ? $data['map_of_enum_string'] : null; - $this->container['direct_map'] = isset($data['direct_map']) ? $data['direct_map'] : null; - $this->container['indirect_map'] = isset($data['indirect_map']) ? $data['indirect_map'] : null; + $this->container['map_map_of_string'] = $data['map_map_of_string'] ?? null; + $this->container['map_of_enum_string'] = $data['map_of_enum_string'] ?? null; + $this->container['direct_map'] = $data['direct_map'] ?? null; + $this->container['indirect_map'] = $data['indirect_map'] ?? null; } /** @@ -252,7 +257,7 @@ public function getMapMapOfString() * * @param map[string,map[string,string]]|null $map_map_of_string map_map_of_string * - * @return $this + * @return self */ public function setMapMapOfString($map_map_of_string) { @@ -276,7 +281,7 @@ public function getMapOfEnumString() * * @param map[string,string]|null $map_of_enum_string map_of_enum_string * - * @return $this + * @return self */ public function setMapOfEnumString($map_of_enum_string) { @@ -309,7 +314,7 @@ public function getDirectMap() * * @param map[string,bool]|null $direct_map direct_map * - * @return $this + * @return self */ public function setDirectMap($direct_map) { @@ -333,7 +338,7 @@ public function getIndirectMap() * * @param map[string,bool]|null $indirect_map indirect_map * - * @return $this + * @return self */ public function setIndirectMap($indirect_map) { @@ -358,18 +363,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php index 2522e4d5d523..31bcc81816d3 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -66,6 +69,8 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'uuid' => 'uuid', @@ -187,9 +192,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['uuid'] = isset($data['uuid']) ? $data['uuid'] : null; - $this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null; - $this->container['map'] = isset($data['map']) ? $data['map'] : null; + $this->container['uuid'] = $data['uuid'] ?? null; + $this->container['date_time'] = $data['date_time'] ?? null; + $this->container['map'] = $data['map'] ?? null; } /** @@ -231,7 +236,7 @@ public function getUuid() * * @param string|null $uuid uuid * - * @return $this + * @return self */ public function setUuid($uuid) { @@ -255,7 +260,7 @@ public function getDateTime() * * @param \DateTime|null $date_time date_time * - * @return $this + * @return self */ public function setDateTime($date_time) { @@ -279,7 +284,7 @@ public function getMap() * * @param map[string,\OpenAPI\Client\Model\Animal]|null $map map * - * @return $this + * @return self */ public function setMap($map) { @@ -304,18 +309,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php index 5be747eb5253..92b79ab9c600 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php @@ -40,10 +40,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Model200Response implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -66,6 +69,8 @@ class Model200Response implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'name' => 'int32', @@ -183,8 +188,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['class'] = isset($data['class']) ? $data['class'] : null; + $this->container['name'] = $data['name'] ?? null; + $this->container['class'] = $data['class'] ?? null; } /** @@ -226,7 +231,7 @@ public function getName() * * @param int|null $name name * - * @return $this + * @return self */ public function setName($name) { @@ -250,7 +255,7 @@ public function getClass() * * @param string|null $class class * - * @return $this + * @return self */ public function setClass($class) { @@ -275,18 +280,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php index 85335938efd3..dacecc851ab9 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ModelList implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -64,6 +67,8 @@ class ModelList implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ '_123_list' => null @@ -177,7 +182,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['_123_list'] = isset($data['_123_list']) ? $data['_123_list'] : null; + $this->container['_123_list'] = $data['_123_list'] ?? null; } /** @@ -219,7 +224,7 @@ public function get123List() * * @param string|null $_123_list _123_list * - * @return $this + * @return self */ public function set123List($_123_list) { @@ -244,18 +249,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php index 7de6909e70b0..26f905224a05 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php @@ -40,10 +40,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ModelReturn implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class ModelReturn implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'return' => 'int32' @@ -178,7 +183,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['return'] = isset($data['return']) ? $data['return'] : null; + $this->container['return'] = $data['return'] ?? null; } /** @@ -220,7 +225,7 @@ public function getReturn() * * @param int|null $return return * - * @return $this + * @return self */ public function setReturn($return) { @@ -245,18 +250,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php index a3eddb499868..9f4fe7734c2c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php @@ -40,10 +40,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Name implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -68,6 +71,8 @@ class Name implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'name' => 'int32', @@ -193,10 +198,10 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['snake_case'] = isset($data['snake_case']) ? $data['snake_case'] : null; - $this->container['property'] = isset($data['property']) ? $data['property'] : null; - $this->container['_123_number'] = isset($data['_123_number']) ? $data['_123_number'] : null; + $this->container['name'] = $data['name'] ?? null; + $this->container['snake_case'] = $data['snake_case'] ?? null; + $this->container['property'] = $data['property'] ?? null; + $this->container['_123_number'] = $data['_123_number'] ?? null; } /** @@ -241,7 +246,7 @@ public function getName() * * @param int $name name * - * @return $this + * @return self */ public function setName($name) { @@ -265,7 +270,7 @@ public function getSnakeCase() * * @param int|null $snake_case snake_case * - * @return $this + * @return self */ public function setSnakeCase($snake_case) { @@ -289,7 +294,7 @@ public function getProperty() * * @param string|null $property property * - * @return $this + * @return self */ public function setProperty($property) { @@ -313,7 +318,7 @@ public function get123Number() * * @param int|null $_123_number _123_number * - * @return $this + * @return self */ public function set123Number($_123_number) { @@ -338,18 +343,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php index 170f6a256fc9..f00792ef3649 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class NullableClass implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -75,6 +78,8 @@ class NullableClass implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'integer_prop' => null, @@ -232,18 +237,18 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['integer_prop'] = isset($data['integer_prop']) ? $data['integer_prop'] : null; - $this->container['number_prop'] = isset($data['number_prop']) ? $data['number_prop'] : null; - $this->container['boolean_prop'] = isset($data['boolean_prop']) ? $data['boolean_prop'] : null; - $this->container['string_prop'] = isset($data['string_prop']) ? $data['string_prop'] : null; - $this->container['date_prop'] = isset($data['date_prop']) ? $data['date_prop'] : null; - $this->container['datetime_prop'] = isset($data['datetime_prop']) ? $data['datetime_prop'] : null; - $this->container['array_nullable_prop'] = isset($data['array_nullable_prop']) ? $data['array_nullable_prop'] : null; - $this->container['array_and_items_nullable_prop'] = isset($data['array_and_items_nullable_prop']) ? $data['array_and_items_nullable_prop'] : null; - $this->container['array_items_nullable'] = isset($data['array_items_nullable']) ? $data['array_items_nullable'] : null; - $this->container['object_nullable_prop'] = isset($data['object_nullable_prop']) ? $data['object_nullable_prop'] : null; - $this->container['object_and_items_nullable_prop'] = isset($data['object_and_items_nullable_prop']) ? $data['object_and_items_nullable_prop'] : null; - $this->container['object_items_nullable'] = isset($data['object_items_nullable']) ? $data['object_items_nullable'] : null; + $this->container['integer_prop'] = $data['integer_prop'] ?? null; + $this->container['number_prop'] = $data['number_prop'] ?? null; + $this->container['boolean_prop'] = $data['boolean_prop'] ?? null; + $this->container['string_prop'] = $data['string_prop'] ?? null; + $this->container['date_prop'] = $data['date_prop'] ?? null; + $this->container['datetime_prop'] = $data['datetime_prop'] ?? null; + $this->container['array_nullable_prop'] = $data['array_nullable_prop'] ?? null; + $this->container['array_and_items_nullable_prop'] = $data['array_and_items_nullable_prop'] ?? null; + $this->container['array_items_nullable'] = $data['array_items_nullable'] ?? null; + $this->container['object_nullable_prop'] = $data['object_nullable_prop'] ?? null; + $this->container['object_and_items_nullable_prop'] = $data['object_and_items_nullable_prop'] ?? null; + $this->container['object_items_nullable'] = $data['object_items_nullable'] ?? null; } /** @@ -285,7 +290,7 @@ public function getIntegerProp() * * @param int|null $integer_prop integer_prop * - * @return $this + * @return self */ public function setIntegerProp($integer_prop) { @@ -309,7 +314,7 @@ public function getNumberProp() * * @param float|null $number_prop number_prop * - * @return $this + * @return self */ public function setNumberProp($number_prop) { @@ -333,7 +338,7 @@ public function getBooleanProp() * * @param bool|null $boolean_prop boolean_prop * - * @return $this + * @return self */ public function setBooleanProp($boolean_prop) { @@ -357,7 +362,7 @@ public function getStringProp() * * @param string|null $string_prop string_prop * - * @return $this + * @return self */ public function setStringProp($string_prop) { @@ -381,7 +386,7 @@ public function getDateProp() * * @param \DateTime|null $date_prop date_prop * - * @return $this + * @return self */ public function setDateProp($date_prop) { @@ -405,7 +410,7 @@ public function getDatetimeProp() * * @param \DateTime|null $datetime_prop datetime_prop * - * @return $this + * @return self */ public function setDatetimeProp($datetime_prop) { @@ -429,7 +434,7 @@ public function getArrayNullableProp() * * @param object[]|null $array_nullable_prop array_nullable_prop * - * @return $this + * @return self */ public function setArrayNullableProp($array_nullable_prop) { @@ -453,7 +458,7 @@ public function getArrayAndItemsNullableProp() * * @param object[]|null $array_and_items_nullable_prop array_and_items_nullable_prop * - * @return $this + * @return self */ public function setArrayAndItemsNullableProp($array_and_items_nullable_prop) { @@ -477,7 +482,7 @@ public function getArrayItemsNullable() * * @param object[]|null $array_items_nullable array_items_nullable * - * @return $this + * @return self */ public function setArrayItemsNullable($array_items_nullable) { @@ -501,7 +506,7 @@ public function getObjectNullableProp() * * @param map[string,object]|null $object_nullable_prop object_nullable_prop * - * @return $this + * @return self */ public function setObjectNullableProp($object_nullable_prop) { @@ -525,7 +530,7 @@ public function getObjectAndItemsNullableProp() * * @param map[string,object]|null $object_and_items_nullable_prop object_and_items_nullable_prop * - * @return $this + * @return self */ public function setObjectAndItemsNullableProp($object_and_items_nullable_prop) { @@ -549,7 +554,7 @@ public function getObjectItemsNullable() * * @param map[string,object]|null $object_items_nullable object_items_nullable * - * @return $this + * @return self */ public function setObjectItemsNullable($object_items_nullable) { @@ -574,18 +579,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php index 17b092299c13..0f4af94c9ff5 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class NumberOnly implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -64,6 +67,8 @@ class NumberOnly implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'just_number' => null @@ -177,7 +182,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['just_number'] = isset($data['just_number']) ? $data['just_number'] : null; + $this->container['just_number'] = $data['just_number'] ?? null; } /** @@ -219,7 +224,7 @@ public function getJustNumber() * * @param float|null $just_number just_number * - * @return $this + * @return self */ public function setJustNumber($just_number) { @@ -244,18 +249,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php index 0fce0df270cc..34084f1ea23a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Order implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -69,6 +72,8 @@ class Order implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'id' => 'int64', @@ -219,12 +224,12 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['pet_id'] = isset($data['pet_id']) ? $data['pet_id'] : null; - $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; - $this->container['ship_date'] = isset($data['ship_date']) ? $data['ship_date'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; - $this->container['complete'] = isset($data['complete']) ? $data['complete'] : false; + $this->container['id'] = $data['id'] ?? null; + $this->container['pet_id'] = $data['pet_id'] ?? null; + $this->container['quantity'] = $data['quantity'] ?? null; + $this->container['ship_date'] = $data['ship_date'] ?? null; + $this->container['status'] = $data['status'] ?? null; + $this->container['complete'] = $data['complete'] ?? false; } /** @@ -274,7 +279,7 @@ public function getId() * * @param int|null $id id * - * @return $this + * @return self */ public function setId($id) { @@ -298,7 +303,7 @@ public function getPetId() * * @param int|null $pet_id pet_id * - * @return $this + * @return self */ public function setPetId($pet_id) { @@ -322,7 +327,7 @@ public function getQuantity() * * @param int|null $quantity quantity * - * @return $this + * @return self */ public function setQuantity($quantity) { @@ -346,7 +351,7 @@ public function getShipDate() * * @param \DateTime|null $ship_date ship_date * - * @return $this + * @return self */ public function setShipDate($ship_date) { @@ -370,7 +375,7 @@ public function getStatus() * * @param string|null $status Order Status * - * @return $this + * @return self */ public function setStatus($status) { @@ -403,7 +408,7 @@ public function getComplete() * * @param bool|null $complete complete * - * @return $this + * @return self */ public function setComplete($complete) { @@ -428,18 +433,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php index cab3e72a8c48..f2558176b29b 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class OuterComposite implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -66,6 +69,8 @@ class OuterComposite implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'my_number' => null, @@ -187,9 +192,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['my_number'] = isset($data['my_number']) ? $data['my_number'] : null; - $this->container['my_string'] = isset($data['my_string']) ? $data['my_string'] : null; - $this->container['my_boolean'] = isset($data['my_boolean']) ? $data['my_boolean'] : null; + $this->container['my_number'] = $data['my_number'] ?? null; + $this->container['my_string'] = $data['my_string'] ?? null; + $this->container['my_boolean'] = $data['my_boolean'] ?? null; } /** @@ -231,7 +236,7 @@ public function getMyNumber() * * @param float|null $my_number my_number * - * @return $this + * @return self */ public function setMyNumber($my_number) { @@ -255,7 +260,7 @@ public function getMyString() * * @param string|null $my_string my_string * - * @return $this + * @return self */ public function setMyString($my_string) { @@ -279,7 +284,7 @@ public function getMyBoolean() * * @param bool|null $my_boolean my_boolean * - * @return $this + * @return self */ public function setMyBoolean($my_boolean) { @@ -304,18 +309,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php index 4e341c3f60ec..7bbdafe09667 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Pet implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -69,6 +72,8 @@ class Pet implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'id' => 'int64', @@ -219,12 +224,12 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['category'] = isset($data['category']) ? $data['category'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; - $this->container['photo_urls'] = isset($data['photo_urls']) ? $data['photo_urls'] : null; - $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; - $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['id'] = $data['id'] ?? null; + $this->container['category'] = $data['category'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['photo_urls'] = $data['photo_urls'] ?? null; + $this->container['tags'] = $data['tags'] ?? null; + $this->container['status'] = $data['status'] ?? null; } /** @@ -280,7 +285,7 @@ public function getId() * * @param int|null $id id * - * @return $this + * @return self */ public function setId($id) { @@ -304,7 +309,7 @@ public function getCategory() * * @param \OpenAPI\Client\Model\Category|null $category category * - * @return $this + * @return self */ public function setCategory($category) { @@ -328,7 +333,7 @@ public function getName() * * @param string $name name * - * @return $this + * @return self */ public function setName($name) { @@ -352,7 +357,7 @@ public function getPhotoUrls() * * @param string[] $photo_urls photo_urls * - * @return $this + * @return self */ public function setPhotoUrls($photo_urls) { @@ -376,7 +381,7 @@ public function getTags() * * @param \OpenAPI\Client\Model\Tag[]|null $tags tags * - * @return $this + * @return self */ public function setTags($tags) { @@ -400,7 +405,7 @@ public function getStatus() * * @param string|null $status pet status in the store * - * @return $this + * @return self */ public function setStatus($status) { @@ -434,18 +439,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php index 1cdb5ac74daf..d859ef1b6114 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ReadOnlyFirst implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'bar' => null, @@ -182,8 +187,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['bar'] = isset($data['bar']) ? $data['bar'] : null; - $this->container['baz'] = isset($data['baz']) ? $data['baz'] : null; + $this->container['bar'] = $data['bar'] ?? null; + $this->container['baz'] = $data['baz'] ?? null; } /** @@ -225,7 +230,7 @@ public function getBar() * * @param string|null $bar bar * - * @return $this + * @return self */ public function setBar($bar) { @@ -249,7 +254,7 @@ public function getBaz() * * @param string|null $baz baz * - * @return $this + * @return self */ public function setBaz($baz) { @@ -274,18 +279,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php index b58e8fcff1e2..4ea1a0f26dee 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class SpecialModelName implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -64,6 +67,8 @@ class SpecialModelName implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'special_property_name' => 'int64' @@ -177,7 +182,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['special_property_name'] = isset($data['special_property_name']) ? $data['special_property_name'] : null; + $this->container['special_property_name'] = $data['special_property_name'] ?? null; } /** @@ -219,7 +224,7 @@ public function getSpecialPropertyName() * * @param int|null $special_property_name special_property_name * - * @return $this + * @return self */ public function setSpecialPropertyName($special_property_name) { @@ -244,18 +249,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php index 1c3dd48126d1..3eb455e0f7cc 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Tag implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -65,6 +68,8 @@ class Tag implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'id' => 'int64', @@ -182,8 +187,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['id'] = $data['id'] ?? null; + $this->container['name'] = $data['name'] ?? null; } /** @@ -225,7 +230,7 @@ public function getId() * * @param int|null $id id * - * @return $this + * @return self */ public function setId($id) { @@ -249,7 +254,7 @@ public function getName() * * @param string|null $name name * - * @return $this + * @return self */ public function setName($name) { @@ -274,18 +279,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php index 859a20252490..4e40a57fd78a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php @@ -39,10 +39,13 @@ * @package OpenAPI\Client * @author OpenAPI Generator team * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class User implements ModelInterface, ArrayAccess { - const DISCRIMINATOR = null; + public const DISCRIMINATOR = null; /** * The original name of the model. @@ -71,6 +74,8 @@ class User implements ModelInterface, ArrayAccess * Array of property to format mappings. Used for (de)serialization * * @var string[] + * @phpstan-var array + * @psalm-var array */ protected static $openAPIFormats = [ 'id' => 'int64', @@ -212,14 +217,14 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = isset($data['id']) ? $data['id'] : null; - $this->container['username'] = isset($data['username']) ? $data['username'] : null; - $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; - $this->container['last_name'] = isset($data['last_name']) ? $data['last_name'] : null; - $this->container['email'] = isset($data['email']) ? $data['email'] : null; - $this->container['password'] = isset($data['password']) ? $data['password'] : null; - $this->container['phone'] = isset($data['phone']) ? $data['phone'] : null; - $this->container['user_status'] = isset($data['user_status']) ? $data['user_status'] : null; + $this->container['id'] = $data['id'] ?? null; + $this->container['username'] = $data['username'] ?? null; + $this->container['first_name'] = $data['first_name'] ?? null; + $this->container['last_name'] = $data['last_name'] ?? null; + $this->container['email'] = $data['email'] ?? null; + $this->container['password'] = $data['password'] ?? null; + $this->container['phone'] = $data['phone'] ?? null; + $this->container['user_status'] = $data['user_status'] ?? null; } /** @@ -261,7 +266,7 @@ public function getId() * * @param int|null $id id * - * @return $this + * @return self */ public function setId($id) { @@ -285,7 +290,7 @@ public function getUsername() * * @param string|null $username username * - * @return $this + * @return self */ public function setUsername($username) { @@ -309,7 +314,7 @@ public function getFirstName() * * @param string|null $first_name first_name * - * @return $this + * @return self */ public function setFirstName($first_name) { @@ -333,7 +338,7 @@ public function getLastName() * * @param string|null $last_name last_name * - * @return $this + * @return self */ public function setLastName($last_name) { @@ -357,7 +362,7 @@ public function getEmail() * * @param string|null $email email * - * @return $this + * @return self */ public function setEmail($email) { @@ -381,7 +386,7 @@ public function getPassword() * * @param string|null $password password * - * @return $this + * @return self */ public function setPassword($password) { @@ -405,7 +410,7 @@ public function getPhone() * * @param string|null $phone phone * - * @return $this + * @return self */ public function setPhone($phone) { @@ -429,7 +434,7 @@ public function getUserStatus() * * @param int|null $user_status User Status * - * @return $this + * @return self */ public function setUserStatus($user_status) { @@ -454,18 +459,18 @@ public function offsetExists($offset) * * @param integer $offset Offset * - * @return mixed + * @return mixed|null */ public function offsetGet($offset) { - return isset($this->container[$offset]) ? $this->container[$offset] : null; + return isset($this->container[$offset]) ?? null; } /** * Sets value based on offset. * - * @param integer $offset Offset - * @param mixed $value Value to be set + * @param int|null $offset Offset + * @param mixed $value Value to be set * * @return void */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index 4c7108c94b6f..8ca97b47c842 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -61,20 +61,26 @@ public static function setDateTimeFormat($format) * @param string $type the OpenAPIToolsType of the data * @param string $format the format of the OpenAPITools type of the data * - * @return string|object serialized form of $data + * @return scalar|object|array|null serialized form of $data */ public static function sanitizeForSerialization($data, $type = null, $format = null) { if (is_scalar($data) || null === $data) { return $data; - } elseif ($data instanceof \DateTime) { + } + + if ($data instanceof \DateTime) { return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat); - } elseif (is_array($data)) { + } + + if (is_array($data)) { foreach ($data as $property => $value) { $data[$property] = self::sanitizeForSerialization($value); } return $data; - } elseif (is_object($data)) { + } + + if (is_object($data)) { $values = []; if ($data instanceof ModelInterface) { $formats = $data::openAPIFormats(); @@ -260,7 +266,9 @@ public static function deserialize($data, $class, $httpHeaders = null) { if (null === $data) { return null; - } elseif (strcasecmp(substr($class, -2), '[]') === 0) { + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { $data = is_string($data) ? json_decode($data) : $data; if (!is_array($data)) { @@ -273,7 +281,9 @@ public static function deserialize($data, $class, $httpHeaders = null) $values[] = self::deserialize($value, $subClass, null); } return $values; - } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + } + + if (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] $data = is_string($data) ? json_decode($data) : $data; settype($data, 'array'); $inner = substr($class, 4, -1); @@ -286,10 +296,14 @@ public static function deserialize($data, $class, $httpHeaders = null) } } return $deserialized; - } elseif ($class === 'object') { + } + + if ($class === 'object') { settype($data, 'array'); return $data; - } elseif ($class === '\DateTime') { + } + + if ($class === '\DateTime') { // Some API's return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not @@ -301,10 +315,14 @@ public static function deserialize($data, $class, $httpHeaders = null) } else { return null; } - } elseif (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + } + + if (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { settype($data, $class); return $data; - } elseif ($class === '\SplFileObject') { + } + + if ($class === '\SplFileObject') { /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name