[php-nextgen] Use php type declarations (#16572)

* WIP: implement strict types

* Add parameter and return types to API methods

* Cleanup imports and some code, fix some phpdoc

* Add toDefaultValue override
This commit is contained in:
Julian Vennen 2023-09-23 09:22:09 +02:00 committed by GitHub
parent 7d60a46bc7
commit d165b8879f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 4787 additions and 3878 deletions

View File

@ -17,17 +17,16 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.ModelsMap;
import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -142,6 +141,15 @@ public class PhpNextgenClientCodegen extends AbstractPhpCodegen {
for (ModelMap m : objs.getModels()) {
CodegenModel model = m.getModel();
for (CodegenProperty prop : model.vars) {
if (prop.isArray || prop.isMap) {
prop.vendorExtensions.putIfAbsent("x-php-prop-type", "array");
}
else {
prop.vendorExtensions.putIfAbsent("x-php-prop-type", prop.dataType);
}
}
if (model.isEnum) {
for (Map<String, Object> enumVars : (List<Map<String, Object>>) model.getAllowableValues().get("enumVars")) {
if ((Boolean) enumVars.get("isString")) {
@ -154,4 +162,41 @@ public class PhpNextgenClientCodegen extends AbstractPhpCodegen {
}
return objs;
}
@Override
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) {
objs = super.postProcessOperationsWithModels(objs, allModels);
OperationMap operations = objs.getOperations();
for (CodegenOperation operation : operations.getOperation()) {
if (operation.returnType == null) {
operation.vendorExtensions.putIfAbsent("x-php-return-type", "void");
}
else {
operation.vendorExtensions.putIfAbsent("x-php-return-type", operation.returnType);
}
for (CodegenParameter param : operation.allParams) {
if (param.isArray || param.isMap) {
param.vendorExtensions.putIfAbsent("x-php-param-type", "array");
}
else {
param.vendorExtensions.putIfAbsent("x-php-param-type", param.dataType);
}
}
}
return objs;
}
@Override
public String toDefaultValue(CodegenProperty codegenProperty, Schema schema) {
if (codegenProperty.isArray) {
if (schema.getDefault() != null) {
return "[" + schema.getDefault().toString() + "]";
} else {
return null;
}
}
return super.toDefaultValue(codegenProperty, schema);
}
}

View File

@ -18,7 +18,8 @@
namespace {{invokerPackage}};
use \Exception;
use Exception;
use stdClass;
/**
* ApiException Class Doc Comment
@ -33,23 +34,23 @@ class ApiException extends Exception
/**
* The HTTP body of the server response either as Json or string.
*
* @var \stdClass|string|null
* @var stdClass|string|null
*/
protected $responseBody;
protected stdClass|string|null $responseBody;
/**
* The HTTP header of the server response.
*
* @var string[]|null
*/
protected $responseHeaders;
protected ?array $responseHeaders;
/**
* The deserialized response object
*
* @var \stdClass|string|null
* @var mixed
*/
protected $responseObject;
protected mixed $responseObject;
/**
* Constructor
@ -57,9 +58,9 @@ class ApiException extends Exception
* @param string $message Error message
* @param int $code HTTP status code
* @param string[]|null $responseHeaders HTTP response header
* @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string
* @param mixed $responseBody HTTP decoded body of the server response either as stdClass or string
*/
public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
public function __construct(string $message = "", int $code = 0, ?array $responseHeaders = [], mixed $responseBody = null)
{
parent::__construct($message, $code);
$this->responseHeaders = $responseHeaders;
@ -71,7 +72,7 @@ class ApiException extends Exception
*
* @return string[]|null HTTP response header
*/
public function getResponseHeaders()
public function getResponseHeaders(): ?array
{
return $this->responseHeaders;
}
@ -79,9 +80,9 @@ class ApiException extends Exception
/**
* Gets the HTTP body of the server response either as Json or string
*
* @return \stdClass|string|null HTTP body of the server response either as \stdClass or string
* @return stdClass|string|null HTTP body of the server response either as \stdClass or string
*/
public function getResponseBody()
public function getResponseBody(): stdClass|string|null
{
return $this->responseBody;
}
@ -93,7 +94,7 @@ class ApiException extends Exception
*
* @return void
*/
public function setResponseObject($obj)
public function setResponseObject(mixed $obj): void
{
$this->responseObject = $obj;
}
@ -103,7 +104,7 @@ class ApiException extends Exception
*
* @return mixed the deserialized response object
*/
public function getResponseObject()
public function getResponseObject(): mixed
{
return $this->responseObject;
}

View File

@ -18,6 +18,8 @@
namespace {{invokerPackage}};
use InvalidArgumentException;
/**
* Configuration Class Doc Comment
*
@ -32,86 +34,86 @@ class Configuration
public const BOOLEAN_FORMAT_STRING = 'string';
/**
* @var Configuration
* @var Configuration|null
*/
private static $defaultConfiguration;
private static ?Configuration $defaultConfiguration = null;
/**
* Associate array to store API key(s)
*
* @var string[]
*/
protected $apiKeys = [];
protected array $apiKeys = [];
/**
* Associate array to store API prefix (e.g. Bearer)
*
* @var string[]
*/
protected $apiKeyPrefixes = [];
protected array $apiKeyPrefixes = [];
/**
* Access token for OAuth/Bearer authentication
*
* @var string
*/
protected $accessToken = '';
protected string $accessToken = '';
/**
* Boolean format for query string
*
* @var string
*/
protected $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT;
protected string $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT;
/**
* Username for HTTP basic authentication
*
* @var string
*/
protected $username = '';
protected string $username = '';
/**
* Password for HTTP basic authentication
*
* @var string
*/
protected $password = '';
protected string $password = '';
/**
* The host
*
* @var string
*/
protected $host = '{{basePath}}';
protected string $host = '{{basePath}}';
/**
* User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default
*
* @var string
*/
protected $userAgent = '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}{{^artifactVersion}}1.0.0{{/artifactVersion}}/PHP{{/httpUserAgent}}';
protected string $userAgent = '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}{{^artifactVersion}}1.0.0{{/artifactVersion}}/PHP{{/httpUserAgent}}';
/**
* Debug switch (default set to false)
*
* @var bool
*/
protected $debug = false;
protected bool $debug = false;
/**
* Debug file location (log to STDOUT by default)
*
* @var string
*/
protected $debugFile = 'php://output';
protected string $debugFile = 'php://output';
/**
* Debug file location (log to STDOUT by default)
*
* @var string
*/
protected $tempFolderPath;
protected string $tempFolderPath;
/**
* Constructor
@ -129,7 +131,7 @@ class Configuration
*
* @return $this
*/
public function setApiKey($apiKeyIdentifier, $key)
public function setApiKey(string $apiKeyIdentifier, string $key): static
{
$this->apiKeys[$apiKeyIdentifier] = $key;
return $this;
@ -142,9 +144,9 @@ class Configuration
*
* @return null|string API key or token
*/
public function getApiKey($apiKeyIdentifier)
public function getApiKey(string $apiKeyIdentifier): ?string
{
return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
return $this->apiKeys[$apiKeyIdentifier] ?? null;
}
/**
@ -155,7 +157,7 @@ class Configuration
*
* @return $this
*/
public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static
{
$this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix;
return $this;
@ -168,9 +170,9 @@ class Configuration
*
* @return null|string
*/
public function getApiKeyPrefix($apiKeyIdentifier)
public function getApiKeyPrefix(string $apiKeyIdentifier): ?string
{
return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null;
return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null;
}
/**
@ -180,7 +182,7 @@ class Configuration
*
* @return $this
*/
public function setAccessToken($accessToken)
public function setAccessToken(string $accessToken): static
{
$this->accessToken = $accessToken;
return $this;
@ -191,7 +193,7 @@ class Configuration
*
* @return string Access token for OAuth
*/
public function getAccessToken()
public function getAccessToken(): string
{
return $this->accessToken;
}
@ -199,11 +201,11 @@ class Configuration
/**
* Sets boolean format for query string.
*
* @param string $booleanFormatForQueryString Boolean format for query string
* @param string $booleanFormat Boolean format for query string
*
* @return $this
*/
public function setBooleanFormatForQueryString(string $booleanFormat)
public function setBooleanFormatForQueryString(string $booleanFormat): static
{
$this->booleanFormatForQueryString = $booleanFormat;
@ -227,7 +229,7 @@ class Configuration
*
* @return $this
*/
public function setUsername($username)
public function setUsername(string $username): static
{
$this->username = $username;
return $this;
@ -238,7 +240,7 @@ class Configuration
*
* @return string Username for HTTP basic authentication
*/
public function getUsername()
public function getUsername(): string
{
return $this->username;
}
@ -250,7 +252,7 @@ class Configuration
*
* @return $this
*/
public function setPassword($password)
public function setPassword(string $password): static
{
$this->password = $password;
return $this;
@ -261,7 +263,7 @@ class Configuration
*
* @return string Password for HTTP basic authentication
*/
public function getPassword()
public function getPassword(): string
{
return $this->password;
}
@ -273,7 +275,7 @@ class Configuration
*
* @return $this
*/
public function setHost($host)
public function setHost(string $host): static
{
$this->host = $host;
return $this;
@ -284,7 +286,7 @@ class Configuration
*
* @return string Host
*/
public function getHost()
public function getHost(): string
{
return $this->host;
}
@ -294,15 +296,11 @@ class Configuration
*
* @param string $userAgent the user agent of the api client
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return $this
*/
public function setUserAgent($userAgent)
public function setUserAgent(string $userAgent): static
{
if (!is_string($userAgent)) {
throw new \InvalidArgumentException('User-agent must be a string.');
}
$this->userAgent = $userAgent;
return $this;
}
@ -312,7 +310,7 @@ class Configuration
*
* @return string user agent
*/
public function getUserAgent()
public function getUserAgent(): string
{
return $this->userAgent;
}
@ -324,7 +322,7 @@ class Configuration
*
* @return $this
*/
public function setDebug($debug)
public function setDebug(bool $debug): static
{
$this->debug = $debug;
return $this;
@ -335,7 +333,7 @@ class Configuration
*
* @return bool
*/
public function getDebug()
public function getDebug(): bool
{
return $this->debug;
}
@ -347,7 +345,7 @@ class Configuration
*
* @return $this
*/
public function setDebugFile($debugFile)
public function setDebugFile(string $debugFile): static
{
$this->debugFile = $debugFile;
return $this;
@ -358,7 +356,7 @@ class Configuration
*
* @return string
*/
public function getDebugFile()
public function getDebugFile(): string
{
return $this->debugFile;
}
@ -370,7 +368,7 @@ class Configuration
*
* @return $this
*/
public function setTempFolderPath($tempFolderPath)
public function setTempFolderPath(string $tempFolderPath): static
{
$this->tempFolderPath = $tempFolderPath;
return $this;
@ -381,7 +379,7 @@ class Configuration
*
* @return string Temp folder path
*/
public function getTempFolderPath()
public function getTempFolderPath(): string
{
return $this->tempFolderPath;
}
@ -391,7 +389,7 @@ class Configuration
*
* @return Configuration
*/
public static function getDefaultConfiguration()
public static function getDefaultConfiguration(): Configuration
{
if (self::$defaultConfiguration === null) {
self::$defaultConfiguration = new Configuration();
@ -407,7 +405,7 @@ class Configuration
*
* @return void
*/
public static function setDefaultConfiguration(Configuration $config)
public static function setDefaultConfiguration(Configuration $config): void
{
self::$defaultConfiguration = $config;
}
@ -417,7 +415,7 @@ class Configuration
*
* @return string The report for debugging
*/
public static function toDebugReport()
public static function toDebugReport(): string
{
$report = 'PHP SDK ({{invokerPackage}}) Debug Report:' . PHP_EOL;
$report .= ' OS: ' . php_uname() . PHP_EOL;
@ -438,7 +436,7 @@ class Configuration
*
* @return null|string API key with the prefix
*/
public function getApiKeyWithPrefix($apiKeyIdentifier)
public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string
{
$prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
$apiKey = $this->getApiKey($apiKeyIdentifier);
@ -461,7 +459,7 @@ class Configuration
*
* @return array an array of host settings
*/
public function getHostSettings()
public function getHostSettings(): array
{
return [
{{#servers}}
@ -497,12 +495,12 @@ class Configuration
/**
* Returns URL based on host settings, index and variables
*
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param array $hostsSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param int $hostIndex index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null)
public static function getHostString(array $hostsSettings, int $hostIndex, array $variables = null): string
{
if (null === $variables) {
$variables = [];
@ -510,7 +508,7 @@ class Configuration
// check array index out of bound
if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) {
throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings));
throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings));
}
$host = $hostsSettings[$hostIndex];
@ -522,7 +520,7 @@ class Configuration
if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
$url = str_replace("{".$name."}", $variables[$name], $url);
} else {
throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"]).".");
throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"]).".");
}
} else {
// use default value
@ -540,7 +538,7 @@ class Configuration
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public function getHostFromSettings($index, $variables = null)
public function getHostFromSettings(int $index, ?array $variables = null): string
{
return self::getHostString($this->getHostSettings(), $index, $variables);
}

View File

@ -32,49 +32,49 @@ interface ModelInterface
*
* @return string
*/
public function getModelName();
public function getModelName(): string;
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes();
public static function openAPITypes(): array;
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats();
public static function openAPIFormats(): array;
/**
* Array of attributes where the key is the local name, and the value is the original name
*
* @return array
*/
public static function attributeMap();
public static function attributeMap(): array;
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters();
public static function setters(): array;
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters();
public static function getters(): array;
/**
* Show all the invalid properties with reasons.
*
* @return array
*/
public function listInvalidProperties();
public function listInvalidProperties(): array;
/**
* Validate all the properties in the model
@ -82,7 +82,7 @@ interface ModelInterface
*
* @return bool
*/
public function valid();
public function valid(): bool;
/**
* Checks if a property is nullable

View File

@ -19,6 +19,8 @@
namespace {{invokerPackage}};
use DateTimeInterface;
use DateTime;
use GuzzleHttp\Psr7\Utils;
use {{modelPackage}}\ModelInterface;
@ -33,14 +35,16 @@ use {{modelPackage}}\ModelInterface;
class ObjectSerializer
{
/** @var string */
private static $dateTimeFormat = \DateTime::ATOM;
private static string $dateTimeFormat = DateTimeInterface::ATOM;
/**
* Change the date format
*
* @param string $format the new date format to use
*
* @return void
*/
public static function setDateTimeFormat($format)
public static function setDateTimeFormat(string $format): void
{
self::$dateTimeFormat = $format;
}
@ -49,18 +53,18 @@ class ObjectSerializer
* Serialize data
*
* @param mixed $data the data to serialize
* @param string $type the OpenAPIToolsType of the data
* @param string $format the format of the OpenAPITools type of the data
* @param string|null $type the OpenAPIToolsType of the data
* @param string|null $format the format of the OpenAPITools type of the data
*
* @return scalar|object|array|null serialized form of $data
*/
public static function sanitizeForSerialization($data, $type = null, $format = null)
public static function sanitizeForSerialization(mixed $data, string $type = null, string $format = null): mixed
{
if (is_scalar($data) || null === $data) {
return $data;
}
if ($data instanceof \DateTime) {
if ($data instanceof DateTime) {
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat);
}
@ -110,7 +114,7 @@ class ObjectSerializer
*
* @return string the sanitized filename
*/
public static function sanitizeFilename($filename)
public static function sanitizeFilename(string $filename): string
{
if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) {
return $match[1];
@ -126,10 +130,8 @@ class ObjectSerializer
*
* @return string the shorten timestamp
*/
public static function sanitizeTimestamp($timestamp)
public static function sanitizeTimestamp(string $timestamp): string
{
if (!is_string($timestamp)) return $timestamp;
return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp);
}
@ -141,7 +143,7 @@ class ObjectSerializer
*
* @return string the serialized object
*/
public static function toPathValue($value)
public static function toPathValue(string $value): string
{
return rawurlencode(self::toString($value));
}
@ -154,7 +156,7 @@ class ObjectSerializer
*
* @return bool true if $value is empty
*/
private static function isEmptyValue($value, string $openApiType): bool
private static function isEmptyValue(mixed $value, string $openApiType): bool
{
# If empty() returns false, it is not empty regardless of its type.
if (!empty($value)) {
@ -166,27 +168,19 @@ class ObjectSerializer
return true;
}
switch ($openApiType) {
return match ($openApiType) {
# For numeric values, false and '' are considered empty.
# This comparison is safe for floating point values, since the previous call to empty() will
# filter out values that don't match 0.
case 'int':
case 'integer':
return $value !== 0;
case 'number':
case 'float':
return $value !== 0 && $value !== 0.0;
'int','integer' => $value !== 0,
'number'|'float' => $value !== 0 && $value !== 0.0,
# For boolean values, '' is considered empty
case 'bool':
case 'boolean':
return !in_array($value, [false, 0], true);
'bool','boolean' => !in_array($value, [false, 0], true),
# For all the other types, any value at this point can be considered empty.
default:
return true;
}
default => true
};
}
/**
@ -195,7 +189,7 @@ class ObjectSerializer
*
* @param mixed $value Parameter value
* @param string $paramName Parameter name
* @param string $openApiType OpenAPIType eg. array or object
* @param string $openApiType OpenAPIType e.g. array or object
* @param string $style Parameter serialization style
* @param bool $explode Parameter explode option
* @param bool $required Whether query param is required or not
@ -203,7 +197,7 @@ class ObjectSerializer
* @return array
*/
public static function toQueryValue(
$value,
mixed $value,
string $paramName,
string $openApiType = 'string',
string $style = 'form',
@ -224,7 +218,7 @@ class ObjectSerializer
}
# Handle DateTime objects in query
if($openApiType === "\\DateTime" && $value instanceof \DateTime) {
if($openApiType === "\DateTime" && $value instanceof DateTime) {
return ["{$paramName}" => $value->format(self::$dateTimeFormat)];
}
@ -237,7 +231,7 @@ class ObjectSerializer
if (!is_array($arr)) return $arr;
foreach ($arr as $k => $v) {
$prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k;
$prop = ($style === 'deepObject') ? "{$name}[{$k}]" : $k;
if (is_array($v)) {
$flattenArray($v, $prop, $result);
@ -275,7 +269,7 @@ class ObjectSerializer
*
* @return int|string Boolean value in format
*/
public static function convertBoolToQueryStringFormat(bool $value)
public static function convertBoolToQueryStringFormat(bool $value): int|string
{
if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) {
return $value ? 'true' : 'false';
@ -293,7 +287,7 @@ class ObjectSerializer
*
* @return string the header string
*/
public static function toHeaderValue($value)
public static function toHeaderValue(string $value): string
{
$callable = [$value, 'toHeaderValue'];
if (is_callable($callable)) {
@ -312,7 +306,7 @@ class ObjectSerializer
*
* @return string the form string
*/
public static function toFormValue($value)
public static function toFormValue(string|\SplFileObject $value): string
{
if ($value instanceof \SplFileObject) {
return $value->getRealPath();
@ -327,13 +321,13 @@ class ObjectSerializer
* If it's a datetime object, format it in ISO8601
* If it's a boolean, convert it to "true" or "false".
*
* @param string|bool|\DateTime $value the value of the parameter
* @param string|bool|DateTime $value the value of the parameter
*
* @return string the header string
*/
public static function toString($value)
public static function toString(string|bool|DateTime $value): string
{
if ($value instanceof \DateTime) { // datetime in ISO8601 format
if ($value instanceof DateTime) { // datetime in ISO8601 format
return $value->format(self::$dateTimeFormat);
} elseif (is_bool($value)) {
return $value ? 'true' : 'false';
@ -352,31 +346,19 @@ class ObjectSerializer
*
* @return string
*/
public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false)
public static function serializeCollection(array $collection, string $style, bool $allowCollectionFormatMulti = false): string
{
if ($allowCollectionFormatMulti && ('multi' === $style)) {
// http_build_query() almost does the job for us. We just
// need to fix the result of multidimensional arrays.
return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&'));
}
switch ($style) {
case 'pipeDelimited':
case 'pipes':
return implode('|', $collection);
case 'tsv':
return implode("\t", $collection);
case 'spaceDelimited':
case 'ssv':
return implode(' ', $collection);
case 'simple':
case 'csv':
// Deliberate fall through. CSV is default format.
default:
return implode(',', $collection);
}
return match ($style) {
'pipeDelimited', 'pipes' => implode('|', $collection),
'tsv' => implode("\t", $collection),
'spaceDelimited', 'ssv' => implode(' ', $collection),
default => implode(',', $collection),
};
}
/**
@ -384,12 +366,12 @@ class ObjectSerializer
*
* @param mixed $data object or primitive to be deserialized
* @param string $class class name is passed as a string
* @param string[] $httpHeaders HTTP headers
* @param string $discriminator discriminator if polymorphism is used
* @param string[]|null $httpHeaders HTTP headers
* @param string|null $discriminator discriminator if polymorphism is used
*
* @return object|array|null a single or an array of $class instances
*/
public static function deserialize($data, $class, $httpHeaders = null)
public static function deserialize(mixed $data, string $class, string $httpHeaders = null): object|array|null
{
if (null === $data) {
return null;
@ -433,7 +415,7 @@ class ObjectSerializer
return $data;
}
if ($class === '\DateTime') {
if ($class === 'DateTime') {
// Some APIs return an invalid, empty string as a
// date-time property. DateTime::__construct() will return
// the current time for empty input which is probably not
@ -442,12 +424,12 @@ class ObjectSerializer
// this graceful.
if (!empty($data)) {
try {
return new \DateTime($data);
return new DateTime($data);
} catch (\Exception $exception) {
// Some APIs return a date-time with too high nanosecond
// precision for php's DateTime to handle.
// With provided regexp 6 digits of microseconds saved
return new \DateTime(self::sanitizeTimestamp($data));
return new DateTime(self::sanitizeTimestamp($data));
}
} else {
return null;
@ -547,7 +529,7 @@ class ObjectSerializer
* @return string
*/
public static function buildQuery(
$data,
array|object $data,
string $numeric_prefix = '',
?string $arg_separator = null,
int $encoding_type = \PHP_QUERY_RFC3986

View File

@ -18,6 +18,7 @@
namespace {{apiPackage}};
use InvalidArgumentException;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
@ -25,6 +26,7 @@ use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\Promise\PromiseInterface;
use {{invokerPackage}}\ApiException;
use {{invokerPackage}}\Configuration;
use {{invokerPackage}}\HeaderSelector;
@ -43,22 +45,22 @@ use {{invokerPackage}}\ObjectSerializer;
/**
* @var ClientInterface
*/
protected $client;
protected ClientInterface $client;
/**
* @var Configuration
*/
protected $config;
protected Configuration $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
protected HeaderSelector $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
protected int $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [{{#operation}}
@ -69,17 +71,17 @@ use {{invokerPackage}}\ObjectSerializer;
{{/consumes}} ],{{/operation}}
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
/**
* @param ClientInterface|null $client
* @param Configuration|null $config
* @param HeaderSelector|null $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
int $hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
@ -92,7 +94,7 @@ use {{invokerPackage}}\ObjectSerializer;
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
public function setHostIndex(int $hostIndex): void
{
$this->hostIndex = $hostIndex;
}
@ -102,7 +104,7 @@ use {{invokerPackage}}\ObjectSerializer;
*
* @return int Host index
*/
public function getHostIndex()
public function getHostIndex(): int
{
return $this->hostIndex;
}
@ -110,7 +112,7 @@ use {{invokerPackage}}\ObjectSerializer;
/**
* @return Configuration
*/
public function getConfig()
public function getConfig(): Configuration
{
return $this->config;
}
@ -152,7 +154,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{/-last}}
{{/servers}}
{{#allParams}}
* @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
* @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
{{/allParams}}
{{#servers}}
{{#-first}}
@ -162,14 +164,30 @@ use {{invokerPackage}}\ObjectSerializer;
{{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
*
* @throws \{{invokerPackage}}\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}}
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
public function {{operationId}}(
{{^vendorExtensions.x-group-parameters}}
{{#allParams}}
{{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{/allParams}}
{{#servers}}
{{#-first}}
?int $hostIndex = null,
array $variables = [],
{{/-first}}
{{/servers}}
string $contentType = self::contentTypes['{{{operationId}}}'][0]
{{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}}
array $associative_array
{{/vendorExtensions.x-group-parameters}}
): {{vendorExtensions.x-php-return-type}}
{
{{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}}
return $response;{{/returnType}}
@ -211,7 +229,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{/-last}}
{{/servers}}
{{#allParams}}
* @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
* @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
{{/allParams}}
{{#servers}}
{{#-first}}
@ -221,14 +239,30 @@ use {{invokerPackage}}\ObjectSerializer;
{{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
*
* @throws \{{invokerPackage}}\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings)
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
public function {{operationId}}WithHttpInfo(
{{^vendorExtensions.x-group-parameters}}
{{#allParams}}
{{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{/allParams}}
{{#servers}}
{{#-first}}
?int $hostIndex = null,
array $variables = [],
{{/-first}}
{{/servers}}
string $contentType = self::contentTypes['{{{operationId}}}'][0]
{{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}}
array $associative_array
{{/vendorExtensions.x-group-parameters}}
): array
{
$request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});
@ -370,7 +404,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{/-last}}
{{/servers}}
{{#allParams}}
* @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
* @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
{{/allParams}}
{{#servers}}
{{#-first}}
@ -380,13 +414,29 @@ use {{invokerPackage}}\ObjectSerializer;
{{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
public function {{operationId}}Async(
{{^vendorExtensions.x-group-parameters}}
{{#allParams}}
{{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{/allParams}}
{{#servers}}
{{#-first}}
?int $hostIndex = null,
array $variables = [],
{{/-first}}
{{/servers}}
string $contentType = self::contentTypes['{{{operationId}}}'][0]
{{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}}
array $associative_array
{{/vendorExtensions.x-group-parameters}}
): PromiseInterface
{
return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
->then(
@ -432,7 +482,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{/-last}}
{{/servers}}
{{#allParams}}
* @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
* @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
{{/allParams}}
{{#servers}}
{{#-first}}
@ -442,13 +492,29 @@ use {{invokerPackage}}\ObjectSerializer;
{{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
public function {{operationId}}AsyncWithHttpInfo(
{{^vendorExtensions.x-group-parameters}}
{{#allParams}}
${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{/allParams}}
{{#servers}}
{{#-first}}
?int $hostIndex = null,
array $variables = [],
{{/-first}}
{{/servers}}
string $contentType = self::contentTypes['{{{operationId}}}'][0]
{{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}}
array $associative_array
{{/vendorExtensions.x-group-parameters}}
): PromiseInterface
{
$returnType = '{{{returnType}}}';
$request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});
@ -522,7 +588,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{/-last}}
{{/servers}}
{{#allParams}}
* @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
* @param {{{dataType}}}{{^required}}|null{{/required}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
{{/allParams}}
{{#servers}}
{{#-first}}
@ -532,13 +598,29 @@ use {{invokerPackage}}\ObjectSerializer;
{{/servers}}
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
public function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}})
public function {{operationId}}Request(
{{^vendorExtensions.x-group-parameters}}
{{#allParams}}
${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}},
{{/allParams}}
{{#servers}}
{{#-first}}
?int $hostIndex = null,
array $variables = [],
{{/-first}}
{{/servers}}
string $contentType = self::contentTypes['{{{operationId}}}'][0]
{{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}}
array $associative_array
{{/vendorExtensions.x-group-parameters}}
): Request
{
{{#vendorExtensions.x-group-parameters}}
// unbox the parameters from the associative array
@ -553,7 +635,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{#required}}
// verify the required parameter '{{paramName}}' is set
if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter ${{paramName}} when calling {{operationId}}'
);
}
@ -561,37 +643,37 @@ use {{invokerPackage}}\ObjectSerializer;
{{#hasValidation}}
{{#maxLength}}
if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) > {{maxLength}}) {
throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.');
throw new InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.');
}
{{/maxLength}}
{{#minLength}}
if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) < {{minLength}}) {
throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.');
throw new InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.');
}
{{/minLength}}
{{#maximum}}
if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) {
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.');
throw new InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.');
}
{{/maximum}}
{{#minimum}}
if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) {
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.');
throw new InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.');
}
{{/minimum}}
{{#pattern}}
if ({{^required}}${{paramName}} !== null && {{/required}}!preg_match("{{{pattern}}}", ${{paramName}})) {
throw new \InvalidArgumentException("invalid value for \"{{paramName}}\" when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.");
throw new InvalidArgumentException("invalid value for \"{{paramName}}\" when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.");
}
{{/pattern}}
{{#maxItems}}
if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) > {{maxItems}}) {
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.');
throw new InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.');
}
{{/maxItems}}
{{#minItems}}
if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) < {{minItems}}) {
throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.');
throw new InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.');
}
{{/minItems}}
{{/hasValidation}}{{/allParams}}
@ -756,7 +838,7 @@ use {{invokerPackage}}\ObjectSerializer;
$hostSettings = $this->getHostSettingsFor{{operationId}}();
if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) {
throw new \InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings));
}
$operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables);
{{/servers.0}}
@ -819,7 +901,7 @@ use {{invokerPackage}}\ObjectSerializer;
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
protected function createHttpClientOption(): array
{
$options = [];
if ($this->config->getDebug()) {

View File

@ -18,9 +18,9 @@
namespace {{invokerPackage}}\Test\Api;
use \{{invokerPackage}}\Configuration;
use \{{invokerPackage}}\ApiException;
use \{{invokerPackage}}\ObjectSerializer;
use {{invokerPackage}}\Configuration;
use {{invokerPackage}}\ApiException;
use {{invokerPackage}}\ObjectSerializer;
use PHPUnit\Framework\TestCase;
/**

View File

@ -23,10 +23,13 @@ namespace {{modelPackage}};
{{^isEnum}}
{{^parentSchema}}
use \ArrayAccess;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use {{invokerPackage}}\ObjectSerializer;
{{/parentSchema}}
{{/isEnum}}
use \{{invokerPackage}}\ObjectSerializer;
/**
* {{classname}} Class Doc Comment
@ -39,7 +42,7 @@ use \{{invokerPackage}}\ObjectSerializer;
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
{{^isEnum}}
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
{{/isEnum}}
*/
{{#isEnum}}{{>model_enum}}{{/isEnum}}{{^isEnum}}{{>model_generic}}{{/isEnum}}

View File

@ -1,4 +1,4 @@
class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^parentSchema}}implements ModelInterface, ArrayAccess, \JsonSerializable{{/parentSchema}}
class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^parentSchema}}implements ModelInterface, ArrayAccess, JsonSerializable{{/parentSchema}}
{
public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}};
@ -7,14 +7,14 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
*
* @var string
*/
protected static $openAPIModelName = '{{name}}';
protected static string $openAPIModelName = '{{name}}';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
{{#vars}}'{{name}}' => '{{{dataType}}}'{{^-last}},
{{/-last}}{{/vars}}
];
@ -22,11 +22,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
{{#vars}}'{{name}}' => {{#dataFormat}}'{{{.}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{^-last}},
{{/-last}}{{/vars}}
];
@ -34,7 +32,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
{{#vars}}'{{name}}' => {{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{^-last}},
@ -44,16 +42,16 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes{{#parentSchema}} + parent::openAPITypes(){{/parentSchema}};
}
@ -61,9 +59,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats{{#parentSchema}} + parent::openAPIFormats(){{/parentSchema}};
}
@ -71,7 +69,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -81,7 +79,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -91,7 +89,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -124,9 +122,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
{{#vars}}'{{name}}' => '{{baseName}}'{{^-last}},
{{/-last}}{{/vars}}
];
@ -134,9 +132,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
{{#vars}}'{{name}}' => '{{setter}}'{{^-last}},
{{/-last}}{{/vars}}
];
@ -144,9 +142,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
{{#vars}}'{{name}}' => '{{getter}}'{{^-last}},
{{/-last}}{{/vars}}
];
@ -155,9 +153,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap;
}
@ -165,9 +163,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters;
}
@ -175,9 +173,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters;
}
@ -187,7 +185,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -223,16 +221,15 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
{{/parentSchema}}
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -259,7 +256,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -271,9 +268,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
{{#parentSchema}}
$invalidProperties = parent::listInvalidProperties();
@ -355,7 +352,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -370,7 +367,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
* @deprecated
{{/deprecated}}
*/
public function {{getter}}()
public function {{getter}}(): {{^required}}?{{/required}}{{vendorExtensions.x-php-prop-type}}
{
return $this->container['{{name}}'];
}
@ -380,12 +377,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
*
* @param {{{dataType}}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{.}}}{{/description}}{{^description}} {{{name}}}{{/description}}
*
* @return self
* @return $this
{{#deprecated}}
* @deprecated
{{/deprecated}}
*/
public function {{setter}}(${{name}})
public function {{setter}}({{^required}}?{{/required}}{{vendorExtensions.x-php-prop-type}} ${{name}}): static
{
{{#isNullable}}
if (is_null(${{name}})) {
@ -401,14 +398,14 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
{{/isNullable}}
{{^isNullable}}
if (is_null(${{name}})) {
throw new \InvalidArgumentException('non-nullable {{name}} cannot be null');
throw new InvalidArgumentException('non-nullable {{name}} cannot be null');
}
{{/isNullable}}
{{#isEnum}}
$allowedValues = $this->{{getter}}AllowableValues();
{{^isContainer}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}!in_array(${{{name}}}, $allowedValues, true)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"Invalid value '%s' for '{{name}}', must be one of '%s'",
${{{name}}},
@ -419,7 +416,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
{{/isContainer}}
{{#isContainer}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}array_diff(${{{name}}}, $allowedValues)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"Invalid value for '{{name}}', must be one of '%s'",
implode("', '", $allowedValues)
@ -431,35 +428,35 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
{{#hasValidation}}
{{#maxLength}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(mb_strlen(${{name}}) > {{maxLength}})) {
throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.');
throw new InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.');
}{{/maxLength}}
{{#minLength}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(mb_strlen(${{name}}) < {{minLength}})) {
throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.');
throw new InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.');
}
{{/minLength}}
{{#maximum}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(${{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}})) {
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.');
throw new InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.');
}
{{/maximum}}
{{#minimum}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(${{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}})) {
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.');
throw new InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.');
}
{{/minimum}}
{{#pattern}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(!preg_match("{{{pattern}}}", ${{name}}))) {
throw new \InvalidArgumentException("invalid value for \${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.");
throw new InvalidArgumentException("invalid value for \${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.");
}
{{/pattern}}
{{#maxItems}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(count(${{name}}) > {{maxItems}})) {
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.');
throw new InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.');
}{{/maxItems}}
{{#minItems}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(count(${{name}}) < {{minItems}})) {
throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.');
throw new InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.');
}
{{/minItems}}
{{/hasValidation}}
@ -475,7 +472,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -487,8 +484,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -501,7 +498,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -517,7 +514,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -529,8 +526,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -540,7 +537,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -553,7 +550,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -27,6 +27,7 @@
namespace OpenAPI\Client\Api;
use InvalidArgumentException;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
@ -34,6 +35,7 @@ use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\Promise\PromiseInterface;
use OpenAPI\Client\ApiException;
use OpenAPI\Client\Configuration;
use OpenAPI\Client\HeaderSelector;
@ -52,22 +54,22 @@ class AnotherFakeApi
/**
* @var ClientInterface
*/
protected $client;
protected ClientInterface $client;
/**
* @var Configuration
*/
protected $config;
protected Configuration $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
protected HeaderSelector $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
protected int $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
@ -76,17 +78,17 @@ class AnotherFakeApi
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
/**
* @param ClientInterface|null $client
* @param Configuration|null $config
* @param HeaderSelector|null $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
int $hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
@ -99,7 +101,7 @@ class AnotherFakeApi
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
public function setHostIndex(int $hostIndex): void
{
$this->hostIndex = $hostIndex;
}
@ -109,7 +111,7 @@ class AnotherFakeApi
*
* @return int Host index
*/
public function getHostIndex()
public function getHostIndex(): int
{
return $this->hostIndex;
}
@ -117,7 +119,7 @@ class AnotherFakeApi
/**
* @return Configuration
*/
public function getConfig()
public function getConfig(): Configuration
{
return $this->config;
}
@ -130,11 +132,14 @@ class AnotherFakeApi
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return \OpenAPI\Client\Model\Client
*/
public function call123TestSpecialTags($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
public function call123TestSpecialTags(
\OpenAPI\Client\Model\Client $client,
string $contentType = self::contentTypes['call123TestSpecialTags'][0]
): \OpenAPI\Client\Model\Client
{
list($response) = $this->call123TestSpecialTagsWithHttpInfo($client, $contentType);
return $response;
@ -148,11 +153,14 @@ class AnotherFakeApi
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
*/
public function call123TestSpecialTagsWithHttpInfo($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
public function call123TestSpecialTagsWithHttpInfo(
\OpenAPI\Client\Model\Client $client,
string $contentType = self::contentTypes['call123TestSpecialTags'][0]
): array
{
$request = $this->call123TestSpecialTagsRequest($client, $contentType);
@ -248,10 +256,13 @@ class AnotherFakeApi
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function call123TestSpecialTagsAsync($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
public function call123TestSpecialTagsAsync(
\OpenAPI\Client\Model\Client $client,
string $contentType = self::contentTypes['call123TestSpecialTags'][0]
): PromiseInterface
{
return $this->call123TestSpecialTagsAsyncWithHttpInfo($client, $contentType)
->then(
@ -269,10 +280,13 @@ class AnotherFakeApi
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function call123TestSpecialTagsAsyncWithHttpInfo($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
public function call123TestSpecialTagsAsyncWithHttpInfo(
$client,
string $contentType = self::contentTypes['call123TestSpecialTags'][0]
): PromiseInterface
{
$returnType = '\OpenAPI\Client\Model\Client';
$request = $this->call123TestSpecialTagsRequest($client, $contentType);
@ -319,15 +333,18 @@ class AnotherFakeApi
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['call123TestSpecialTags'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function call123TestSpecialTagsRequest($client, string $contentType = self::contentTypes['call123TestSpecialTags'][0])
public function call123TestSpecialTagsRequest(
$client,
string $contentType = self::contentTypes['call123TestSpecialTags'][0]
): Request
{
// verify the required parameter 'client' is set
if ($client === null || (is_array($client) && count($client) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $client when calling call123TestSpecialTags'
);
}
@ -410,7 +427,7 @@ class AnotherFakeApi
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
protected function createHttpClientOption(): array
{
$options = [];
if ($this->config->getDebug()) {

View File

@ -27,6 +27,7 @@
namespace OpenAPI\Client\Api;
use InvalidArgumentException;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
@ -34,6 +35,7 @@ use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\Promise\PromiseInterface;
use OpenAPI\Client\ApiException;
use OpenAPI\Client\Configuration;
use OpenAPI\Client\HeaderSelector;
@ -52,22 +54,22 @@ class DefaultApi
/**
* @var ClientInterface
*/
protected $client;
protected ClientInterface $client;
/**
* @var Configuration
*/
protected $config;
protected Configuration $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
protected HeaderSelector $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
protected int $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
@ -76,17 +78,17 @@ class DefaultApi
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
/**
* @param ClientInterface|null $client
* @param Configuration|null $config
* @param HeaderSelector|null $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
int $hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
@ -99,7 +101,7 @@ class DefaultApi
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
public function setHostIndex(int $hostIndex): void
{
$this->hostIndex = $hostIndex;
}
@ -109,7 +111,7 @@ class DefaultApi
*
* @return int Host index
*/
public function getHostIndex()
public function getHostIndex(): int
{
return $this->hostIndex;
}
@ -117,7 +119,7 @@ class DefaultApi
/**
* @return Configuration
*/
public function getConfig()
public function getConfig(): Configuration
{
return $this->config;
}
@ -127,11 +129,13 @@ class DefaultApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return \OpenAPI\Client\Model\FooGetDefaultResponse
*/
public function fooGet(string $contentType = self::contentTypes['fooGet'][0])
public function fooGet(
string $contentType = self::contentTypes['fooGet'][0]
): \OpenAPI\Client\Model\FooGetDefaultResponse
{
list($response) = $this->fooGetWithHttpInfo($contentType);
return $response;
@ -142,11 +146,13 @@ class DefaultApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of \OpenAPI\Client\Model\FooGetDefaultResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function fooGetWithHttpInfo(string $contentType = self::contentTypes['fooGet'][0])
public function fooGetWithHttpInfo(
string $contentType = self::contentTypes['fooGet'][0]
): array
{
$request = $this->fooGetRequest($contentType);
@ -239,10 +245,12 @@ class DefaultApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function fooGetAsync(string $contentType = self::contentTypes['fooGet'][0])
public function fooGetAsync(
string $contentType = self::contentTypes['fooGet'][0]
): PromiseInterface
{
return $this->fooGetAsyncWithHttpInfo($contentType)
->then(
@ -257,10 +265,12 @@ class DefaultApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function fooGetAsyncWithHttpInfo(string $contentType = self::contentTypes['fooGet'][0])
public function fooGetAsyncWithHttpInfo(
string $contentType = self::contentTypes['fooGet'][0]
): PromiseInterface
{
$returnType = '\OpenAPI\Client\Model\FooGetDefaultResponse';
$request = $this->fooGetRequest($contentType);
@ -306,10 +316,12 @@ class DefaultApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['fooGet'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function fooGetRequest(string $contentType = self::contentTypes['fooGet'][0])
public function fooGetRequest(
string $contentType = self::contentTypes['fooGet'][0]
): Request
{
@ -383,7 +395,7 @@ class DefaultApi
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
protected function createHttpClientOption(): array
{
$options = [];
if ($this->config->getDebug()) {

View File

@ -27,6 +27,7 @@
namespace OpenAPI\Client\Api;
use InvalidArgumentException;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
@ -34,6 +35,7 @@ use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\Promise\PromiseInterface;
use OpenAPI\Client\ApiException;
use OpenAPI\Client\Configuration;
use OpenAPI\Client\HeaderSelector;
@ -52,22 +54,22 @@ class FakeClassnameTags123Api
/**
* @var ClientInterface
*/
protected $client;
protected ClientInterface $client;
/**
* @var Configuration
*/
protected $config;
protected Configuration $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
protected HeaderSelector $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
protected int $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
@ -76,17 +78,17 @@ class FakeClassnameTags123Api
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
/**
* @param ClientInterface|null $client
* @param Configuration|null $config
* @param HeaderSelector|null $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
int $hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
@ -99,7 +101,7 @@ class FakeClassnameTags123Api
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
public function setHostIndex(int $hostIndex): void
{
$this->hostIndex = $hostIndex;
}
@ -109,7 +111,7 @@ class FakeClassnameTags123Api
*
* @return int Host index
*/
public function getHostIndex()
public function getHostIndex(): int
{
return $this->hostIndex;
}
@ -117,7 +119,7 @@ class FakeClassnameTags123Api
/**
* @return Configuration
*/
public function getConfig()
public function getConfig(): Configuration
{
return $this->config;
}
@ -130,11 +132,14 @@ class FakeClassnameTags123Api
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return \OpenAPI\Client\Model\Client
*/
public function testClassname($client, string $contentType = self::contentTypes['testClassname'][0])
public function testClassname(
\OpenAPI\Client\Model\Client $client,
string $contentType = self::contentTypes['testClassname'][0]
): \OpenAPI\Client\Model\Client
{
list($response) = $this->testClassnameWithHttpInfo($client, $contentType);
return $response;
@ -148,11 +153,14 @@ class FakeClassnameTags123Api
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Client, HTTP status code, HTTP response headers (array of strings)
*/
public function testClassnameWithHttpInfo($client, string $contentType = self::contentTypes['testClassname'][0])
public function testClassnameWithHttpInfo(
\OpenAPI\Client\Model\Client $client,
string $contentType = self::contentTypes['testClassname'][0]
): array
{
$request = $this->testClassnameRequest($client, $contentType);
@ -248,10 +256,13 @@ class FakeClassnameTags123Api
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function testClassnameAsync($client, string $contentType = self::contentTypes['testClassname'][0])
public function testClassnameAsync(
\OpenAPI\Client\Model\Client $client,
string $contentType = self::contentTypes['testClassname'][0]
): PromiseInterface
{
return $this->testClassnameAsyncWithHttpInfo($client, $contentType)
->then(
@ -269,10 +280,13 @@ class FakeClassnameTags123Api
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function testClassnameAsyncWithHttpInfo($client, string $contentType = self::contentTypes['testClassname'][0])
public function testClassnameAsyncWithHttpInfo(
$client,
string $contentType = self::contentTypes['testClassname'][0]
): PromiseInterface
{
$returnType = '\OpenAPI\Client\Model\Client';
$request = $this->testClassnameRequest($client, $contentType);
@ -319,15 +333,18 @@ class FakeClassnameTags123Api
* @param \OpenAPI\Client\Model\Client $client client model (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testClassname'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function testClassnameRequest($client, string $contentType = self::contentTypes['testClassname'][0])
public function testClassnameRequest(
$client,
string $contentType = self::contentTypes['testClassname'][0]
): Request
{
// verify the required parameter 'client' is set
if ($client === null || (is_array($client) && count($client) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $client when calling testClassname'
);
}
@ -415,7 +432,7 @@ class FakeClassnameTags123Api
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
protected function createHttpClientOption(): array
{
$options = [];
if ($this->config->getDebug()) {

View File

@ -27,6 +27,7 @@
namespace OpenAPI\Client\Api;
use InvalidArgumentException;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
@ -34,6 +35,7 @@ use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\Promise\PromiseInterface;
use OpenAPI\Client\ApiException;
use OpenAPI\Client\Configuration;
use OpenAPI\Client\HeaderSelector;
@ -52,22 +54,22 @@ class StoreApi
/**
* @var ClientInterface
*/
protected $client;
protected ClientInterface $client;
/**
* @var Configuration
*/
protected $config;
protected Configuration $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
protected HeaderSelector $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
protected int $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
@ -85,17 +87,17 @@ class StoreApi
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
/**
* @param ClientInterface|null $client
* @param Configuration|null $config
* @param HeaderSelector|null $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
int $hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
@ -108,7 +110,7 @@ class StoreApi
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
public function setHostIndex(int $hostIndex): void
{
$this->hostIndex = $hostIndex;
}
@ -118,7 +120,7 @@ class StoreApi
*
* @return int Host index
*/
public function getHostIndex()
public function getHostIndex(): int
{
return $this->hostIndex;
}
@ -126,7 +128,7 @@ class StoreApi
/**
* @return Configuration
*/
public function getConfig()
public function getConfig(): Configuration
{
return $this->config;
}
@ -139,11 +141,14 @@ class StoreApi
* @param string $order_id ID of the order that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return void
*/
public function deleteOrder($order_id, string $contentType = self::contentTypes['deleteOrder'][0])
public function deleteOrder(
string $order_id,
string $contentType = self::contentTypes['deleteOrder'][0]
): void
{
$this->deleteOrderWithHttpInfo($order_id, $contentType);
}
@ -156,11 +161,14 @@ class StoreApi
* @param string $order_id ID of the order that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteOrderWithHttpInfo($order_id, string $contentType = self::contentTypes['deleteOrder'][0])
public function deleteOrderWithHttpInfo(
string $order_id,
string $contentType = self::contentTypes['deleteOrder'][0]
): array
{
$request = $this->deleteOrderRequest($order_id, $contentType);
@ -216,10 +224,13 @@ class StoreApi
* @param string $order_id ID of the order that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function deleteOrderAsync($order_id, string $contentType = self::contentTypes['deleteOrder'][0])
public function deleteOrderAsync(
string $order_id,
string $contentType = self::contentTypes['deleteOrder'][0]
): PromiseInterface
{
return $this->deleteOrderAsyncWithHttpInfo($order_id, $contentType)
->then(
@ -237,10 +248,13 @@ class StoreApi
* @param string $order_id ID of the order that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function deleteOrderAsyncWithHttpInfo($order_id, string $contentType = self::contentTypes['deleteOrder'][0])
public function deleteOrderAsyncWithHttpInfo(
$order_id,
string $contentType = self::contentTypes['deleteOrder'][0]
): PromiseInterface
{
$returnType = '';
$request = $this->deleteOrderRequest($order_id, $contentType);
@ -274,15 +288,18 @@ class StoreApi
* @param string $order_id ID of the order that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteOrderRequest($order_id, string $contentType = self::contentTypes['deleteOrder'][0])
public function deleteOrderRequest(
$order_id,
string $contentType = self::contentTypes['deleteOrder'][0]
): Request
{
// verify the required parameter 'order_id' is set
if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $order_id when calling deleteOrder'
);
}
@ -367,11 +384,13 @@ class StoreApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array<string,int>
*/
public function getInventory(string $contentType = self::contentTypes['getInventory'][0])
public function getInventory(
string $contentType = self::contentTypes['getInventory'][0]
): array&lt;string,int&gt;
{
list($response) = $this->getInventoryWithHttpInfo($contentType);
return $response;
@ -384,11 +403,13 @@ class StoreApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of array<string,int>, HTTP status code, HTTP response headers (array of strings)
*/
public function getInventoryWithHttpInfo(string $contentType = self::contentTypes['getInventory'][0])
public function getInventoryWithHttpInfo(
string $contentType = self::contentTypes['getInventory'][0]
): array
{
$request = $this->getInventoryRequest($contentType);
@ -483,10 +504,12 @@ class StoreApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function getInventoryAsync(string $contentType = self::contentTypes['getInventory'][0])
public function getInventoryAsync(
string $contentType = self::contentTypes['getInventory'][0]
): PromiseInterface
{
return $this->getInventoryAsyncWithHttpInfo($contentType)
->then(
@ -503,10 +526,12 @@ class StoreApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function getInventoryAsyncWithHttpInfo(string $contentType = self::contentTypes['getInventory'][0])
public function getInventoryAsyncWithHttpInfo(
string $contentType = self::contentTypes['getInventory'][0]
): PromiseInterface
{
$returnType = 'array<string,int>';
$request = $this->getInventoryRequest($contentType);
@ -552,10 +577,12 @@ class StoreApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInventory'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getInventoryRequest(string $contentType = self::contentTypes['getInventory'][0])
public function getInventoryRequest(
string $contentType = self::contentTypes['getInventory'][0]
): Request
{
@ -636,11 +663,14 @@ class StoreApi
* @param int $order_id ID of pet that needs to be fetched (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return \OpenAPI\Client\Model\Order
*/
public function getOrderById($order_id, string $contentType = self::contentTypes['getOrderById'][0])
public function getOrderById(
int $order_id,
string $contentType = self::contentTypes['getOrderById'][0]
): \OpenAPI\Client\Model\Order
{
list($response) = $this->getOrderByIdWithHttpInfo($order_id, $contentType);
return $response;
@ -654,11 +684,14 @@ class StoreApi
* @param int $order_id ID of pet that needs to be fetched (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings)
*/
public function getOrderByIdWithHttpInfo($order_id, string $contentType = self::contentTypes['getOrderById'][0])
public function getOrderByIdWithHttpInfo(
int $order_id,
string $contentType = self::contentTypes['getOrderById'][0]
): array
{
$request = $this->getOrderByIdRequest($order_id, $contentType);
@ -754,10 +787,13 @@ class StoreApi
* @param int $order_id ID of pet that needs to be fetched (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function getOrderByIdAsync($order_id, string $contentType = self::contentTypes['getOrderById'][0])
public function getOrderByIdAsync(
int $order_id,
string $contentType = self::contentTypes['getOrderById'][0]
): PromiseInterface
{
return $this->getOrderByIdAsyncWithHttpInfo($order_id, $contentType)
->then(
@ -775,10 +811,13 @@ class StoreApi
* @param int $order_id ID of pet that needs to be fetched (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function getOrderByIdAsyncWithHttpInfo($order_id, string $contentType = self::contentTypes['getOrderById'][0])
public function getOrderByIdAsyncWithHttpInfo(
$order_id,
string $contentType = self::contentTypes['getOrderById'][0]
): PromiseInterface
{
$returnType = '\OpenAPI\Client\Model\Order';
$request = $this->getOrderByIdRequest($order_id, $contentType);
@ -825,23 +864,26 @@ class StoreApi
* @param int $order_id ID of pet that needs to be fetched (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderById'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getOrderByIdRequest($order_id, string $contentType = self::contentTypes['getOrderById'][0])
public function getOrderByIdRequest(
$order_id,
string $contentType = self::contentTypes['getOrderById'][0]
): Request
{
// verify the required parameter 'order_id' is set
if ($order_id === null || (is_array($order_id) && count($order_id) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $order_id when calling getOrderById'
);
}
if ($order_id > 5) {
throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be smaller than or equal to 5.');
throw new InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be smaller than or equal to 5.');
}
if ($order_id < 1) {
throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.');
throw new InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.');
}
@ -925,11 +967,14 @@ class StoreApi
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return \OpenAPI\Client\Model\Order
*/
public function placeOrder($order, string $contentType = self::contentTypes['placeOrder'][0])
public function placeOrder(
\OpenAPI\Client\Model\Order $order,
string $contentType = self::contentTypes['placeOrder'][0]
): \OpenAPI\Client\Model\Order
{
list($response) = $this->placeOrderWithHttpInfo($order, $contentType);
return $response;
@ -943,11 +988,14 @@ class StoreApi
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of \OpenAPI\Client\Model\Order, HTTP status code, HTTP response headers (array of strings)
*/
public function placeOrderWithHttpInfo($order, string $contentType = self::contentTypes['placeOrder'][0])
public function placeOrderWithHttpInfo(
\OpenAPI\Client\Model\Order $order,
string $contentType = self::contentTypes['placeOrder'][0]
): array
{
$request = $this->placeOrderRequest($order, $contentType);
@ -1043,10 +1091,13 @@ class StoreApi
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function placeOrderAsync($order, string $contentType = self::contentTypes['placeOrder'][0])
public function placeOrderAsync(
\OpenAPI\Client\Model\Order $order,
string $contentType = self::contentTypes['placeOrder'][0]
): PromiseInterface
{
return $this->placeOrderAsyncWithHttpInfo($order, $contentType)
->then(
@ -1064,10 +1115,13 @@ class StoreApi
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function placeOrderAsyncWithHttpInfo($order, string $contentType = self::contentTypes['placeOrder'][0])
public function placeOrderAsyncWithHttpInfo(
$order,
string $contentType = self::contentTypes['placeOrder'][0]
): PromiseInterface
{
$returnType = '\OpenAPI\Client\Model\Order';
$request = $this->placeOrderRequest($order, $contentType);
@ -1114,15 +1168,18 @@ class StoreApi
* @param \OpenAPI\Client\Model\Order $order order placed for purchasing the pet (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function placeOrderRequest($order, string $contentType = self::contentTypes['placeOrder'][0])
public function placeOrderRequest(
$order,
string $contentType = self::contentTypes['placeOrder'][0]
): Request
{
// verify the required parameter 'order' is set
if ($order === null || (is_array($order) && count($order) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $order when calling placeOrder'
);
}
@ -1205,7 +1262,7 @@ class StoreApi
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
protected function createHttpClientOption(): array
{
$options = [];
if ($this->config->getDebug()) {

View File

@ -27,6 +27,7 @@
namespace OpenAPI\Client\Api;
use InvalidArgumentException;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ConnectException;
@ -34,6 +35,7 @@ use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\Promise\PromiseInterface;
use OpenAPI\Client\ApiException;
use OpenAPI\Client\Configuration;
use OpenAPI\Client\HeaderSelector;
@ -52,22 +54,22 @@ class UserApi
/**
* @var ClientInterface
*/
protected $client;
protected ClientInterface $client;
/**
* @var Configuration
*/
protected $config;
protected Configuration $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
protected HeaderSelector $headerSelector;
/**
* @var int Host index
*/
protected $hostIndex;
protected int $hostIndex;
/** @var string[] $contentTypes **/
public const contentTypes = [
@ -97,17 +99,17 @@ class UserApi
],
];
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
/**
* @param ClientInterface|null $client
* @param Configuration|null $config
* @param HeaderSelector|null $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
int $hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
@ -120,7 +122,7 @@ class UserApi
*
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($hostIndex): void
public function setHostIndex(int $hostIndex): void
{
$this->hostIndex = $hostIndex;
}
@ -130,7 +132,7 @@ class UserApi
*
* @return int Host index
*/
public function getHostIndex()
public function getHostIndex(): int
{
return $this->hostIndex;
}
@ -138,7 +140,7 @@ class UserApi
/**
* @return Configuration
*/
public function getConfig()
public function getConfig(): Configuration
{
return $this->config;
}
@ -151,11 +153,14 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Created user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUser'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return void
*/
public function createUser($user, string $contentType = self::contentTypes['createUser'][0])
public function createUser(
\OpenAPI\Client\Model\User $user,
string $contentType = self::contentTypes['createUser'][0]
): void
{
$this->createUserWithHttpInfo($user, $contentType);
}
@ -168,11 +173,14 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Created user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUser'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function createUserWithHttpInfo($user, string $contentType = self::contentTypes['createUser'][0])
public function createUserWithHttpInfo(
\OpenAPI\Client\Model\User $user,
string $contentType = self::contentTypes['createUser'][0]
): array
{
$request = $this->createUserRequest($user, $contentType);
@ -228,10 +236,13 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Created user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function createUserAsync($user, string $contentType = self::contentTypes['createUser'][0])
public function createUserAsync(
\OpenAPI\Client\Model\User $user,
string $contentType = self::contentTypes['createUser'][0]
): PromiseInterface
{
return $this->createUserAsyncWithHttpInfo($user, $contentType)
->then(
@ -249,10 +260,13 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Created user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function createUserAsyncWithHttpInfo($user, string $contentType = self::contentTypes['createUser'][0])
public function createUserAsyncWithHttpInfo(
$user,
string $contentType = self::contentTypes['createUser'][0]
): PromiseInterface
{
$returnType = '';
$request = $this->createUserRequest($user, $contentType);
@ -286,15 +300,18 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Created user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createUserRequest($user, string $contentType = self::contentTypes['createUser'][0])
public function createUserRequest(
$user,
string $contentType = self::contentTypes['createUser'][0]
): Request
{
// verify the required parameter 'user' is set
if ($user === null || (is_array($user) && count($user) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $user when calling createUser'
);
}
@ -379,11 +396,14 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithArrayInput'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return void
*/
public function createUsersWithArrayInput($user, string $contentType = self::contentTypes['createUsersWithArrayInput'][0])
public function createUsersWithArrayInput(
array $user,
string $contentType = self::contentTypes['createUsersWithArrayInput'][0]
): void
{
$this->createUsersWithArrayInputWithHttpInfo($user, $contentType);
}
@ -396,11 +416,14 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithArrayInput'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function createUsersWithArrayInputWithHttpInfo($user, string $contentType = self::contentTypes['createUsersWithArrayInput'][0])
public function createUsersWithArrayInputWithHttpInfo(
array $user,
string $contentType = self::contentTypes['createUsersWithArrayInput'][0]
): array
{
$request = $this->createUsersWithArrayInputRequest($user, $contentType);
@ -456,10 +479,13 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithArrayInput'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function createUsersWithArrayInputAsync($user, string $contentType = self::contentTypes['createUsersWithArrayInput'][0])
public function createUsersWithArrayInputAsync(
array $user,
string $contentType = self::contentTypes['createUsersWithArrayInput'][0]
): PromiseInterface
{
return $this->createUsersWithArrayInputAsyncWithHttpInfo($user, $contentType)
->then(
@ -477,10 +503,13 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithArrayInput'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function createUsersWithArrayInputAsyncWithHttpInfo($user, string $contentType = self::contentTypes['createUsersWithArrayInput'][0])
public function createUsersWithArrayInputAsyncWithHttpInfo(
$user,
string $contentType = self::contentTypes['createUsersWithArrayInput'][0]
): PromiseInterface
{
$returnType = '';
$request = $this->createUsersWithArrayInputRequest($user, $contentType);
@ -514,15 +543,18 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithArrayInput'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createUsersWithArrayInputRequest($user, string $contentType = self::contentTypes['createUsersWithArrayInput'][0])
public function createUsersWithArrayInputRequest(
$user,
string $contentType = self::contentTypes['createUsersWithArrayInput'][0]
): Request
{
// verify the required parameter 'user' is set
if ($user === null || (is_array($user) && count($user) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $user when calling createUsersWithArrayInput'
);
}
@ -607,11 +639,14 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithListInput'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return void
*/
public function createUsersWithListInput($user, string $contentType = self::contentTypes['createUsersWithListInput'][0])
public function createUsersWithListInput(
array $user,
string $contentType = self::contentTypes['createUsersWithListInput'][0]
): void
{
$this->createUsersWithListInputWithHttpInfo($user, $contentType);
}
@ -624,11 +659,14 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithListInput'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function createUsersWithListInputWithHttpInfo($user, string $contentType = self::contentTypes['createUsersWithListInput'][0])
public function createUsersWithListInputWithHttpInfo(
array $user,
string $contentType = self::contentTypes['createUsersWithListInput'][0]
): array
{
$request = $this->createUsersWithListInputRequest($user, $contentType);
@ -684,10 +722,13 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithListInput'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function createUsersWithListInputAsync($user, string $contentType = self::contentTypes['createUsersWithListInput'][0])
public function createUsersWithListInputAsync(
array $user,
string $contentType = self::contentTypes['createUsersWithListInput'][0]
): PromiseInterface
{
return $this->createUsersWithListInputAsyncWithHttpInfo($user, $contentType)
->then(
@ -705,10 +746,13 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithListInput'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function createUsersWithListInputAsyncWithHttpInfo($user, string $contentType = self::contentTypes['createUsersWithListInput'][0])
public function createUsersWithListInputAsyncWithHttpInfo(
$user,
string $contentType = self::contentTypes['createUsersWithListInput'][0]
): PromiseInterface
{
$returnType = '';
$request = $this->createUsersWithListInputRequest($user, $contentType);
@ -742,15 +786,18 @@ class UserApi
* @param \OpenAPI\Client\Model\User[] $user List of user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createUsersWithListInput'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function createUsersWithListInputRequest($user, string $contentType = self::contentTypes['createUsersWithListInput'][0])
public function createUsersWithListInputRequest(
$user,
string $contentType = self::contentTypes['createUsersWithListInput'][0]
): Request
{
// verify the required parameter 'user' is set
if ($user === null || (is_array($user) && count($user) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $user when calling createUsersWithListInput'
);
}
@ -835,11 +882,14 @@ class UserApi
* @param string $username The name that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteUser'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return void
*/
public function deleteUser($username, string $contentType = self::contentTypes['deleteUser'][0])
public function deleteUser(
string $username,
string $contentType = self::contentTypes['deleteUser'][0]
): void
{
$this->deleteUserWithHttpInfo($username, $contentType);
}
@ -852,11 +902,14 @@ class UserApi
* @param string $username The name that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteUser'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteUserWithHttpInfo($username, string $contentType = self::contentTypes['deleteUser'][0])
public function deleteUserWithHttpInfo(
string $username,
string $contentType = self::contentTypes['deleteUser'][0]
): array
{
$request = $this->deleteUserRequest($username, $contentType);
@ -912,10 +965,13 @@ class UserApi
* @param string $username The name that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function deleteUserAsync($username, string $contentType = self::contentTypes['deleteUser'][0])
public function deleteUserAsync(
string $username,
string $contentType = self::contentTypes['deleteUser'][0]
): PromiseInterface
{
return $this->deleteUserAsyncWithHttpInfo($username, $contentType)
->then(
@ -933,10 +989,13 @@ class UserApi
* @param string $username The name that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function deleteUserAsyncWithHttpInfo($username, string $contentType = self::contentTypes['deleteUser'][0])
public function deleteUserAsyncWithHttpInfo(
$username,
string $contentType = self::contentTypes['deleteUser'][0]
): PromiseInterface
{
$returnType = '';
$request = $this->deleteUserRequest($username, $contentType);
@ -970,15 +1029,18 @@ class UserApi
* @param string $username The name that needs to be deleted (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function deleteUserRequest($username, string $contentType = self::contentTypes['deleteUser'][0])
public function deleteUserRequest(
$username,
string $contentType = self::contentTypes['deleteUser'][0]
): Request
{
// verify the required parameter 'username' is set
if ($username === null || (is_array($username) && count($username) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $username when calling deleteUser'
);
}
@ -1064,11 +1126,14 @@ class UserApi
* @param string $username The name that needs to be fetched. Use user1 for testing. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserByName'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return \OpenAPI\Client\Model\User
*/
public function getUserByName($username, string $contentType = self::contentTypes['getUserByName'][0])
public function getUserByName(
string $username,
string $contentType = self::contentTypes['getUserByName'][0]
): \OpenAPI\Client\Model\User
{
list($response) = $this->getUserByNameWithHttpInfo($username, $contentType);
return $response;
@ -1082,11 +1147,14 @@ class UserApi
* @param string $username The name that needs to be fetched. Use user1 for testing. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserByName'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of \OpenAPI\Client\Model\User, HTTP status code, HTTP response headers (array of strings)
*/
public function getUserByNameWithHttpInfo($username, string $contentType = self::contentTypes['getUserByName'][0])
public function getUserByNameWithHttpInfo(
string $username,
string $contentType = self::contentTypes['getUserByName'][0]
): array
{
$request = $this->getUserByNameRequest($username, $contentType);
@ -1182,10 +1250,13 @@ class UserApi
* @param string $username The name that needs to be fetched. Use user1 for testing. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserByName'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function getUserByNameAsync($username, string $contentType = self::contentTypes['getUserByName'][0])
public function getUserByNameAsync(
string $username,
string $contentType = self::contentTypes['getUserByName'][0]
): PromiseInterface
{
return $this->getUserByNameAsyncWithHttpInfo($username, $contentType)
->then(
@ -1203,10 +1274,13 @@ class UserApi
* @param string $username The name that needs to be fetched. Use user1 for testing. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserByName'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function getUserByNameAsyncWithHttpInfo($username, string $contentType = self::contentTypes['getUserByName'][0])
public function getUserByNameAsyncWithHttpInfo(
$username,
string $contentType = self::contentTypes['getUserByName'][0]
): PromiseInterface
{
$returnType = '\OpenAPI\Client\Model\User';
$request = $this->getUserByNameRequest($username, $contentType);
@ -1253,15 +1327,18 @@ class UserApi
* @param string $username The name that needs to be fetched. Use user1 for testing. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserByName'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getUserByNameRequest($username, string $contentType = self::contentTypes['getUserByName'][0])
public function getUserByNameRequest(
$username,
string $contentType = self::contentTypes['getUserByName'][0]
): Request
{
// verify the required parameter 'username' is set
if ($username === null || (is_array($username) && count($username) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $username when calling getUserByName'
);
}
@ -1348,11 +1425,15 @@ class UserApi
* @param string $password The password for login in clear text (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['loginUser'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return string
*/
public function loginUser($username, $password, string $contentType = self::contentTypes['loginUser'][0])
public function loginUser(
string $username,
string $password,
string $contentType = self::contentTypes['loginUser'][0]
): string
{
list($response) = $this->loginUserWithHttpInfo($username, $password, $contentType);
return $response;
@ -1367,11 +1448,15 @@ class UserApi
* @param string $password The password for login in clear text (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['loginUser'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of string, HTTP status code, HTTP response headers (array of strings)
*/
public function loginUserWithHttpInfo($username, $password, string $contentType = self::contentTypes['loginUser'][0])
public function loginUserWithHttpInfo(
string $username,
string $password,
string $contentType = self::contentTypes['loginUser'][0]
): array
{
$request = $this->loginUserRequest($username, $password, $contentType);
@ -1468,10 +1553,14 @@ class UserApi
* @param string $password The password for login in clear text (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['loginUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function loginUserAsync($username, $password, string $contentType = self::contentTypes['loginUser'][0])
public function loginUserAsync(
string $username,
string $password,
string $contentType = self::contentTypes['loginUser'][0]
): PromiseInterface
{
return $this->loginUserAsyncWithHttpInfo($username, $password, $contentType)
->then(
@ -1490,10 +1579,14 @@ class UserApi
* @param string $password The password for login in clear text (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['loginUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function loginUserAsyncWithHttpInfo($username, $password, string $contentType = self::contentTypes['loginUser'][0])
public function loginUserAsyncWithHttpInfo(
$username,
$password,
string $contentType = self::contentTypes['loginUser'][0]
): PromiseInterface
{
$returnType = 'string';
$request = $this->loginUserRequest($username, $password, $contentType);
@ -1541,22 +1634,26 @@ class UserApi
* @param string $password The password for login in clear text (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['loginUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function loginUserRequest($username, $password, string $contentType = self::contentTypes['loginUser'][0])
public function loginUserRequest(
$username,
$password,
string $contentType = self::contentTypes['loginUser'][0]
): Request
{
// verify the required parameter 'username' is set
if ($username === null || (is_array($username) && count($username) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $username when calling loginUser'
);
}
// verify the required parameter 'password' is set
if ($password === null || (is_array($password) && count($password) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $password when calling loginUser'
);
}
@ -1651,11 +1748,13 @@ class UserApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['logoutUser'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return void
*/
public function logoutUser(string $contentType = self::contentTypes['logoutUser'][0])
public function logoutUser(
string $contentType = self::contentTypes['logoutUser'][0]
): void
{
$this->logoutUserWithHttpInfo($contentType);
}
@ -1667,11 +1766,13 @@ class UserApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['logoutUser'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function logoutUserWithHttpInfo(string $contentType = self::contentTypes['logoutUser'][0])
public function logoutUserWithHttpInfo(
string $contentType = self::contentTypes['logoutUser'][0]
): array
{
$request = $this->logoutUserRequest($contentType);
@ -1726,10 +1827,12 @@ class UserApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['logoutUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function logoutUserAsync(string $contentType = self::contentTypes['logoutUser'][0])
public function logoutUserAsync(
string $contentType = self::contentTypes['logoutUser'][0]
): PromiseInterface
{
return $this->logoutUserAsyncWithHttpInfo($contentType)
->then(
@ -1746,10 +1849,12 @@ class UserApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['logoutUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function logoutUserAsyncWithHttpInfo(string $contentType = self::contentTypes['logoutUser'][0])
public function logoutUserAsyncWithHttpInfo(
string $contentType = self::contentTypes['logoutUser'][0]
): PromiseInterface
{
$returnType = '';
$request = $this->logoutUserRequest($contentType);
@ -1782,10 +1887,12 @@ class UserApi
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['logoutUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function logoutUserRequest(string $contentType = self::contentTypes['logoutUser'][0])
public function logoutUserRequest(
string $contentType = self::contentTypes['logoutUser'][0]
): Request
{
@ -1862,11 +1969,15 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Updated user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUser'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return void
*/
public function updateUser($username, $user, string $contentType = self::contentTypes['updateUser'][0])
public function updateUser(
string $username,
\OpenAPI\Client\Model\User $user,
string $contentType = self::contentTypes['updateUser'][0]
): void
{
$this->updateUserWithHttpInfo($username, $user, $contentType);
}
@ -1880,11 +1991,15 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Updated user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUser'] to see the possible values for this operation
*
* @throws \OpenAPI\Client\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function updateUserWithHttpInfo($username, $user, string $contentType = self::contentTypes['updateUser'][0])
public function updateUserWithHttpInfo(
string $username,
\OpenAPI\Client\Model\User $user,
string $contentType = self::contentTypes['updateUser'][0]
): array
{
$request = $this->updateUserRequest($username, $user, $contentType);
@ -1941,10 +2056,14 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Updated user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function updateUserAsync($username, $user, string $contentType = self::contentTypes['updateUser'][0])
public function updateUserAsync(
string $username,
\OpenAPI\Client\Model\User $user,
string $contentType = self::contentTypes['updateUser'][0]
): PromiseInterface
{
return $this->updateUserAsyncWithHttpInfo($username, $user, $contentType)
->then(
@ -1963,10 +2082,14 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Updated user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
* @throws InvalidArgumentException
* @return PromiseInterface
*/
public function updateUserAsyncWithHttpInfo($username, $user, string $contentType = self::contentTypes['updateUser'][0])
public function updateUserAsyncWithHttpInfo(
$username,
$user,
string $contentType = self::contentTypes['updateUser'][0]
): PromiseInterface
{
$returnType = '';
$request = $this->updateUserRequest($username, $user, $contentType);
@ -2001,22 +2124,26 @@ class UserApi
* @param \OpenAPI\Client\Model\User $user Updated user object (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateUser'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function updateUserRequest($username, $user, string $contentType = self::contentTypes['updateUser'][0])
public function updateUserRequest(
$username,
$user,
string $contentType = self::contentTypes['updateUser'][0]
): Request
{
// verify the required parameter 'username' is set
if ($username === null || (is_array($username) && count($username) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $username when calling updateUser'
);
}
// verify the required parameter 'user' is set
if ($user === null || (is_array($user) && count($user) === 0)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
'Missing the required parameter $user when calling updateUser'
);
}
@ -2107,7 +2234,7 @@ class UserApi
* @throws \RuntimeException on file opening failure
* @return array of http client options
*/
protected function createHttpClientOption()
protected function createHttpClientOption(): array
{
$options = [];
if ($this->config->getDebug()) {

View File

@ -27,7 +27,8 @@
namespace OpenAPI\Client;
use \Exception;
use Exception;
use stdClass;
/**
* ApiException Class Doc Comment
@ -42,23 +43,23 @@ class ApiException extends Exception
/**
* The HTTP body of the server response either as Json or string.
*
* @var \stdClass|string|null
* @var stdClass|string|null
*/
protected $responseBody;
protected stdClass|string|null $responseBody;
/**
* The HTTP header of the server response.
*
* @var string[]|null
*/
protected $responseHeaders;
protected ?array $responseHeaders;
/**
* The deserialized response object
*
* @var \stdClass|string|null
* @var mixed
*/
protected $responseObject;
protected mixed $responseObject;
/**
* Constructor
@ -66,9 +67,9 @@ class ApiException extends Exception
* @param string $message Error message
* @param int $code HTTP status code
* @param string[]|null $responseHeaders HTTP response header
* @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string
* @param mixed $responseBody HTTP decoded body of the server response either as stdClass or string
*/
public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
public function __construct(string $message = "", int $code = 0, ?array $responseHeaders = [], mixed $responseBody = null)
{
parent::__construct($message, $code);
$this->responseHeaders = $responseHeaders;
@ -80,7 +81,7 @@ class ApiException extends Exception
*
* @return string[]|null HTTP response header
*/
public function getResponseHeaders()
public function getResponseHeaders(): ?array
{
return $this->responseHeaders;
}
@ -88,9 +89,9 @@ class ApiException extends Exception
/**
* Gets the HTTP body of the server response either as Json or string
*
* @return \stdClass|string|null HTTP body of the server response either as \stdClass or string
* @return stdClass|string|null HTTP body of the server response either as \stdClass or string
*/
public function getResponseBody()
public function getResponseBody(): stdClass|string|null
{
return $this->responseBody;
}
@ -102,7 +103,7 @@ class ApiException extends Exception
*
* @return void
*/
public function setResponseObject($obj)
public function setResponseObject(mixed $obj): void
{
$this->responseObject = $obj;
}
@ -112,7 +113,7 @@ class ApiException extends Exception
*
* @return mixed the deserialized response object
*/
public function getResponseObject()
public function getResponseObject(): mixed
{
return $this->responseObject;
}

View File

@ -27,6 +27,8 @@
namespace OpenAPI\Client;
use InvalidArgumentException;
/**
* Configuration Class Doc Comment
*
@ -41,86 +43,86 @@ class Configuration
public const BOOLEAN_FORMAT_STRING = 'string';
/**
* @var Configuration
* @var Configuration|null
*/
private static $defaultConfiguration;
private static ?Configuration $defaultConfiguration = null;
/**
* Associate array to store API key(s)
*
* @var string[]
*/
protected $apiKeys = [];
protected array $apiKeys = [];
/**
* Associate array to store API prefix (e.g. Bearer)
*
* @var string[]
*/
protected $apiKeyPrefixes = [];
protected array $apiKeyPrefixes = [];
/**
* Access token for OAuth/Bearer authentication
*
* @var string
*/
protected $accessToken = '';
protected string $accessToken = '';
/**
* Boolean format for query string
*
* @var string
*/
protected $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT;
protected string $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT;
/**
* Username for HTTP basic authentication
*
* @var string
*/
protected $username = '';
protected string $username = '';
/**
* Password for HTTP basic authentication
*
* @var string
*/
protected $password = '';
protected string $password = '';
/**
* The host
*
* @var string
*/
protected $host = 'http://petstore.swagger.io:80/v2';
protected string $host = 'http://petstore.swagger.io:80/v2';
/**
* User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default
*
* @var string
*/
protected $userAgent = 'OpenAPI-Generator/1.0.0/PHP';
protected string $userAgent = 'OpenAPI-Generator/1.0.0/PHP';
/**
* Debug switch (default set to false)
*
* @var bool
*/
protected $debug = false;
protected bool $debug = false;
/**
* Debug file location (log to STDOUT by default)
*
* @var string
*/
protected $debugFile = 'php://output';
protected string $debugFile = 'php://output';
/**
* Debug file location (log to STDOUT by default)
*
* @var string
*/
protected $tempFolderPath;
protected string $tempFolderPath;
/**
* Constructor
@ -138,7 +140,7 @@ class Configuration
*
* @return $this
*/
public function setApiKey($apiKeyIdentifier, $key)
public function setApiKey(string $apiKeyIdentifier, string $key): static
{
$this->apiKeys[$apiKeyIdentifier] = $key;
return $this;
@ -151,9 +153,9 @@ class Configuration
*
* @return null|string API key or token
*/
public function getApiKey($apiKeyIdentifier)
public function getApiKey(string $apiKeyIdentifier): ?string
{
return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
return $this->apiKeys[$apiKeyIdentifier] ?? null;
}
/**
@ -164,7 +166,7 @@ class Configuration
*
* @return $this
*/
public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static
{
$this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix;
return $this;
@ -177,9 +179,9 @@ class Configuration
*
* @return null|string
*/
public function getApiKeyPrefix($apiKeyIdentifier)
public function getApiKeyPrefix(string $apiKeyIdentifier): ?string
{
return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null;
return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null;
}
/**
@ -189,7 +191,7 @@ class Configuration
*
* @return $this
*/
public function setAccessToken($accessToken)
public function setAccessToken(string $accessToken): static
{
$this->accessToken = $accessToken;
return $this;
@ -200,7 +202,7 @@ class Configuration
*
* @return string Access token for OAuth
*/
public function getAccessToken()
public function getAccessToken(): string
{
return $this->accessToken;
}
@ -208,11 +210,11 @@ class Configuration
/**
* Sets boolean format for query string.
*
* @param string $booleanFormatForQueryString Boolean format for query string
* @param string $booleanFormat Boolean format for query string
*
* @return $this
*/
public function setBooleanFormatForQueryString(string $booleanFormat)
public function setBooleanFormatForQueryString(string $booleanFormat): static
{
$this->booleanFormatForQueryString = $booleanFormat;
@ -236,7 +238,7 @@ class Configuration
*
* @return $this
*/
public function setUsername($username)
public function setUsername(string $username): static
{
$this->username = $username;
return $this;
@ -247,7 +249,7 @@ class Configuration
*
* @return string Username for HTTP basic authentication
*/
public function getUsername()
public function getUsername(): string
{
return $this->username;
}
@ -259,7 +261,7 @@ class Configuration
*
* @return $this
*/
public function setPassword($password)
public function setPassword(string $password): static
{
$this->password = $password;
return $this;
@ -270,7 +272,7 @@ class Configuration
*
* @return string Password for HTTP basic authentication
*/
public function getPassword()
public function getPassword(): string
{
return $this->password;
}
@ -282,7 +284,7 @@ class Configuration
*
* @return $this
*/
public function setHost($host)
public function setHost(string $host): static
{
$this->host = $host;
return $this;
@ -293,7 +295,7 @@ class Configuration
*
* @return string Host
*/
public function getHost()
public function getHost(): string
{
return $this->host;
}
@ -303,15 +305,11 @@ class Configuration
*
* @param string $userAgent the user agent of the api client
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return $this
*/
public function setUserAgent($userAgent)
public function setUserAgent(string $userAgent): static
{
if (!is_string($userAgent)) {
throw new \InvalidArgumentException('User-agent must be a string.');
}
$this->userAgent = $userAgent;
return $this;
}
@ -321,7 +319,7 @@ class Configuration
*
* @return string user agent
*/
public function getUserAgent()
public function getUserAgent(): string
{
return $this->userAgent;
}
@ -333,7 +331,7 @@ class Configuration
*
* @return $this
*/
public function setDebug($debug)
public function setDebug(bool $debug): static
{
$this->debug = $debug;
return $this;
@ -344,7 +342,7 @@ class Configuration
*
* @return bool
*/
public function getDebug()
public function getDebug(): bool
{
return $this->debug;
}
@ -356,7 +354,7 @@ class Configuration
*
* @return $this
*/
public function setDebugFile($debugFile)
public function setDebugFile(string $debugFile): static
{
$this->debugFile = $debugFile;
return $this;
@ -367,7 +365,7 @@ class Configuration
*
* @return string
*/
public function getDebugFile()
public function getDebugFile(): string
{
return $this->debugFile;
}
@ -379,7 +377,7 @@ class Configuration
*
* @return $this
*/
public function setTempFolderPath($tempFolderPath)
public function setTempFolderPath(string $tempFolderPath): static
{
$this->tempFolderPath = $tempFolderPath;
return $this;
@ -390,7 +388,7 @@ class Configuration
*
* @return string Temp folder path
*/
public function getTempFolderPath()
public function getTempFolderPath(): string
{
return $this->tempFolderPath;
}
@ -400,7 +398,7 @@ class Configuration
*
* @return Configuration
*/
public static function getDefaultConfiguration()
public static function getDefaultConfiguration(): Configuration
{
if (self::$defaultConfiguration === null) {
self::$defaultConfiguration = new Configuration();
@ -416,7 +414,7 @@ class Configuration
*
* @return void
*/
public static function setDefaultConfiguration(Configuration $config)
public static function setDefaultConfiguration(Configuration $config): void
{
self::$defaultConfiguration = $config;
}
@ -426,7 +424,7 @@ class Configuration
*
* @return string The report for debugging
*/
public static function toDebugReport()
public static function toDebugReport(): string
{
$report = 'PHP SDK (OpenAPI\Client) Debug Report:' . PHP_EOL;
$report .= ' OS: ' . php_uname() . PHP_EOL;
@ -444,7 +442,7 @@ class Configuration
*
* @return null|string API key with the prefix
*/
public function getApiKeyWithPrefix($apiKeyIdentifier)
public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string
{
$prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
$apiKey = $this->getApiKey($apiKeyIdentifier);
@ -467,7 +465,7 @@ class Configuration
*
* @return array an array of host settings
*/
public function getHostSettings()
public function getHostSettings(): array
{
return [
[
@ -517,12 +515,12 @@ class Configuration
/**
* Returns URL based on host settings, index and variables
*
* @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param array $hostsSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
* @param int $hostIndex index of the host settings
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null)
public static function getHostString(array $hostsSettings, int $hostIndex, array $variables = null): string
{
if (null === $variables) {
$variables = [];
@ -530,7 +528,7 @@ class Configuration
// check array index out of bound
if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) {
throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings));
throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings));
}
$host = $hostsSettings[$hostIndex];
@ -542,7 +540,7 @@ class Configuration
if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
$url = str_replace("{".$name."}", $variables[$name], $url);
} else {
throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"]).".");
throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"]).".");
}
} else {
// use default value
@ -560,7 +558,7 @@ class Configuration
* @param array|null $variables hash of variable and the corresponding value (optional)
* @return string URL based on host settings
*/
public function getHostFromSettings($index, $variables = null)
public function getHostFromSettings(int $index, ?array $variables = null): string
{
return self::getHostString($this->getHostSettings(), $index, $variables);
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* AdditionalPropertiesClass Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSerializable
class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @var string
*/
protected static $openAPIModelName = 'AdditionalPropertiesClass';
protected static string $openAPIModelName = 'AdditionalPropertiesClass';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'map_property' => 'array<string,string>',
'map_of_map_property' => 'array<string,array<string,string>>'
];
@ -64,11 +67,9 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'map_property' => null,
'map_of_map_property' => null
];
@ -76,7 +77,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'map_property' => false,
@ -86,16 +87,16 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -103,9 +104,9 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -113,7 +114,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -123,7 +124,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -133,7 +134,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -166,9 +167,9 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'map_property' => 'map_property',
'map_of_map_property' => 'map_of_map_property'
];
@ -176,9 +177,9 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'map_property' => 'setMapProperty',
'map_of_map_property' => 'setMapOfMapProperty'
];
@ -186,9 +187,9 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'map_property' => 'getMapProperty',
'map_of_map_property' => 'getMapOfMapProperty'
];
@ -197,9 +198,9 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -207,9 +208,9 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -217,9 +218,9 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -229,7 +230,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -238,15 +239,14 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -263,7 +263,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -275,9 +275,9 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -290,7 +290,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -301,7 +301,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @return array<string,string>|null
*/
public function getMapProperty()
public function getMapProperty(): ?array
{
return $this->container['map_property'];
}
@ -311,12 +311,12 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @param array<string,string>|null $map_property map_property
*
* @return self
* @return $this
*/
public function setMapProperty($map_property)
public function setMapProperty(?array $map_property): static
{
if (is_null($map_property)) {
throw new \InvalidArgumentException('non-nullable map_property cannot be null');
throw new InvalidArgumentException('non-nullable map_property cannot be null');
}
$this->container['map_property'] = $map_property;
@ -328,7 +328,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @return array<string,array<string,string>>|null
*/
public function getMapOfMapProperty()
public function getMapOfMapProperty(): ?array
{
return $this->container['map_of_map_property'];
}
@ -338,12 +338,12 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @param array<string,array<string,string>>|null $map_of_map_property map_of_map_property
*
* @return self
* @return $this
*/
public function setMapOfMapProperty($map_of_map_property)
public function setMapOfMapProperty(?array $map_of_map_property): static
{
if (is_null($map_of_map_property)) {
throw new \InvalidArgumentException('non-nullable map_of_map_property cannot be null');
throw new InvalidArgumentException('non-nullable map_of_map_property cannot be null');
}
$this->container['map_of_map_property'] = $map_of_map_property;
@ -356,7 +356,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -368,8 +368,8 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -382,7 +382,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -398,7 +398,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -410,8 +410,8 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -421,7 +421,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -434,7 +434,7 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* AllOfWithSingleRef Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializable
class AllOfWithSingleRef implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @var string
*/
protected static $openAPIModelName = 'AllOfWithSingleRef';
protected static string $openAPIModelName = 'AllOfWithSingleRef';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'username' => 'string',
'single_ref_type' => '\OpenAPI\Client\Model\SingleRefType'
];
@ -64,11 +67,9 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'username' => null,
'single_ref_type' => null
];
@ -76,7 +77,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'username' => false,
@ -86,16 +87,16 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -103,9 +104,9 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -113,7 +114,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -123,7 +124,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -133,7 +134,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -166,9 +167,9 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'username' => 'username',
'single_ref_type' => 'SingleRefType'
];
@ -176,9 +177,9 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'username' => 'setUsername',
'single_ref_type' => 'setSingleRefType'
];
@ -186,9 +187,9 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'username' => 'getUsername',
'single_ref_type' => 'getSingleRefType'
];
@ -197,9 +198,9 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -207,9 +208,9 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -217,9 +218,9 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -229,7 +230,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -238,15 +239,14 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -263,7 +263,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -275,9 +275,9 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -290,7 +290,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -301,7 +301,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @return string|null
*/
public function getUsername()
public function getUsername(): ?string
{
return $this->container['username'];
}
@ -311,12 +311,12 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @param string|null $username username
*
* @return self
* @return $this
*/
public function setUsername($username)
public function setUsername(?string $username): static
{
if (is_null($username)) {
throw new \InvalidArgumentException('non-nullable username cannot be null');
throw new InvalidArgumentException('non-nullable username cannot be null');
}
$this->container['username'] = $username;
@ -328,7 +328,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @return \OpenAPI\Client\Model\SingleRefType|null
*/
public function getSingleRefType()
public function getSingleRefType(): ?\OpenAPI\Client\Model\SingleRefType
{
return $this->container['single_ref_type'];
}
@ -338,12 +338,12 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @param \OpenAPI\Client\Model\SingleRefType|null $single_ref_type single_ref_type
*
* @return self
* @return $this
*/
public function setSingleRefType($single_ref_type)
public function setSingleRefType(?\OpenAPI\Client\Model\SingleRefType $single_ref_type): static
{
if (is_null($single_ref_type)) {
throw new \InvalidArgumentException('non-nullable single_ref_type cannot be null');
throw new InvalidArgumentException('non-nullable single_ref_type cannot be null');
}
$this->container['single_ref_type'] = $single_ref_type;
@ -356,7 +356,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -368,8 +368,8 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -382,7 +382,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -398,7 +398,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -410,8 +410,8 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -421,7 +421,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -434,7 +434,7 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* Animal Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
class Animal implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = 'class_name';
@ -49,14 +52,14 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'Animal';
protected static string $openAPIModelName = 'Animal';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'class_name' => 'string',
'color' => 'string'
];
@ -64,11 +67,9 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'class_name' => null,
'color' => null
];
@ -76,7 +77,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'class_name' => false,
@ -86,16 +87,16 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -103,9 +104,9 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -113,7 +114,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -123,7 +124,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -133,7 +134,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -166,9 +167,9 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'class_name' => 'className',
'color' => 'color'
];
@ -176,9 +177,9 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'class_name' => 'setClassName',
'color' => 'setColor'
];
@ -186,9 +187,9 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'class_name' => 'getClassName',
'color' => 'getColor'
];
@ -197,9 +198,9 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -207,9 +208,9 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -217,9 +218,9 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -229,7 +230,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -238,15 +239,14 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -266,7 +266,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -278,9 +278,9 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -296,7 +296,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -307,7 +307,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getClassName()
public function getClassName(): string
{
return $this->container['class_name'];
}
@ -317,12 +317,12 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string $class_name class_name
*
* @return self
* @return $this
*/
public function setClassName($class_name)
public function setClassName(string $class_name): static
{
if (is_null($class_name)) {
throw new \InvalidArgumentException('non-nullable class_name cannot be null');
throw new InvalidArgumentException('non-nullable class_name cannot be null');
}
$this->container['class_name'] = $class_name;
@ -334,7 +334,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getColor()
public function getColor(): ?string
{
return $this->container['color'];
}
@ -344,12 +344,12 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $color color
*
* @return self
* @return $this
*/
public function setColor($color)
public function setColor(?string $color): static
{
if (is_null($color)) {
throw new \InvalidArgumentException('non-nullable color cannot be null');
throw new InvalidArgumentException('non-nullable color cannot be null');
}
$this->container['color'] = $color;
@ -362,7 +362,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -374,8 +374,8 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -388,7 +388,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -404,7 +404,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -416,8 +416,8 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -427,7 +427,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -440,7 +440,7 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* ApiResponse Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
class ApiResponse implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'ApiResponse';
protected static string $openAPIModelName = 'ApiResponse';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'code' => 'int',
'type' => 'string',
'message' => 'string'
@ -65,11 +68,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'code' => 'int32',
'type' => null,
'message' => null
@ -78,7 +79,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'code' => false,
@ -89,16 +90,16 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -106,9 +107,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -116,7 +117,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -126,7 +127,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -136,7 +137,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -169,9 +170,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'code' => 'code',
'type' => 'type',
'message' => 'message'
@ -180,9 +181,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'code' => 'setCode',
'type' => 'setType',
'message' => 'setMessage'
@ -191,9 +192,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'code' => 'getCode',
'type' => 'getType',
'message' => 'getMessage'
@ -203,9 +204,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -213,9 +214,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -223,9 +224,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -235,7 +236,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -244,15 +245,14 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -270,7 +270,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -282,9 +282,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -297,7 +297,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -308,7 +308,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getCode()
public function getCode(): ?int
{
return $this->container['code'];
}
@ -318,12 +318,12 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $code code
*
* @return self
* @return $this
*/
public function setCode($code)
public function setCode(?int $code): static
{
if (is_null($code)) {
throw new \InvalidArgumentException('non-nullable code cannot be null');
throw new InvalidArgumentException('non-nullable code cannot be null');
}
$this->container['code'] = $code;
@ -335,7 +335,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getType()
public function getType(): ?string
{
return $this->container['type'];
}
@ -345,12 +345,12 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $type type
*
* @return self
* @return $this
*/
public function setType($type)
public function setType(?string $type): static
{
if (is_null($type)) {
throw new \InvalidArgumentException('non-nullable type cannot be null');
throw new InvalidArgumentException('non-nullable type cannot be null');
}
$this->container['type'] = $type;
@ -362,7 +362,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getMessage()
public function getMessage(): ?string
{
return $this->container['message'];
}
@ -372,12 +372,12 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $message message
*
* @return self
* @return $this
*/
public function setMessage($message)
public function setMessage(?string $message): static
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
throw new InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
@ -390,7 +390,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -402,8 +402,8 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -416,7 +416,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -432,7 +432,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -444,8 +444,8 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -455,7 +455,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -468,7 +468,7 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* ArrayOfArrayOfNumberOnly Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,32 +52,30 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*
* @var string
*/
protected static $openAPIModelName = 'ArrayOfArrayOfNumberOnly';
protected static string $openAPIModelName = 'ArrayOfArrayOfNumberOnly';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'array_array_number' => 'float[][]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'array_array_number' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'array_array_number' => false
@ -83,16 +84,16 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -100,9 +101,9 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -110,7 +111,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -120,7 +121,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -130,7 +131,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -163,27 +164,27 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'array_array_number' => 'ArrayArrayNumber'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'array_array_number' => 'setArrayArrayNumber'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'array_array_number' => 'getArrayArrayNumber'
];
@ -191,9 +192,9 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -201,9 +202,9 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -211,9 +212,9 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -223,7 +224,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -232,15 +233,14 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -256,7 +256,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -268,9 +268,9 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -283,7 +283,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -294,7 +294,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*
* @return float[][]|null
*/
public function getArrayArrayNumber()
public function getArrayArrayNumber(): ?array
{
return $this->container['array_array_number'];
}
@ -304,12 +304,12 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*
* @param float[][]|null $array_array_number array_array_number
*
* @return self
* @return $this
*/
public function setArrayArrayNumber($array_array_number)
public function setArrayArrayNumber(?array $array_array_number): static
{
if (is_null($array_array_number)) {
throw new \InvalidArgumentException('non-nullable array_array_number cannot be null');
throw new InvalidArgumentException('non-nullable array_array_number cannot be null');
}
$this->container['array_array_number'] = $array_array_number;
@ -322,7 +322,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -334,8 +334,8 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -348,7 +348,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -364,7 +364,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -376,8 +376,8 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -387,7 +387,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -400,7 +400,7 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* ArrayOfNumberOnly Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,32 +52,30 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @var string
*/
protected static $openAPIModelName = 'ArrayOfNumberOnly';
protected static string $openAPIModelName = 'ArrayOfNumberOnly';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'array_number' => 'float[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'array_number' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'array_number' => false
@ -83,16 +84,16 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -100,9 +101,9 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -110,7 +111,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -120,7 +121,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -130,7 +131,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -163,27 +164,27 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'array_number' => 'ArrayNumber'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'array_number' => 'setArrayNumber'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'array_number' => 'getArrayNumber'
];
@ -191,9 +192,9 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -201,9 +202,9 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -211,9 +212,9 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -223,7 +224,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -232,15 +233,14 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -256,7 +256,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -268,9 +268,9 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -283,7 +283,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -294,7 +294,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return float[]|null
*/
public function getArrayNumber()
public function getArrayNumber(): ?array
{
return $this->container['array_number'];
}
@ -304,12 +304,12 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @param float[]|null $array_number array_number
*
* @return self
* @return $this
*/
public function setArrayNumber($array_number)
public function setArrayNumber(?array $array_number): static
{
if (is_null($array_number)) {
throw new \InvalidArgumentException('non-nullable array_number cannot be null');
throw new InvalidArgumentException('non-nullable array_number cannot be null');
}
$this->container['array_number'] = $array_number;
@ -322,7 +322,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -334,8 +334,8 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -348,7 +348,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -364,7 +364,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -376,8 +376,8 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -387,7 +387,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -400,7 +400,7 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* ArrayTest Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
class ArrayTest implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'ArrayTest';
protected static string $openAPIModelName = 'ArrayTest';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'array_of_string' => 'string[]',
'array_array_of_integer' => 'int[][]',
'array_array_of_model' => '\OpenAPI\Client\Model\ReadOnlyFirst[][]'
@ -65,11 +68,9 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'array_of_string' => null,
'array_array_of_integer' => 'int64',
'array_array_of_model' => null
@ -78,7 +79,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'array_of_string' => false,
@ -89,16 +90,16 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -106,9 +107,9 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -116,7 +117,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -126,7 +127,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -136,7 +137,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -169,9 +170,9 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'array_of_string' => 'array_of_string',
'array_array_of_integer' => 'array_array_of_integer',
'array_array_of_model' => 'array_array_of_model'
@ -180,9 +181,9 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'array_of_string' => 'setArrayOfString',
'array_array_of_integer' => 'setArrayArrayOfInteger',
'array_array_of_model' => 'setArrayArrayOfModel'
@ -191,9 +192,9 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'array_of_string' => 'getArrayOfString',
'array_array_of_integer' => 'getArrayArrayOfInteger',
'array_array_of_model' => 'getArrayArrayOfModel'
@ -203,9 +204,9 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -213,9 +214,9 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -223,9 +224,9 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -235,7 +236,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -244,15 +245,14 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -270,7 +270,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -282,9 +282,9 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -305,7 +305,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -316,7 +316,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string[]|null
*/
public function getArrayOfString()
public function getArrayOfString(): ?array
{
return $this->container['array_of_string'];
}
@ -326,19 +326,19 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string[]|null $array_of_string array_of_string
*
* @return self
* @return $this
*/
public function setArrayOfString($array_of_string)
public function setArrayOfString(?array $array_of_string): static
{
if (is_null($array_of_string)) {
throw new \InvalidArgumentException('non-nullable array_of_string cannot be null');
throw new InvalidArgumentException('non-nullable array_of_string cannot be null');
}
if ((count($array_of_string) > 3)) {
throw new \InvalidArgumentException('invalid value for $array_of_string when calling ArrayTest., number of items must be less than or equal to 3.');
throw new InvalidArgumentException('invalid value for $array_of_string when calling ArrayTest., number of items must be less than or equal to 3.');
}
if ((count($array_of_string) < 0)) {
throw new \InvalidArgumentException('invalid length for $array_of_string when calling ArrayTest., number of items must be greater than or equal to 0.');
throw new InvalidArgumentException('invalid length for $array_of_string when calling ArrayTest., number of items must be greater than or equal to 0.');
}
$this->container['array_of_string'] = $array_of_string;
@ -350,7 +350,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int[][]|null
*/
public function getArrayArrayOfInteger()
public function getArrayArrayOfInteger(): ?array
{
return $this->container['array_array_of_integer'];
}
@ -360,12 +360,12 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int[][]|null $array_array_of_integer array_array_of_integer
*
* @return self
* @return $this
*/
public function setArrayArrayOfInteger($array_array_of_integer)
public function setArrayArrayOfInteger(?array $array_array_of_integer): static
{
if (is_null($array_array_of_integer)) {
throw new \InvalidArgumentException('non-nullable array_array_of_integer cannot be null');
throw new InvalidArgumentException('non-nullable array_array_of_integer cannot be null');
}
$this->container['array_array_of_integer'] = $array_array_of_integer;
@ -377,7 +377,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \OpenAPI\Client\Model\ReadOnlyFirst[][]|null
*/
public function getArrayArrayOfModel()
public function getArrayArrayOfModel(): ?array
{
return $this->container['array_array_of_model'];
}
@ -387,12 +387,12 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \OpenAPI\Client\Model\ReadOnlyFirst[][]|null $array_array_of_model array_array_of_model
*
* @return self
* @return $this
*/
public function setArrayArrayOfModel($array_array_of_model)
public function setArrayArrayOfModel(?array $array_array_of_model): static
{
if (is_null($array_array_of_model)) {
throw new \InvalidArgumentException('non-nullable array_array_of_model cannot be null');
throw new InvalidArgumentException('non-nullable array_array_of_model cannot be null');
}
$this->container['array_array_of_model'] = $array_array_of_model;
@ -405,7 +405,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -417,8 +417,8 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -431,7 +431,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -447,7 +447,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -459,8 +459,8 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -470,7 +470,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -483,7 +483,7 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* Capitalization Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
class Capitalization implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'Capitalization';
protected static string $openAPIModelName = 'Capitalization';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'small_camel' => 'string',
'capital_camel' => 'string',
'small_snake' => 'string',
@ -68,11 +71,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'small_camel' => null,
'capital_camel' => null,
'small_snake' => null,
@ -84,7 +85,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'small_camel' => false,
@ -98,16 +99,16 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -115,9 +116,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -125,7 +126,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -135,7 +136,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -145,7 +146,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -178,9 +179,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'small_camel' => 'smallCamel',
'capital_camel' => 'CapitalCamel',
'small_snake' => 'small_Snake',
@ -192,9 +193,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'small_camel' => 'setSmallCamel',
'capital_camel' => 'setCapitalCamel',
'small_snake' => 'setSmallSnake',
@ -206,9 +207,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'small_camel' => 'getSmallCamel',
'capital_camel' => 'getCapitalCamel',
'small_snake' => 'getSmallSnake',
@ -221,9 +222,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -231,9 +232,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -241,9 +242,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -253,7 +254,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -262,15 +263,14 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -291,7 +291,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -303,9 +303,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -318,7 +318,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -329,7 +329,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getSmallCamel()
public function getSmallCamel(): ?string
{
return $this->container['small_camel'];
}
@ -339,12 +339,12 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $small_camel small_camel
*
* @return self
* @return $this
*/
public function setSmallCamel($small_camel)
public function setSmallCamel(?string $small_camel): static
{
if (is_null($small_camel)) {
throw new \InvalidArgumentException('non-nullable small_camel cannot be null');
throw new InvalidArgumentException('non-nullable small_camel cannot be null');
}
$this->container['small_camel'] = $small_camel;
@ -356,7 +356,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getCapitalCamel()
public function getCapitalCamel(): ?string
{
return $this->container['capital_camel'];
}
@ -366,12 +366,12 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $capital_camel capital_camel
*
* @return self
* @return $this
*/
public function setCapitalCamel($capital_camel)
public function setCapitalCamel(?string $capital_camel): static
{
if (is_null($capital_camel)) {
throw new \InvalidArgumentException('non-nullable capital_camel cannot be null');
throw new InvalidArgumentException('non-nullable capital_camel cannot be null');
}
$this->container['capital_camel'] = $capital_camel;
@ -383,7 +383,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getSmallSnake()
public function getSmallSnake(): ?string
{
return $this->container['small_snake'];
}
@ -393,12 +393,12 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $small_snake small_snake
*
* @return self
* @return $this
*/
public function setSmallSnake($small_snake)
public function setSmallSnake(?string $small_snake): static
{
if (is_null($small_snake)) {
throw new \InvalidArgumentException('non-nullable small_snake cannot be null');
throw new InvalidArgumentException('non-nullable small_snake cannot be null');
}
$this->container['small_snake'] = $small_snake;
@ -410,7 +410,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getCapitalSnake()
public function getCapitalSnake(): ?string
{
return $this->container['capital_snake'];
}
@ -420,12 +420,12 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $capital_snake capital_snake
*
* @return self
* @return $this
*/
public function setCapitalSnake($capital_snake)
public function setCapitalSnake(?string $capital_snake): static
{
if (is_null($capital_snake)) {
throw new \InvalidArgumentException('non-nullable capital_snake cannot be null');
throw new InvalidArgumentException('non-nullable capital_snake cannot be null');
}
$this->container['capital_snake'] = $capital_snake;
@ -437,7 +437,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getScaEthFlowPoints()
public function getScaEthFlowPoints(): ?string
{
return $this->container['sca_eth_flow_points'];
}
@ -447,12 +447,12 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $sca_eth_flow_points sca_eth_flow_points
*
* @return self
* @return $this
*/
public function setScaEthFlowPoints($sca_eth_flow_points)
public function setScaEthFlowPoints(?string $sca_eth_flow_points): static
{
if (is_null($sca_eth_flow_points)) {
throw new \InvalidArgumentException('non-nullable sca_eth_flow_points cannot be null');
throw new InvalidArgumentException('non-nullable sca_eth_flow_points cannot be null');
}
$this->container['sca_eth_flow_points'] = $sca_eth_flow_points;
@ -464,7 +464,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getAttName()
public function getAttName(): ?string
{
return $this->container['att_name'];
}
@ -474,12 +474,12 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $att_name Name of the pet
*
* @return self
* @return $this
*/
public function setAttName($att_name)
public function setAttName(?string $att_name): static
{
if (is_null($att_name)) {
throw new \InvalidArgumentException('non-nullable att_name cannot be null');
throw new InvalidArgumentException('non-nullable att_name cannot be null');
}
$this->container['att_name'] = $att_name;
@ -492,7 +492,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -504,8 +504,8 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -518,7 +518,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -534,7 +534,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -546,8 +546,8 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -557,7 +557,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -570,7 +570,7 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -27,7 +27,6 @@
*/
namespace OpenAPI\Client\Model;
use \OpenAPI\Client\ObjectSerializer;
/**
* Cat Class Doc Comment
@ -36,7 +35,7 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Cat extends Animal
{
@ -47,32 +46,30 @@ class Cat extends Animal
*
* @var string
*/
protected static $openAPIModelName = 'Cat';
protected static string $openAPIModelName = 'Cat';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'declawed' => 'bool'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'declawed' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'declawed' => false
@ -81,16 +78,16 @@ class Cat extends Animal
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes + parent::openAPITypes();
}
@ -98,9 +95,9 @@ class Cat extends Animal
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats + parent::openAPIFormats();
}
@ -108,7 +105,7 @@ class Cat extends Animal
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -118,7 +115,7 @@ class Cat extends Animal
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -128,7 +125,7 @@ class Cat extends Animal
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -161,27 +158,27 @@ class Cat extends Animal
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'declawed' => 'declawed'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'declawed' => 'setDeclawed'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'declawed' => 'getDeclawed'
];
@ -189,9 +186,9 @@ class Cat extends Animal
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return parent::attributeMap() + self::$attributeMap;
}
@ -199,9 +196,9 @@ class Cat extends Animal
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return parent::setters() + self::$setters;
}
@ -209,9 +206,9 @@ class Cat extends Animal
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return parent::getters() + self::$getters;
}
@ -221,7 +218,7 @@ class Cat extends Animal
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -231,8 +228,7 @@ class Cat extends Animal
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -250,7 +246,7 @@ class Cat extends Animal
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -262,9 +258,9 @@ class Cat extends Animal
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = parent::listInvalidProperties();
@ -277,7 +273,7 @@ class Cat extends Animal
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -288,7 +284,7 @@ class Cat extends Animal
*
* @return bool|null
*/
public function getDeclawed()
public function getDeclawed(): ?bool
{
return $this->container['declawed'];
}
@ -298,12 +294,12 @@ class Cat extends Animal
*
* @param bool|null $declawed declawed
*
* @return self
* @return $this
*/
public function setDeclawed($declawed)
public function setDeclawed(?bool $declawed): static
{
if (is_null($declawed)) {
throw new \InvalidArgumentException('non-nullable declawed cannot be null');
throw new InvalidArgumentException('non-nullable declawed cannot be null');
}
$this->container['declawed'] = $declawed;
@ -316,7 +312,7 @@ class Cat extends Animal
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -328,8 +324,8 @@ class Cat extends Animal
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -342,7 +338,7 @@ class Cat extends Animal
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -358,7 +354,7 @@ class Cat extends Animal
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -370,8 +366,8 @@ class Cat extends Animal
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -381,7 +377,7 @@ class Cat extends Animal
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -394,7 +390,7 @@ class Cat extends Animal
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* Category Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Category implements ModelInterface, ArrayAccess, \JsonSerializable
class Category implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'Category';
protected static string $openAPIModelName = 'Category';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'id' => 'int',
'name' => 'string'
];
@ -64,11 +67,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'id' => 'int64',
'name' => null
];
@ -76,7 +77,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'id' => false,
@ -86,16 +87,16 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -103,9 +104,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -113,7 +114,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -123,7 +124,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -133,7 +134,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -166,9 +167,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'id' => 'id',
'name' => 'name'
];
@ -176,9 +177,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'id' => 'setId',
'name' => 'setName'
];
@ -186,9 +187,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'id' => 'getId',
'name' => 'getName'
];
@ -197,9 +198,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -207,9 +208,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -217,9 +218,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -229,7 +230,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -238,15 +239,14 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -263,7 +263,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -275,9 +275,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -293,7 +293,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -304,7 +304,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getId()
public function getId(): ?int
{
return $this->container['id'];
}
@ -314,12 +314,12 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $id id
*
* @return self
* @return $this
*/
public function setId($id)
public function setId(?int $id): static
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
throw new InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
@ -331,7 +331,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getName()
public function getName(): string
{
return $this->container['name'];
}
@ -341,12 +341,12 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string $name name
*
* @return self
* @return $this
*/
public function setName($name)
public function setName(string $name): static
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
throw new InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
@ -359,7 +359,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -371,8 +371,8 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -385,7 +385,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -401,7 +401,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -413,8 +413,8 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -424,7 +424,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -437,7 +437,7 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* ClassModel Class Doc Comment
@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
class ClassModel implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -50,32 +53,30 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'ClassModel';
protected static string $openAPIModelName = 'ClassModel';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'_class' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'_class' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'_class' => false
@ -84,16 +85,16 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -101,9 +102,9 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -111,7 +112,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -121,7 +122,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -131,7 +132,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -164,27 +165,27 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'_class' => '_class'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'_class' => 'setClass'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'_class' => 'getClass'
];
@ -192,9 +193,9 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -202,9 +203,9 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -212,9 +213,9 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -224,7 +225,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -233,15 +234,14 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -257,7 +257,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -269,9 +269,9 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -284,7 +284,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -295,7 +295,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getClass()
public function getClass(): ?string
{
return $this->container['_class'];
}
@ -305,12 +305,12 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $_class _class
*
* @return self
* @return $this
*/
public function setClass($_class)
public function setClass(?string $_class): static
{
if (is_null($_class)) {
throw new \InvalidArgumentException('non-nullable _class cannot be null');
throw new InvalidArgumentException('non-nullable _class cannot be null');
}
$this->container['_class'] = $_class;
@ -323,7 +323,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -335,8 +335,8 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -349,7 +349,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -365,7 +365,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -377,8 +377,8 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -388,7 +388,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -401,7 +401,7 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* Client Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Client implements ModelInterface, ArrayAccess, \JsonSerializable
class Client implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,32 +52,30 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'Client';
protected static string $openAPIModelName = 'Client';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'client' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'client' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'client' => false
@ -83,16 +84,16 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -100,9 +101,9 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -110,7 +111,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -120,7 +121,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -130,7 +131,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -163,27 +164,27 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'client' => 'client'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'client' => 'setClient'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'client' => 'getClient'
];
@ -191,9 +192,9 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -201,9 +202,9 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -211,9 +212,9 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -223,7 +224,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -232,15 +233,14 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -256,7 +256,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -268,9 +268,9 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -283,7 +283,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -294,7 +294,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getClient()
public function getClient(): ?string
{
return $this->container['client'];
}
@ -304,12 +304,12 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $client client
*
* @return self
* @return $this
*/
public function setClient($client)
public function setClient(?string $client): static
{
if (is_null($client)) {
throw new \InvalidArgumentException('non-nullable client cannot be null');
throw new InvalidArgumentException('non-nullable client cannot be null');
}
$this->container['client'] = $client;
@ -322,7 +322,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -334,8 +334,8 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -348,7 +348,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -364,7 +364,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -376,8 +376,8 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -387,7 +387,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -400,7 +400,7 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* DeprecatedObject Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
class DeprecatedObject implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,32 +52,30 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'DeprecatedObject';
protected static string $openAPIModelName = 'DeprecatedObject';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'name' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'name' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'name' => false
@ -83,16 +84,16 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -100,9 +101,9 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -110,7 +111,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -120,7 +121,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -130,7 +131,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -163,27 +164,27 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'name' => 'name'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'name' => 'setName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'name' => 'getName'
];
@ -191,9 +192,9 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -201,9 +202,9 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -211,9 +212,9 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -223,7 +224,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -232,15 +233,14 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -256,7 +256,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -268,9 +268,9 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -283,7 +283,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -294,7 +294,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getName()
public function getName(): ?string
{
return $this->container['name'];
}
@ -304,12 +304,12 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $name name
*
* @return self
* @return $this
*/
public function setName($name)
public function setName(?string $name): static
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
throw new InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
@ -322,7 +322,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -334,8 +334,8 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -348,7 +348,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -364,7 +364,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -376,8 +376,8 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -387,7 +387,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -400,7 +400,7 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -27,7 +27,6 @@
*/
namespace OpenAPI\Client\Model;
use \OpenAPI\Client\ObjectSerializer;
/**
* Dog Class Doc Comment
@ -36,7 +35,7 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Dog extends Animal
{
@ -47,32 +46,30 @@ class Dog extends Animal
*
* @var string
*/
protected static $openAPIModelName = 'Dog';
protected static string $openAPIModelName = 'Dog';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'breed' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'breed' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'breed' => false
@ -81,16 +78,16 @@ class Dog extends Animal
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes + parent::openAPITypes();
}
@ -98,9 +95,9 @@ class Dog extends Animal
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats + parent::openAPIFormats();
}
@ -108,7 +105,7 @@ class Dog extends Animal
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -118,7 +115,7 @@ class Dog extends Animal
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -128,7 +125,7 @@ class Dog extends Animal
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -161,27 +158,27 @@ class Dog extends Animal
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'breed' => 'breed'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'breed' => 'setBreed'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'breed' => 'getBreed'
];
@ -189,9 +186,9 @@ class Dog extends Animal
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return parent::attributeMap() + self::$attributeMap;
}
@ -199,9 +196,9 @@ class Dog extends Animal
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return parent::setters() + self::$setters;
}
@ -209,9 +206,9 @@ class Dog extends Animal
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return parent::getters() + self::$getters;
}
@ -221,7 +218,7 @@ class Dog extends Animal
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -231,8 +228,7 @@ class Dog extends Animal
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -250,7 +246,7 @@ class Dog extends Animal
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -262,9 +258,9 @@ class Dog extends Animal
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = parent::listInvalidProperties();
@ -277,7 +273,7 @@ class Dog extends Animal
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -288,7 +284,7 @@ class Dog extends Animal
*
* @return string|null
*/
public function getBreed()
public function getBreed(): ?string
{
return $this->container['breed'];
}
@ -298,12 +294,12 @@ class Dog extends Animal
*
* @param string|null $breed breed
*
* @return self
* @return $this
*/
public function setBreed($breed)
public function setBreed(?string $breed): static
{
if (is_null($breed)) {
throw new \InvalidArgumentException('non-nullable breed cannot be null');
throw new InvalidArgumentException('non-nullable breed cannot be null');
}
$this->container['breed'] = $breed;
@ -316,7 +312,7 @@ class Dog extends Animal
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -328,8 +324,8 @@ class Dog extends Animal
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -342,7 +338,7 @@ class Dog extends Animal
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -358,7 +354,7 @@ class Dog extends Animal
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -370,8 +366,8 @@ class Dog extends Animal
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -381,7 +377,7 @@ class Dog extends Animal
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -394,7 +390,7 @@ class Dog extends Animal
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* EnumArrays Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
class EnumArrays implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'EnumArrays';
protected static string $openAPIModelName = 'EnumArrays';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'just_symbol' => 'string',
'array_enum' => 'string[]'
];
@ -64,11 +67,9 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'just_symbol' => null,
'array_enum' => null
];
@ -76,7 +77,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'just_symbol' => false,
@ -86,16 +87,16 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -103,9 +104,9 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -113,7 +114,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -123,7 +124,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -133,7 +134,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -166,9 +167,9 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'just_symbol' => 'just_symbol',
'array_enum' => 'array_enum'
];
@ -176,9 +177,9 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'just_symbol' => 'setJustSymbol',
'array_enum' => 'setArrayEnum'
];
@ -186,9 +187,9 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'just_symbol' => 'getJustSymbol',
'array_enum' => 'getArrayEnum'
];
@ -197,9 +198,9 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -207,9 +208,9 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -217,9 +218,9 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -229,7 +230,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -268,15 +269,14 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -293,7 +293,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -305,9 +305,9 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -329,7 +329,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -340,7 +340,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getJustSymbol()
public function getJustSymbol(): ?string
{
return $this->container['just_symbol'];
}
@ -350,16 +350,16 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $just_symbol just_symbol
*
* @return self
* @return $this
*/
public function setJustSymbol($just_symbol)
public function setJustSymbol(?string $just_symbol): static
{
if (is_null($just_symbol)) {
throw new \InvalidArgumentException('non-nullable just_symbol cannot be null');
throw new InvalidArgumentException('non-nullable just_symbol cannot be null');
}
$allowedValues = $this->getJustSymbolAllowableValues();
if (!in_array($just_symbol, $allowedValues, true)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'just_symbol', must be one of '%s'",
$just_symbol,
@ -377,7 +377,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string[]|null
*/
public function getArrayEnum()
public function getArrayEnum(): ?array
{
return $this->container['array_enum'];
}
@ -387,16 +387,16 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string[]|null $array_enum array_enum
*
* @return self
* @return $this
*/
public function setArrayEnum($array_enum)
public function setArrayEnum(?array $array_enum): static
{
if (is_null($array_enum)) {
throw new \InvalidArgumentException('non-nullable array_enum cannot be null');
throw new InvalidArgumentException('non-nullable array_enum cannot be null');
}
$allowedValues = $this->getArrayEnumAllowableValues();
if (array_diff($array_enum, $allowedValues)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"Invalid value for 'array_enum', must be one of '%s'",
implode("', '", $allowedValues)
@ -414,7 +414,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -426,8 +426,8 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -440,7 +440,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -456,7 +456,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -468,8 +468,8 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -479,7 +479,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -492,7 +492,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -27,7 +27,6 @@
*/
namespace OpenAPI\Client\Model;
use \OpenAPI\Client\ObjectSerializer;
/**
* EnumClass Class Doc Comment

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* EnumTest Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'Enum_Test';
protected static string $openAPIModelName = 'Enum_Test';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'enum_string' => 'string',
'enum_string_required' => 'string',
'enum_integer' => 'int',
@ -70,11 +73,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'enum_string' => null,
'enum_string_required' => null,
'enum_integer' => 'int32',
@ -88,7 +89,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'enum_string' => false,
@ -104,16 +105,16 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -121,9 +122,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -131,7 +132,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -141,7 +142,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -151,7 +152,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -184,9 +185,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'enum_string' => 'enum_string',
'enum_string_required' => 'enum_string_required',
'enum_integer' => 'enum_integer',
@ -200,9 +201,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'enum_string' => 'setEnumString',
'enum_string_required' => 'setEnumStringRequired',
'enum_integer' => 'setEnumInteger',
@ -216,9 +217,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'enum_string' => 'getEnumString',
'enum_string_required' => 'getEnumStringRequired',
'enum_integer' => 'getEnumInteger',
@ -233,9 +234,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -243,9 +244,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -253,9 +254,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -265,7 +266,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -338,15 +339,14 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -369,7 +369,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -381,9 +381,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -435,7 +435,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -446,7 +446,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getEnumString()
public function getEnumString(): ?string
{
return $this->container['enum_string'];
}
@ -456,16 +456,16 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $enum_string enum_string
*
* @return self
* @return $this
*/
public function setEnumString($enum_string)
public function setEnumString(?string $enum_string): static
{
if (is_null($enum_string)) {
throw new \InvalidArgumentException('non-nullable enum_string cannot be null');
throw new InvalidArgumentException('non-nullable enum_string cannot be null');
}
$allowedValues = $this->getEnumStringAllowableValues();
if (!in_array($enum_string, $allowedValues, true)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'enum_string', must be one of '%s'",
$enum_string,
@ -483,7 +483,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getEnumStringRequired()
public function getEnumStringRequired(): string
{
return $this->container['enum_string_required'];
}
@ -493,16 +493,16 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string $enum_string_required enum_string_required
*
* @return self
* @return $this
*/
public function setEnumStringRequired($enum_string_required)
public function setEnumStringRequired(string $enum_string_required): static
{
if (is_null($enum_string_required)) {
throw new \InvalidArgumentException('non-nullable enum_string_required cannot be null');
throw new InvalidArgumentException('non-nullable enum_string_required cannot be null');
}
$allowedValues = $this->getEnumStringRequiredAllowableValues();
if (!in_array($enum_string_required, $allowedValues, true)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'enum_string_required', must be one of '%s'",
$enum_string_required,
@ -520,7 +520,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getEnumInteger()
public function getEnumInteger(): ?int
{
return $this->container['enum_integer'];
}
@ -530,16 +530,16 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $enum_integer enum_integer
*
* @return self
* @return $this
*/
public function setEnumInteger($enum_integer)
public function setEnumInteger(?int $enum_integer): static
{
if (is_null($enum_integer)) {
throw new \InvalidArgumentException('non-nullable enum_integer cannot be null');
throw new InvalidArgumentException('non-nullable enum_integer cannot be null');
}
$allowedValues = $this->getEnumIntegerAllowableValues();
if (!in_array($enum_integer, $allowedValues, true)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'enum_integer', must be one of '%s'",
$enum_integer,
@ -557,7 +557,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return float|null
*/
public function getEnumNumber()
public function getEnumNumber(): ?float
{
return $this->container['enum_number'];
}
@ -567,16 +567,16 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param float|null $enum_number enum_number
*
* @return self
* @return $this
*/
public function setEnumNumber($enum_number)
public function setEnumNumber(?float $enum_number): static
{
if (is_null($enum_number)) {
throw new \InvalidArgumentException('non-nullable enum_number cannot be null');
throw new InvalidArgumentException('non-nullable enum_number cannot be null');
}
$allowedValues = $this->getEnumNumberAllowableValues();
if (!in_array($enum_number, $allowedValues, true)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'enum_number', must be one of '%s'",
$enum_number,
@ -594,7 +594,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \OpenAPI\Client\Model\OuterEnum|null
*/
public function getOuterEnum()
public function getOuterEnum(): ?\OpenAPI\Client\Model\OuterEnum
{
return $this->container['outer_enum'];
}
@ -604,9 +604,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \OpenAPI\Client\Model\OuterEnum|null $outer_enum outer_enum
*
* @return self
* @return $this
*/
public function setOuterEnum($outer_enum)
public function setOuterEnum(?\OpenAPI\Client\Model\OuterEnum $outer_enum): static
{
if (is_null($outer_enum)) {
array_push($this->openAPINullablesSetToNull, 'outer_enum');
@ -628,7 +628,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \OpenAPI\Client\Model\OuterEnumInteger|null
*/
public function getOuterEnumInteger()
public function getOuterEnumInteger(): ?\OpenAPI\Client\Model\OuterEnumInteger
{
return $this->container['outer_enum_integer'];
}
@ -638,12 +638,12 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \OpenAPI\Client\Model\OuterEnumInteger|null $outer_enum_integer outer_enum_integer
*
* @return self
* @return $this
*/
public function setOuterEnumInteger($outer_enum_integer)
public function setOuterEnumInteger(?\OpenAPI\Client\Model\OuterEnumInteger $outer_enum_integer): static
{
if (is_null($outer_enum_integer)) {
throw new \InvalidArgumentException('non-nullable outer_enum_integer cannot be null');
throw new InvalidArgumentException('non-nullable outer_enum_integer cannot be null');
}
$this->container['outer_enum_integer'] = $outer_enum_integer;
@ -655,7 +655,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \OpenAPI\Client\Model\OuterEnumDefaultValue|null
*/
public function getOuterEnumDefaultValue()
public function getOuterEnumDefaultValue(): ?\OpenAPI\Client\Model\OuterEnumDefaultValue
{
return $this->container['outer_enum_default_value'];
}
@ -665,12 +665,12 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \OpenAPI\Client\Model\OuterEnumDefaultValue|null $outer_enum_default_value outer_enum_default_value
*
* @return self
* @return $this
*/
public function setOuterEnumDefaultValue($outer_enum_default_value)
public function setOuterEnumDefaultValue(?\OpenAPI\Client\Model\OuterEnumDefaultValue $outer_enum_default_value): static
{
if (is_null($outer_enum_default_value)) {
throw new \InvalidArgumentException('non-nullable outer_enum_default_value cannot be null');
throw new InvalidArgumentException('non-nullable outer_enum_default_value cannot be null');
}
$this->container['outer_enum_default_value'] = $outer_enum_default_value;
@ -682,7 +682,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \OpenAPI\Client\Model\OuterEnumIntegerDefaultValue|null
*/
public function getOuterEnumIntegerDefaultValue()
public function getOuterEnumIntegerDefaultValue(): ?\OpenAPI\Client\Model\OuterEnumIntegerDefaultValue
{
return $this->container['outer_enum_integer_default_value'];
}
@ -692,12 +692,12 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \OpenAPI\Client\Model\OuterEnumIntegerDefaultValue|null $outer_enum_integer_default_value outer_enum_integer_default_value
*
* @return self
* @return $this
*/
public function setOuterEnumIntegerDefaultValue($outer_enum_integer_default_value)
public function setOuterEnumIntegerDefaultValue(?\OpenAPI\Client\Model\OuterEnumIntegerDefaultValue $outer_enum_integer_default_value): static
{
if (is_null($outer_enum_integer_default_value)) {
throw new \InvalidArgumentException('non-nullable outer_enum_integer_default_value cannot be null');
throw new InvalidArgumentException('non-nullable outer_enum_integer_default_value cannot be null');
}
$this->container['outer_enum_integer_default_value'] = $outer_enum_integer_default_value;
@ -710,7 +710,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -722,8 +722,8 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -736,7 +736,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -752,7 +752,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -764,8 +764,8 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -775,7 +775,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -788,7 +788,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* FakeBigDecimalMap200Response Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \JsonSerializable
class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @var string
*/
protected static $openAPIModelName = 'fakeBigDecimalMap_200_response';
protected static string $openAPIModelName = 'fakeBigDecimalMap_200_response';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'some_id' => 'float',
'some_map' => 'array<string,float>'
];
@ -64,11 +67,9 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'some_id' => null,
'some_map' => null
];
@ -76,7 +77,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'some_id' => false,
@ -86,16 +87,16 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -103,9 +104,9 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -113,7 +114,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -123,7 +124,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -133,7 +134,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -166,9 +167,9 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'some_id' => 'someId',
'some_map' => 'someMap'
];
@ -176,9 +177,9 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'some_id' => 'setSomeId',
'some_map' => 'setSomeMap'
];
@ -186,9 +187,9 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'some_id' => 'getSomeId',
'some_map' => 'getSomeMap'
];
@ -197,9 +198,9 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -207,9 +208,9 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -217,9 +218,9 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -229,7 +230,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -238,15 +239,14 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -263,7 +263,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -275,9 +275,9 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -290,7 +290,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -301,7 +301,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @return float|null
*/
public function getSomeId()
public function getSomeId(): ?float
{
return $this->container['some_id'];
}
@ -311,12 +311,12 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @param float|null $some_id some_id
*
* @return self
* @return $this
*/
public function setSomeId($some_id)
public function setSomeId(?float $some_id): static
{
if (is_null($some_id)) {
throw new \InvalidArgumentException('non-nullable some_id cannot be null');
throw new InvalidArgumentException('non-nullable some_id cannot be null');
}
$this->container['some_id'] = $some_id;
@ -328,7 +328,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @return array<string,float>|null
*/
public function getSomeMap()
public function getSomeMap(): ?array
{
return $this->container['some_map'];
}
@ -338,12 +338,12 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @param array<string,float>|null $some_map some_map
*
* @return self
* @return $this
*/
public function setSomeMap($some_map)
public function setSomeMap(?array $some_map): static
{
if (is_null($some_map)) {
throw new \InvalidArgumentException('non-nullable some_map cannot be null');
throw new InvalidArgumentException('non-nullable some_map cannot be null');
}
$this->container['some_map'] = $some_map;
@ -356,7 +356,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -368,8 +368,8 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -382,7 +382,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -398,7 +398,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -410,8 +410,8 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -421,7 +421,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -434,7 +434,7 @@ class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \Json
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* File Class Doc Comment
@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class File implements ModelInterface, ArrayAccess, \JsonSerializable
class File implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -50,32 +53,30 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'File';
protected static string $openAPIModelName = 'File';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'source_uri' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'source_uri' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'source_uri' => false
@ -84,16 +85,16 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -101,9 +102,9 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -111,7 +112,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -121,7 +122,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -131,7 +132,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -164,27 +165,27 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'source_uri' => 'sourceURI'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'source_uri' => 'setSourceUri'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'source_uri' => 'getSourceUri'
];
@ -192,9 +193,9 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -202,9 +203,9 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -212,9 +213,9 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -224,7 +225,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -233,15 +234,14 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -257,7 +257,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -269,9 +269,9 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -284,7 +284,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -295,7 +295,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getSourceUri()
public function getSourceUri(): ?string
{
return $this->container['source_uri'];
}
@ -305,12 +305,12 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $source_uri Test capitalization
*
* @return self
* @return $this
*/
public function setSourceUri($source_uri)
public function setSourceUri(?string $source_uri): static
{
if (is_null($source_uri)) {
throw new \InvalidArgumentException('non-nullable source_uri cannot be null');
throw new InvalidArgumentException('non-nullable source_uri cannot be null');
}
$this->container['source_uri'] = $source_uri;
@ -323,7 +323,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -335,8 +335,8 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -349,7 +349,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -365,7 +365,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -377,8 +377,8 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -388,7 +388,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -401,7 +401,7 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* FileSchemaTestClass Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializable
class FileSchemaTestClass implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @var string
*/
protected static $openAPIModelName = 'FileSchemaTestClass';
protected static string $openAPIModelName = 'FileSchemaTestClass';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'file' => '\OpenAPI\Client\Model\File',
'files' => '\OpenAPI\Client\Model\File[]'
];
@ -64,11 +67,9 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'file' => null,
'files' => null
];
@ -76,7 +77,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'file' => false,
@ -86,16 +87,16 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -103,9 +104,9 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -113,7 +114,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -123,7 +124,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -133,7 +134,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -166,9 +167,9 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'file' => 'file',
'files' => 'files'
];
@ -176,9 +177,9 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'file' => 'setFile',
'files' => 'setFiles'
];
@ -186,9 +187,9 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'file' => 'getFile',
'files' => 'getFiles'
];
@ -197,9 +198,9 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -207,9 +208,9 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -217,9 +218,9 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -229,7 +230,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -238,15 +239,14 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -263,7 +263,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -275,9 +275,9 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -290,7 +290,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -301,7 +301,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @return \OpenAPI\Client\Model\File|null
*/
public function getFile()
public function getFile(): ?\OpenAPI\Client\Model\File
{
return $this->container['file'];
}
@ -311,12 +311,12 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @param \OpenAPI\Client\Model\File|null $file file
*
* @return self
* @return $this
*/
public function setFile($file)
public function setFile(?\OpenAPI\Client\Model\File $file): static
{
if (is_null($file)) {
throw new \InvalidArgumentException('non-nullable file cannot be null');
throw new InvalidArgumentException('non-nullable file cannot be null');
}
$this->container['file'] = $file;
@ -328,7 +328,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @return \OpenAPI\Client\Model\File[]|null
*/
public function getFiles()
public function getFiles(): ?array
{
return $this->container['files'];
}
@ -338,12 +338,12 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @param \OpenAPI\Client\Model\File[]|null $files files
*
* @return self
* @return $this
*/
public function setFiles($files)
public function setFiles(?array $files): static
{
if (is_null($files)) {
throw new \InvalidArgumentException('non-nullable files cannot be null');
throw new InvalidArgumentException('non-nullable files cannot be null');
}
$this->container['files'] = $files;
@ -356,7 +356,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -368,8 +368,8 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -382,7 +382,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -398,7 +398,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -410,8 +410,8 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -421,7 +421,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -434,7 +434,7 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* Foo Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
class Foo implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,32 +52,30 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'Foo';
protected static string $openAPIModelName = 'Foo';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'bar' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'bar' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'bar' => false
@ -83,16 +84,16 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -100,9 +101,9 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -110,7 +111,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -120,7 +121,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -130,7 +131,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -163,27 +164,27 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'bar' => 'bar'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'bar' => 'setBar'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'bar' => 'getBar'
];
@ -191,9 +192,9 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -201,9 +202,9 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -211,9 +212,9 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -223,7 +224,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -232,15 +233,14 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -256,7 +256,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -268,9 +268,9 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -283,7 +283,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -294,7 +294,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getBar()
public function getBar(): ?string
{
return $this->container['bar'];
}
@ -304,12 +304,12 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $bar bar
*
* @return self
* @return $this
*/
public function setBar($bar)
public function setBar(?string $bar): static
{
if (is_null($bar)) {
throw new \InvalidArgumentException('non-nullable bar cannot be null');
throw new InvalidArgumentException('non-nullable bar cannot be null');
}
$this->container['bar'] = $bar;
@ -322,7 +322,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -334,8 +334,8 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -348,7 +348,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -364,7 +364,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -376,8 +376,8 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -387,7 +387,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -400,7 +400,7 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* FooGetDefaultResponse Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSerializable
class FooGetDefaultResponse implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,32 +52,30 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*
* @var string
*/
protected static $openAPIModelName = '_foo_get_default_response';
protected static string $openAPIModelName = '_foo_get_default_response';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'string' => '\OpenAPI\Client\Model\Foo'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'string' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'string' => false
@ -83,16 +84,16 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -100,9 +101,9 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -110,7 +111,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -120,7 +121,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -130,7 +131,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -163,27 +164,27 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'string' => 'string'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'string' => 'setString'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'string' => 'getString'
];
@ -191,9 +192,9 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -201,9 +202,9 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -211,9 +212,9 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -223,7 +224,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -232,15 +233,14 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -256,7 +256,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -268,9 +268,9 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -283,7 +283,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -294,7 +294,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*
* @return \OpenAPI\Client\Model\Foo|null
*/
public function getString()
public function getString(): ?\OpenAPI\Client\Model\Foo
{
return $this->container['string'];
}
@ -304,12 +304,12 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*
* @param \OpenAPI\Client\Model\Foo|null $string string
*
* @return self
* @return $this
*/
public function setString($string)
public function setString(?\OpenAPI\Client\Model\Foo $string): static
{
if (is_null($string)) {
throw new \InvalidArgumentException('non-nullable string cannot be null');
throw new InvalidArgumentException('non-nullable string cannot be null');
}
$this->container['string'] = $string;
@ -322,7 +322,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -334,8 +334,8 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -348,7 +348,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -364,7 +364,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -376,8 +376,8 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -387,7 +387,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -400,7 +400,7 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* FormatTest Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
class FormatTest implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'format_test';
protected static string $openAPIModelName = 'format_test';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'integer' => 'int',
'int32' => 'int',
'int64' => 'int',
@ -78,11 +81,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'integer' => null,
'int32' => 'int32',
'int64' => 'int64',
@ -104,7 +105,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'integer' => false,
@ -128,16 +129,16 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -145,9 +146,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -155,7 +156,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -165,7 +166,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -175,7 +176,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -208,9 +209,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'integer' => 'integer',
'int32' => 'int32',
'int64' => 'int64',
@ -232,9 +233,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'integer' => 'setInteger',
'int32' => 'setInt32',
'int64' => 'setInt64',
@ -256,9 +257,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'integer' => 'getInteger',
'int32' => 'getInt32',
'int64' => 'getInt64',
@ -281,9 +282,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -291,9 +292,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -301,9 +302,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -313,7 +314,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -322,15 +323,14 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -361,7 +361,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -373,9 +373,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -460,7 +460,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -471,7 +471,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getInteger()
public function getInteger(): ?int
{
return $this->container['integer'];
}
@ -481,19 +481,19 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $integer integer
*
* @return self
* @return $this
*/
public function setInteger($integer)
public function setInteger(?int $integer): static
{
if (is_null($integer)) {
throw new \InvalidArgumentException('non-nullable integer cannot be null');
throw new InvalidArgumentException('non-nullable integer cannot be null');
}
if (($integer > 100)) {
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be smaller than or equal to 100.');
throw new InvalidArgumentException('invalid value for $integer when calling FormatTest., must be smaller than or equal to 100.');
}
if (($integer < 10)) {
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.');
throw new InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.');
}
$this->container['integer'] = $integer;
@ -506,7 +506,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getInt32()
public function getInt32(): ?int
{
return $this->container['int32'];
}
@ -516,19 +516,19 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $int32 int32
*
* @return self
* @return $this
*/
public function setInt32($int32)
public function setInt32(?int $int32): static
{
if (is_null($int32)) {
throw new \InvalidArgumentException('non-nullable int32 cannot be null');
throw new InvalidArgumentException('non-nullable int32 cannot be null');
}
if (($int32 > 200)) {
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be smaller than or equal to 200.');
throw new InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be smaller than or equal to 200.');
}
if (($int32 < 20)) {
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.');
throw new InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.');
}
$this->container['int32'] = $int32;
@ -541,7 +541,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getInt64()
public function getInt64(): ?int
{
return $this->container['int64'];
}
@ -551,12 +551,12 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $int64 int64
*
* @return self
* @return $this
*/
public function setInt64($int64)
public function setInt64(?int $int64): static
{
if (is_null($int64)) {
throw new \InvalidArgumentException('non-nullable int64 cannot be null');
throw new InvalidArgumentException('non-nullable int64 cannot be null');
}
$this->container['int64'] = $int64;
@ -568,7 +568,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return float
*/
public function getNumber()
public function getNumber(): float
{
return $this->container['number'];
}
@ -578,19 +578,19 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param float $number number
*
* @return self
* @return $this
*/
public function setNumber($number)
public function setNumber(float $number): static
{
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
throw new InvalidArgumentException('non-nullable number cannot be null');
}
if (($number > 543.2)) {
throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be smaller than or equal to 543.2.');
throw new InvalidArgumentException('invalid value for $number when calling FormatTest., must be smaller than or equal to 543.2.');
}
if (($number < 32.1)) {
throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be bigger than or equal to 32.1.');
throw new InvalidArgumentException('invalid value for $number when calling FormatTest., must be bigger than or equal to 32.1.');
}
$this->container['number'] = $number;
@ -603,7 +603,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return float|null
*/
public function getFloat()
public function getFloat(): ?float
{
return $this->container['float'];
}
@ -613,19 +613,19 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param float|null $float float
*
* @return self
* @return $this
*/
public function setFloat($float)
public function setFloat(?float $float): static
{
if (is_null($float)) {
throw new \InvalidArgumentException('non-nullable float cannot be null');
throw new InvalidArgumentException('non-nullable float cannot be null');
}
if (($float > 987.6)) {
throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be smaller than or equal to 987.6.');
throw new InvalidArgumentException('invalid value for $float when calling FormatTest., must be smaller than or equal to 987.6.');
}
if (($float < 54.3)) {
throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be bigger than or equal to 54.3.');
throw new InvalidArgumentException('invalid value for $float when calling FormatTest., must be bigger than or equal to 54.3.');
}
$this->container['float'] = $float;
@ -638,7 +638,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return float|null
*/
public function getDouble()
public function getDouble(): ?float
{
return $this->container['double'];
}
@ -648,19 +648,19 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param float|null $double double
*
* @return self
* @return $this
*/
public function setDouble($double)
public function setDouble(?float $double): static
{
if (is_null($double)) {
throw new \InvalidArgumentException('non-nullable double cannot be null');
throw new InvalidArgumentException('non-nullable double cannot be null');
}
if (($double > 123.4)) {
throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be smaller than or equal to 123.4.');
throw new InvalidArgumentException('invalid value for $double when calling FormatTest., must be smaller than or equal to 123.4.');
}
if (($double < 67.8)) {
throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be bigger than or equal to 67.8.');
throw new InvalidArgumentException('invalid value for $double when calling FormatTest., must be bigger than or equal to 67.8.');
}
$this->container['double'] = $double;
@ -673,7 +673,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return float|null
*/
public function getDecimal()
public function getDecimal(): ?float
{
return $this->container['decimal'];
}
@ -683,12 +683,12 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param float|null $decimal decimal
*
* @return self
* @return $this
*/
public function setDecimal($decimal)
public function setDecimal(?float $decimal): static
{
if (is_null($decimal)) {
throw new \InvalidArgumentException('non-nullable decimal cannot be null');
throw new InvalidArgumentException('non-nullable decimal cannot be null');
}
$this->container['decimal'] = $decimal;
@ -700,7 +700,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getString()
public function getString(): ?string
{
return $this->container['string'];
}
@ -710,16 +710,16 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $string string
*
* @return self
* @return $this
*/
public function setString($string)
public function setString(?string $string): static
{
if (is_null($string)) {
throw new \InvalidArgumentException('non-nullable string cannot be null');
throw new InvalidArgumentException('non-nullable string cannot be null');
}
if ((!preg_match("/[a-z]/i", $string))) {
throw new \InvalidArgumentException("invalid value for \$string when calling FormatTest., must conform to the pattern /[a-z]/i.");
throw new InvalidArgumentException("invalid value for \$string when calling FormatTest., must conform to the pattern /[a-z]/i.");
}
$this->container['string'] = $string;
@ -732,7 +732,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getByte()
public function getByte(): string
{
return $this->container['byte'];
}
@ -742,12 +742,12 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string $byte byte
*
* @return self
* @return $this
*/
public function setByte($byte)
public function setByte(string $byte): static
{
if (is_null($byte)) {
throw new \InvalidArgumentException('non-nullable byte cannot be null');
throw new InvalidArgumentException('non-nullable byte cannot be null');
}
$this->container['byte'] = $byte;
@ -759,7 +759,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \SplFileObject|null
*/
public function getBinary()
public function getBinary(): ?\SplFileObject
{
return $this->container['binary'];
}
@ -769,12 +769,12 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \SplFileObject|null $binary binary
*
* @return self
* @return $this
*/
public function setBinary($binary)
public function setBinary(?\SplFileObject $binary): static
{
if (is_null($binary)) {
throw new \InvalidArgumentException('non-nullable binary cannot be null');
throw new InvalidArgumentException('non-nullable binary cannot be null');
}
$this->container['binary'] = $binary;
@ -786,7 +786,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \DateTime
*/
public function getDate()
public function getDate(): \DateTime
{
return $this->container['date'];
}
@ -796,12 +796,12 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \DateTime $date date
*
* @return self
* @return $this
*/
public function setDate($date)
public function setDate(\DateTime $date): static
{
if (is_null($date)) {
throw new \InvalidArgumentException('non-nullable date cannot be null');
throw new InvalidArgumentException('non-nullable date cannot be null');
}
$this->container['date'] = $date;
@ -813,7 +813,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \DateTime|null
*/
public function getDateTime()
public function getDateTime(): ?\DateTime
{
return $this->container['date_time'];
}
@ -823,12 +823,12 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \DateTime|null $date_time date_time
*
* @return self
* @return $this
*/
public function setDateTime($date_time)
public function setDateTime(?\DateTime $date_time): static
{
if (is_null($date_time)) {
throw new \InvalidArgumentException('non-nullable date_time cannot be null');
throw new InvalidArgumentException('non-nullable date_time cannot be null');
}
$this->container['date_time'] = $date_time;
@ -840,7 +840,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getUuid()
public function getUuid(): ?string
{
return $this->container['uuid'];
}
@ -850,12 +850,12 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $uuid uuid
*
* @return self
* @return $this
*/
public function setUuid($uuid)
public function setUuid(?string $uuid): static
{
if (is_null($uuid)) {
throw new \InvalidArgumentException('non-nullable uuid cannot be null');
throw new InvalidArgumentException('non-nullable uuid cannot be null');
}
$this->container['uuid'] = $uuid;
@ -867,7 +867,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getPassword()
public function getPassword(): string
{
return $this->container['password'];
}
@ -877,18 +877,18 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string $password password
*
* @return self
* @return $this
*/
public function setPassword($password)
public function setPassword(string $password): static
{
if (is_null($password)) {
throw new \InvalidArgumentException('non-nullable password cannot be null');
throw new InvalidArgumentException('non-nullable password cannot be null');
}
if ((mb_strlen($password) > 64)) {
throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be smaller than or equal to 64.');
throw new InvalidArgumentException('invalid length for $password when calling FormatTest., must be smaller than or equal to 64.');
}
if ((mb_strlen($password) < 10)) {
throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be bigger than or equal to 10.');
throw new InvalidArgumentException('invalid length for $password when calling FormatTest., must be bigger than or equal to 10.');
}
$this->container['password'] = $password;
@ -901,7 +901,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getPatternWithDigits()
public function getPatternWithDigits(): ?string
{
return $this->container['pattern_with_digits'];
}
@ -911,16 +911,16 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $pattern_with_digits A string that is a 10 digit number. Can have leading zeros.
*
* @return self
* @return $this
*/
public function setPatternWithDigits($pattern_with_digits)
public function setPatternWithDigits(?string $pattern_with_digits): static
{
if (is_null($pattern_with_digits)) {
throw new \InvalidArgumentException('non-nullable pattern_with_digits cannot be null');
throw new InvalidArgumentException('non-nullable pattern_with_digits cannot be null');
}
if ((!preg_match("/^\\d{10}$/", $pattern_with_digits))) {
throw new \InvalidArgumentException("invalid value for \$pattern_with_digits when calling FormatTest., must conform to the pattern /^\\d{10}$/.");
throw new InvalidArgumentException("invalid value for \$pattern_with_digits when calling FormatTest., must conform to the pattern /^\\d{10}$/.");
}
$this->container['pattern_with_digits'] = $pattern_with_digits;
@ -933,7 +933,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getPatternWithDigitsAndDelimiter()
public function getPatternWithDigitsAndDelimiter(): ?string
{
return $this->container['pattern_with_digits_and_delimiter'];
}
@ -943,16 +943,16 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @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 self
* @return $this
*/
public function setPatternWithDigitsAndDelimiter($pattern_with_digits_and_delimiter)
public function setPatternWithDigitsAndDelimiter(?string $pattern_with_digits_and_delimiter): static
{
if (is_null($pattern_with_digits_and_delimiter)) {
throw new \InvalidArgumentException('non-nullable pattern_with_digits_and_delimiter cannot be null');
throw new InvalidArgumentException('non-nullable pattern_with_digits_and_delimiter cannot be null');
}
if ((!preg_match("/^image_\\d{1,3}$/i", $pattern_with_digits_and_delimiter))) {
throw new \InvalidArgumentException("invalid value for \$pattern_with_digits_and_delimiter when calling FormatTest., must conform to the pattern /^image_\\d{1,3}$/i.");
throw new InvalidArgumentException("invalid value for \$pattern_with_digits_and_delimiter when calling FormatTest., must conform to the pattern /^image_\\d{1,3}$/i.");
}
$this->container['pattern_with_digits_and_delimiter'] = $pattern_with_digits_and_delimiter;
@ -966,7 +966,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -978,8 +978,8 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -992,7 +992,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -1008,7 +1008,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -1020,8 +1020,8 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -1031,7 +1031,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -1044,7 +1044,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* HasOnlyReadOnly Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
class HasOnlyReadOnly implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'hasOnlyReadOnly';
protected static string $openAPIModelName = 'hasOnlyReadOnly';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'bar' => 'string',
'foo' => 'string'
];
@ -64,11 +67,9 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'bar' => null,
'foo' => null
];
@ -76,7 +77,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'bar' => false,
@ -86,16 +87,16 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -103,9 +104,9 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -113,7 +114,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -123,7 +124,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -133,7 +134,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -166,9 +167,9 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'bar' => 'bar',
'foo' => 'foo'
];
@ -176,9 +177,9 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'bar' => 'setBar',
'foo' => 'setFoo'
];
@ -186,9 +187,9 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'bar' => 'getBar',
'foo' => 'getFoo'
];
@ -197,9 +198,9 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -207,9 +208,9 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -217,9 +218,9 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -229,7 +230,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -238,15 +239,14 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -263,7 +263,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -275,9 +275,9 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -290,7 +290,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -301,7 +301,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getBar()
public function getBar(): ?string
{
return $this->container['bar'];
}
@ -311,12 +311,12 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $bar bar
*
* @return self
* @return $this
*/
public function setBar($bar)
public function setBar(?string $bar): static
{
if (is_null($bar)) {
throw new \InvalidArgumentException('non-nullable bar cannot be null');
throw new InvalidArgumentException('non-nullable bar cannot be null');
}
$this->container['bar'] = $bar;
@ -328,7 +328,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getFoo()
public function getFoo(): ?string
{
return $this->container['foo'];
}
@ -338,12 +338,12 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $foo foo
*
* @return self
* @return $this
*/
public function setFoo($foo)
public function setFoo(?string $foo): static
{
if (is_null($foo)) {
throw new \InvalidArgumentException('non-nullable foo cannot be null');
throw new InvalidArgumentException('non-nullable foo cannot be null');
}
$this->container['foo'] = $foo;
@ -356,7 +356,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -368,8 +368,8 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -382,7 +382,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -398,7 +398,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -410,8 +410,8 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -421,7 +421,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -434,7 +434,7 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* HealthCheckResult Class Doc Comment
@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializable
class HealthCheckResult implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -50,32 +53,30 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @var string
*/
protected static $openAPIModelName = 'HealthCheckResult';
protected static string $openAPIModelName = 'HealthCheckResult';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'nullable_message' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'nullable_message' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'nullable_message' => true
@ -84,16 +85,16 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -101,9 +102,9 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -111,7 +112,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -121,7 +122,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -131,7 +132,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -164,27 +165,27 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'nullable_message' => 'NullableMessage'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'nullable_message' => 'setNullableMessage'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'nullable_message' => 'getNullableMessage'
];
@ -192,9 +193,9 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -202,9 +203,9 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -212,9 +213,9 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -224,7 +225,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -233,15 +234,14 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -257,7 +257,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -269,9 +269,9 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -284,7 +284,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -295,7 +295,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return string|null
*/
public function getNullableMessage()
public function getNullableMessage(): ?string
{
return $this->container['nullable_message'];
}
@ -305,9 +305,9 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @param string|null $nullable_message nullable_message
*
* @return self
* @return $this
*/
public function setNullableMessage($nullable_message)
public function setNullableMessage(?string $nullable_message): static
{
if (is_null($nullable_message)) {
array_push($this->openAPINullablesSetToNull, 'nullable_message');
@ -330,7 +330,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -342,8 +342,8 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -356,7 +356,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -372,7 +372,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -384,8 +384,8 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -395,7 +395,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -408,7 +408,7 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* MapTest Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
class MapTest implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'MapTest';
protected static string $openAPIModelName = 'MapTest';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'map_map_of_string' => 'array<string,array<string,string>>',
'map_of_enum_string' => 'array<string,string>',
'direct_map' => 'array<string,bool>',
@ -66,11 +69,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'map_map_of_string' => null,
'map_of_enum_string' => null,
'direct_map' => null,
@ -80,7 +81,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'map_map_of_string' => false,
@ -92,16 +93,16 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -109,9 +110,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -119,7 +120,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -129,7 +130,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -139,7 +140,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -172,9 +173,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'map_map_of_string' => 'map_map_of_string',
'map_of_enum_string' => 'map_of_enum_string',
'direct_map' => 'direct_map',
@ -184,9 +185,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'map_map_of_string' => 'setMapMapOfString',
'map_of_enum_string' => 'setMapOfEnumString',
'direct_map' => 'setDirectMap',
@ -196,9 +197,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'map_map_of_string' => 'getMapMapOfString',
'map_of_enum_string' => 'getMapOfEnumString',
'direct_map' => 'getDirectMap',
@ -209,9 +210,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -219,9 +220,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -229,9 +230,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -241,7 +242,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -265,15 +266,14 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -292,7 +292,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -304,9 +304,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -319,7 +319,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -330,7 +330,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return array<string,array<string,string>>|null
*/
public function getMapMapOfString()
public function getMapMapOfString(): ?array
{
return $this->container['map_map_of_string'];
}
@ -340,12 +340,12 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param array<string,array<string,string>>|null $map_map_of_string map_map_of_string
*
* @return self
* @return $this
*/
public function setMapMapOfString($map_map_of_string)
public function setMapMapOfString(?array $map_map_of_string): static
{
if (is_null($map_map_of_string)) {
throw new \InvalidArgumentException('non-nullable map_map_of_string cannot be null');
throw new InvalidArgumentException('non-nullable map_map_of_string cannot be null');
}
$this->container['map_map_of_string'] = $map_map_of_string;
@ -357,7 +357,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return array<string,string>|null
*/
public function getMapOfEnumString()
public function getMapOfEnumString(): ?array
{
return $this->container['map_of_enum_string'];
}
@ -367,16 +367,16 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param array<string,string>|null $map_of_enum_string map_of_enum_string
*
* @return self
* @return $this
*/
public function setMapOfEnumString($map_of_enum_string)
public function setMapOfEnumString(?array $map_of_enum_string): static
{
if (is_null($map_of_enum_string)) {
throw new \InvalidArgumentException('non-nullable map_of_enum_string cannot be null');
throw new InvalidArgumentException('non-nullable map_of_enum_string cannot be null');
}
$allowedValues = $this->getMapOfEnumStringAllowableValues();
if (array_diff($map_of_enum_string, $allowedValues)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"Invalid value for 'map_of_enum_string', must be one of '%s'",
implode("', '", $allowedValues)
@ -393,7 +393,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return array<string,bool>|null
*/
public function getDirectMap()
public function getDirectMap(): ?array
{
return $this->container['direct_map'];
}
@ -403,12 +403,12 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param array<string,bool>|null $direct_map direct_map
*
* @return self
* @return $this
*/
public function setDirectMap($direct_map)
public function setDirectMap(?array $direct_map): static
{
if (is_null($direct_map)) {
throw new \InvalidArgumentException('non-nullable direct_map cannot be null');
throw new InvalidArgumentException('non-nullable direct_map cannot be null');
}
$this->container['direct_map'] = $direct_map;
@ -420,7 +420,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return array<string,bool>|null
*/
public function getIndirectMap()
public function getIndirectMap(): ?array
{
return $this->container['indirect_map'];
}
@ -430,12 +430,12 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param array<string,bool>|null $indirect_map indirect_map
*
* @return self
* @return $this
*/
public function setIndirectMap($indirect_map)
public function setIndirectMap(?array $indirect_map): static
{
if (is_null($indirect_map)) {
throw new \InvalidArgumentException('non-nullable indirect_map cannot be null');
throw new InvalidArgumentException('non-nullable indirect_map cannot be null');
}
$this->container['indirect_map'] = $indirect_map;
@ -448,7 +448,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -460,8 +460,8 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -474,7 +474,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -490,7 +490,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -502,8 +502,8 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -513,7 +513,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -526,7 +526,7 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* MixedPropertiesAndAdditionalPropertiesClass Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSerializable
class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @var string
*/
protected static $openAPIModelName = 'MixedPropertiesAndAdditionalPropertiesClass';
protected static string $openAPIModelName = 'MixedPropertiesAndAdditionalPropertiesClass';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'uuid' => 'string',
'date_time' => '\DateTime',
'map' => 'array<string,\OpenAPI\Client\Model\Animal>'
@ -65,11 +68,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'uuid' => 'uuid',
'date_time' => 'date-time',
'map' => null
@ -78,7 +79,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'uuid' => false,
@ -89,16 +90,16 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -106,9 +107,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -116,7 +117,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -126,7 +127,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -136,7 +137,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -169,9 +170,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'uuid' => 'uuid',
'date_time' => 'dateTime',
'map' => 'map'
@ -180,9 +181,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'uuid' => 'setUuid',
'date_time' => 'setDateTime',
'map' => 'setMap'
@ -191,9 +192,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'uuid' => 'getUuid',
'date_time' => 'getDateTime',
'map' => 'getMap'
@ -203,9 +204,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -213,9 +214,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -223,9 +224,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -235,7 +236,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -244,15 +245,14 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -270,7 +270,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -282,9 +282,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -297,7 +297,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -308,7 +308,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @return string|null
*/
public function getUuid()
public function getUuid(): ?string
{
return $this->container['uuid'];
}
@ -318,12 +318,12 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @param string|null $uuid uuid
*
* @return self
* @return $this
*/
public function setUuid($uuid)
public function setUuid(?string $uuid): static
{
if (is_null($uuid)) {
throw new \InvalidArgumentException('non-nullable uuid cannot be null');
throw new InvalidArgumentException('non-nullable uuid cannot be null');
}
$this->container['uuid'] = $uuid;
@ -335,7 +335,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @return \DateTime|null
*/
public function getDateTime()
public function getDateTime(): ?\DateTime
{
return $this->container['date_time'];
}
@ -345,12 +345,12 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @param \DateTime|null $date_time date_time
*
* @return self
* @return $this
*/
public function setDateTime($date_time)
public function setDateTime(?\DateTime $date_time): static
{
if (is_null($date_time)) {
throw new \InvalidArgumentException('non-nullable date_time cannot be null');
throw new InvalidArgumentException('non-nullable date_time cannot be null');
}
$this->container['date_time'] = $date_time;
@ -362,7 +362,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @return array<string,\OpenAPI\Client\Model\Animal>|null
*/
public function getMap()
public function getMap(): ?array
{
return $this->container['map'];
}
@ -372,12 +372,12 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @param array<string,\OpenAPI\Client\Model\Animal>|null $map map
*
* @return self
* @return $this
*/
public function setMap($map)
public function setMap(?array $map): static
{
if (is_null($map)) {
throw new \InvalidArgumentException('non-nullable map cannot be null');
throw new InvalidArgumentException('non-nullable map cannot be null');
}
$this->container['map'] = $map;
@ -390,7 +390,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -402,8 +402,8 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -416,7 +416,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -432,7 +432,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -444,8 +444,8 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -455,7 +455,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -468,7 +468,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* Model200Response Class Doc Comment
@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
class Model200Response implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -50,14 +53,14 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = '200_response';
protected static string $openAPIModelName = '200_response';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'name' => 'int',
'class' => 'string'
];
@ -65,11 +68,9 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'name' => 'int32',
'class' => null
];
@ -77,7 +78,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'name' => false,
@ -87,16 +88,16 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -104,9 +105,9 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -114,7 +115,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -124,7 +125,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -134,7 +135,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -167,9 +168,9 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'name' => 'name',
'class' => 'class'
];
@ -177,9 +178,9 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'name' => 'setName',
'class' => 'setClass'
];
@ -187,9 +188,9 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'name' => 'getName',
'class' => 'getClass'
];
@ -198,9 +199,9 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -208,9 +209,9 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -218,9 +219,9 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -230,7 +231,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -239,15 +240,14 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -264,7 +264,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -276,9 +276,9 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -291,7 +291,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -302,7 +302,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getName()
public function getName(): ?int
{
return $this->container['name'];
}
@ -312,12 +312,12 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $name name
*
* @return self
* @return $this
*/
public function setName($name)
public function setName(?int $name): static
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
throw new InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
@ -329,7 +329,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getClass()
public function getClass(): ?string
{
return $this->container['class'];
}
@ -339,12 +339,12 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $class class
*
* @return self
* @return $this
*/
public function setClass($class)
public function setClass(?string $class): static
{
if (is_null($class)) {
throw new \InvalidArgumentException('non-nullable class cannot be null');
throw new InvalidArgumentException('non-nullable class cannot be null');
}
$this->container['class'] = $class;
@ -357,7 +357,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -369,8 +369,8 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -383,7 +383,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -399,7 +399,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -411,8 +411,8 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -422,7 +422,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -435,7 +435,7 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -41,49 +41,49 @@ interface ModelInterface
*
* @return string
*/
public function getModelName();
public function getModelName(): string;
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes();
public static function openAPITypes(): array;
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats();
public static function openAPIFormats(): array;
/**
* Array of attributes where the key is the local name, and the value is the original name
*
* @return array
*/
public static function attributeMap();
public static function attributeMap(): array;
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters();
public static function setters(): array;
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters();
public static function getters(): array;
/**
* Show all the invalid properties with reasons.
*
* @return array
*/
public function listInvalidProperties();
public function listInvalidProperties(): array;
/**
* Validate all the properties in the model
@ -91,7 +91,7 @@ interface ModelInterface
*
* @return bool
*/
public function valid();
public function valid(): bool;
/**
* Checks if a property is nullable

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* ModelList Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
class ModelList implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,32 +52,30 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'List';
protected static string $openAPIModelName = 'List';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'_123_list' => 'string'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'_123_list' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'_123_list' => false
@ -83,16 +84,16 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -100,9 +101,9 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -110,7 +111,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -120,7 +121,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -130,7 +131,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -163,27 +164,27 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'_123_list' => '123-list'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'_123_list' => 'set123List'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'_123_list' => 'get123List'
];
@ -191,9 +192,9 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -201,9 +202,9 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -211,9 +212,9 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -223,7 +224,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -232,15 +233,14 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -256,7 +256,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -268,9 +268,9 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -283,7 +283,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -294,7 +294,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function get123List()
public function get123List(): ?string
{
return $this->container['_123_list'];
}
@ -304,12 +304,12 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $_123_list _123_list
*
* @return self
* @return $this
*/
public function set123List($_123_list)
public function set123List(?string $_123_list): static
{
if (is_null($_123_list)) {
throw new \InvalidArgumentException('non-nullable _123_list cannot be null');
throw new InvalidArgumentException('non-nullable _123_list cannot be null');
}
$this->container['_123_list'] = $_123_list;
@ -322,7 +322,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -334,8 +334,8 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -348,7 +348,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -364,7 +364,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -376,8 +376,8 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -387,7 +387,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -400,7 +400,7 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* ModelReturn Class Doc Comment
@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
class ModelReturn implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -50,32 +53,30 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'Return';
protected static string $openAPIModelName = 'Return';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'return' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'return' => 'int32'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'return' => false
@ -84,16 +85,16 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -101,9 +102,9 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -111,7 +112,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -121,7 +122,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -131,7 +132,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -164,27 +165,27 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'return' => 'return'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'return' => 'setReturn'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'return' => 'getReturn'
];
@ -192,9 +193,9 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -202,9 +203,9 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -212,9 +213,9 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -224,7 +225,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -233,15 +234,14 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -257,7 +257,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -269,9 +269,9 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -284,7 +284,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -295,7 +295,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getReturn()
public function getReturn(): ?int
{
return $this->container['return'];
}
@ -305,12 +305,12 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $return return
*
* @return self
* @return $this
*/
public function setReturn($return)
public function setReturn(?int $return): static
{
if (is_null($return)) {
throw new \InvalidArgumentException('non-nullable return cannot be null');
throw new InvalidArgumentException('non-nullable return cannot be null');
}
$this->container['return'] = $return;
@ -323,7 +323,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -335,8 +335,8 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -349,7 +349,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -365,7 +365,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -377,8 +377,8 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -388,7 +388,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -401,7 +401,7 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* Name Class Doc Comment
@ -39,9 +42,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Name implements ModelInterface, ArrayAccess, \JsonSerializable
class Name implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -50,14 +53,14 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'Name';
protected static string $openAPIModelName = 'Name';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'name' => 'int',
'snake_case' => 'int',
'property' => 'string',
@ -67,11 +70,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'name' => 'int32',
'snake_case' => 'int32',
'property' => null,
@ -81,7 +82,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'name' => false,
@ -93,16 +94,16 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -110,9 +111,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -120,7 +121,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -130,7 +131,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -140,7 +141,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -173,9 +174,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'name' => 'name',
'snake_case' => 'snake_case',
'property' => 'property',
@ -185,9 +186,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'name' => 'setName',
'snake_case' => 'setSnakeCase',
'property' => 'setProperty',
@ -197,9 +198,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'name' => 'getName',
'snake_case' => 'getSnakeCase',
'property' => 'getProperty',
@ -210,9 +211,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -220,9 +221,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -230,9 +231,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -242,7 +243,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -251,15 +252,14 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -278,7 +278,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -290,9 +290,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -308,7 +308,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -319,7 +319,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int
*/
public function getName()
public function getName(): int
{
return $this->container['name'];
}
@ -329,12 +329,12 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int $name name
*
* @return self
* @return $this
*/
public function setName($name)
public function setName(int $name): static
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
throw new InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
@ -346,7 +346,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getSnakeCase()
public function getSnakeCase(): ?int
{
return $this->container['snake_case'];
}
@ -356,12 +356,12 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $snake_case snake_case
*
* @return self
* @return $this
*/
public function setSnakeCase($snake_case)
public function setSnakeCase(?int $snake_case): static
{
if (is_null($snake_case)) {
throw new \InvalidArgumentException('non-nullable snake_case cannot be null');
throw new InvalidArgumentException('non-nullable snake_case cannot be null');
}
$this->container['snake_case'] = $snake_case;
@ -373,7 +373,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getProperty()
public function getProperty(): ?string
{
return $this->container['property'];
}
@ -383,12 +383,12 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $property property
*
* @return self
* @return $this
*/
public function setProperty($property)
public function setProperty(?string $property): static
{
if (is_null($property)) {
throw new \InvalidArgumentException('non-nullable property cannot be null');
throw new InvalidArgumentException('non-nullable property cannot be null');
}
$this->container['property'] = $property;
@ -400,7 +400,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function get123Number()
public function get123Number(): ?int
{
return $this->container['_123_number'];
}
@ -410,12 +410,12 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $_123_number _123_number
*
* @return self
* @return $this
*/
public function set123Number($_123_number)
public function set123Number(?int $_123_number): static
{
if (is_null($_123_number)) {
throw new \InvalidArgumentException('non-nullable _123_number cannot be null');
throw new InvalidArgumentException('non-nullable _123_number cannot be null');
}
$this->container['_123_number'] = $_123_number;
@ -428,7 +428,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -440,8 +440,8 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -454,7 +454,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -470,7 +470,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -482,8 +482,8 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -493,7 +493,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -506,7 +506,7 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* NullableClass Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
class NullableClass implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'NullableClass';
protected static string $openAPIModelName = 'NullableClass';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'integer_prop' => 'int',
'number_prop' => 'float',
'boolean_prop' => 'bool',
@ -74,11 +77,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'integer_prop' => null,
'number_prop' => null,
'boolean_prop' => null,
@ -96,7 +97,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'integer_prop' => true,
@ -116,16 +117,16 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -133,9 +134,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -143,7 +144,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -153,7 +154,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -163,7 +164,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -196,9 +197,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'integer_prop' => 'integer_prop',
'number_prop' => 'number_prop',
'boolean_prop' => 'boolean_prop',
@ -216,9 +217,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'integer_prop' => 'setIntegerProp',
'number_prop' => 'setNumberProp',
'boolean_prop' => 'setBooleanProp',
@ -236,9 +237,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'integer_prop' => 'getIntegerProp',
'number_prop' => 'getNumberProp',
'boolean_prop' => 'getBooleanProp',
@ -257,9 +258,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -267,9 +268,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -277,9 +278,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -289,7 +290,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -298,15 +299,14 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -333,7 +333,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -345,9 +345,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -360,7 +360,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -371,7 +371,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getIntegerProp()
public function getIntegerProp(): ?int
{
return $this->container['integer_prop'];
}
@ -381,9 +381,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $integer_prop integer_prop
*
* @return self
* @return $this
*/
public function setIntegerProp($integer_prop)
public function setIntegerProp(?int $integer_prop): static
{
if (is_null($integer_prop)) {
array_push($this->openAPINullablesSetToNull, 'integer_prop');
@ -405,7 +405,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return float|null
*/
public function getNumberProp()
public function getNumberProp(): ?float
{
return $this->container['number_prop'];
}
@ -415,9 +415,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param float|null $number_prop number_prop
*
* @return self
* @return $this
*/
public function setNumberProp($number_prop)
public function setNumberProp(?float $number_prop): static
{
if (is_null($number_prop)) {
array_push($this->openAPINullablesSetToNull, 'number_prop');
@ -439,7 +439,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool|null
*/
public function getBooleanProp()
public function getBooleanProp(): ?bool
{
return $this->container['boolean_prop'];
}
@ -449,9 +449,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param bool|null $boolean_prop boolean_prop
*
* @return self
* @return $this
*/
public function setBooleanProp($boolean_prop)
public function setBooleanProp(?bool $boolean_prop): static
{
if (is_null($boolean_prop)) {
array_push($this->openAPINullablesSetToNull, 'boolean_prop');
@ -473,7 +473,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getStringProp()
public function getStringProp(): ?string
{
return $this->container['string_prop'];
}
@ -483,9 +483,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $string_prop string_prop
*
* @return self
* @return $this
*/
public function setStringProp($string_prop)
public function setStringProp(?string $string_prop): static
{
if (is_null($string_prop)) {
array_push($this->openAPINullablesSetToNull, 'string_prop');
@ -507,7 +507,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \DateTime|null
*/
public function getDateProp()
public function getDateProp(): ?\DateTime
{
return $this->container['date_prop'];
}
@ -517,9 +517,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \DateTime|null $date_prop date_prop
*
* @return self
* @return $this
*/
public function setDateProp($date_prop)
public function setDateProp(?\DateTime $date_prop): static
{
if (is_null($date_prop)) {
array_push($this->openAPINullablesSetToNull, 'date_prop');
@ -541,7 +541,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \DateTime|null
*/
public function getDatetimeProp()
public function getDatetimeProp(): ?\DateTime
{
return $this->container['datetime_prop'];
}
@ -551,9 +551,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \DateTime|null $datetime_prop datetime_prop
*
* @return self
* @return $this
*/
public function setDatetimeProp($datetime_prop)
public function setDatetimeProp(?\DateTime $datetime_prop): static
{
if (is_null($datetime_prop)) {
array_push($this->openAPINullablesSetToNull, 'datetime_prop');
@ -575,7 +575,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return object[]|null
*/
public function getArrayNullableProp()
public function getArrayNullableProp(): ?array
{
return $this->container['array_nullable_prop'];
}
@ -585,9 +585,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param object[]|null $array_nullable_prop array_nullable_prop
*
* @return self
* @return $this
*/
public function setArrayNullableProp($array_nullable_prop)
public function setArrayNullableProp(?array $array_nullable_prop): static
{
if (is_null($array_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'array_nullable_prop');
@ -609,7 +609,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return object[]|null
*/
public function getArrayAndItemsNullableProp()
public function getArrayAndItemsNullableProp(): ?array
{
return $this->container['array_and_items_nullable_prop'];
}
@ -619,9 +619,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param object[]|null $array_and_items_nullable_prop array_and_items_nullable_prop
*
* @return self
* @return $this
*/
public function setArrayAndItemsNullableProp($array_and_items_nullable_prop)
public function setArrayAndItemsNullableProp(?array $array_and_items_nullable_prop): static
{
if (is_null($array_and_items_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'array_and_items_nullable_prop');
@ -643,7 +643,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return object[]|null
*/
public function getArrayItemsNullable()
public function getArrayItemsNullable(): ?array
{
return $this->container['array_items_nullable'];
}
@ -653,12 +653,12 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param object[]|null $array_items_nullable array_items_nullable
*
* @return self
* @return $this
*/
public function setArrayItemsNullable($array_items_nullable)
public function setArrayItemsNullable(?array $array_items_nullable): static
{
if (is_null($array_items_nullable)) {
throw new \InvalidArgumentException('non-nullable array_items_nullable cannot be null');
throw new InvalidArgumentException('non-nullable array_items_nullable cannot be null');
}
$this->container['array_items_nullable'] = $array_items_nullable;
@ -670,7 +670,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return array<string,object>|null
*/
public function getObjectNullableProp()
public function getObjectNullableProp(): ?array
{
return $this->container['object_nullable_prop'];
}
@ -680,9 +680,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param array<string,object>|null $object_nullable_prop object_nullable_prop
*
* @return self
* @return $this
*/
public function setObjectNullableProp($object_nullable_prop)
public function setObjectNullableProp(?array $object_nullable_prop): static
{
if (is_null($object_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'object_nullable_prop');
@ -704,7 +704,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return array<string,object>|null
*/
public function getObjectAndItemsNullableProp()
public function getObjectAndItemsNullableProp(): ?array
{
return $this->container['object_and_items_nullable_prop'];
}
@ -714,9 +714,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param array<string,object>|null $object_and_items_nullable_prop object_and_items_nullable_prop
*
* @return self
* @return $this
*/
public function setObjectAndItemsNullableProp($object_and_items_nullable_prop)
public function setObjectAndItemsNullableProp(?array $object_and_items_nullable_prop): static
{
if (is_null($object_and_items_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'object_and_items_nullable_prop');
@ -738,7 +738,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return array<string,object>|null
*/
public function getObjectItemsNullable()
public function getObjectItemsNullable(): ?array
{
return $this->container['object_items_nullable'];
}
@ -748,12 +748,12 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param array<string,object>|null $object_items_nullable object_items_nullable
*
* @return self
* @return $this
*/
public function setObjectItemsNullable($object_items_nullable)
public function setObjectItemsNullable(?array $object_items_nullable): static
{
if (is_null($object_items_nullable)) {
throw new \InvalidArgumentException('non-nullable object_items_nullable cannot be null');
throw new InvalidArgumentException('non-nullable object_items_nullable cannot be null');
}
$this->container['object_items_nullable'] = $object_items_nullable;
@ -766,7 +766,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -778,8 +778,8 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -792,7 +792,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -808,7 +808,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -820,8 +820,8 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -831,7 +831,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -844,7 +844,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* NumberOnly Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
class NumberOnly implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,32 +52,30 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'NumberOnly';
protected static string $openAPIModelName = 'NumberOnly';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'just_number' => 'float'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'just_number' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'just_number' => false
@ -83,16 +84,16 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -100,9 +101,9 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -110,7 +111,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -120,7 +121,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -130,7 +131,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -163,27 +164,27 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'just_number' => 'JustNumber'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'just_number' => 'setJustNumber'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'just_number' => 'getJustNumber'
];
@ -191,9 +192,9 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -201,9 +202,9 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -211,9 +212,9 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -223,7 +224,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -232,15 +233,14 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -256,7 +256,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -268,9 +268,9 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -283,7 +283,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -294,7 +294,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return float|null
*/
public function getJustNumber()
public function getJustNumber(): ?float
{
return $this->container['just_number'];
}
@ -304,12 +304,12 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param float|null $just_number just_number
*
* @return self
* @return $this
*/
public function setJustNumber($just_number)
public function setJustNumber(?float $just_number): static
{
if (is_null($just_number)) {
throw new \InvalidArgumentException('non-nullable just_number cannot be null');
throw new InvalidArgumentException('non-nullable just_number cannot be null');
}
$this->container['just_number'] = $just_number;
@ -322,7 +322,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -334,8 +334,8 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -348,7 +348,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -364,7 +364,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -376,8 +376,8 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -387,7 +387,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -400,7 +400,7 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* ObjectWithDeprecatedFields Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSerializable
class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @var string
*/
protected static $openAPIModelName = 'ObjectWithDeprecatedFields';
protected static string $openAPIModelName = 'ObjectWithDeprecatedFields';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'uuid' => 'string',
'id' => 'float',
'deprecated_ref' => '\OpenAPI\Client\Model\DeprecatedObject',
@ -66,11 +69,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'uuid' => null,
'id' => null,
'deprecated_ref' => null,
@ -80,7 +81,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'uuid' => false,
@ -92,16 +93,16 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -109,9 +110,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -119,7 +120,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -129,7 +130,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -139,7 +140,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -172,9 +173,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'uuid' => 'uuid',
'id' => 'id',
'deprecated_ref' => 'deprecatedRef',
@ -184,9 +185,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'uuid' => 'setUuid',
'id' => 'setId',
'deprecated_ref' => 'setDeprecatedRef',
@ -196,9 +197,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'uuid' => 'getUuid',
'id' => 'getId',
'deprecated_ref' => 'getDeprecatedRef',
@ -209,9 +210,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -219,9 +220,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -229,9 +230,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -241,7 +242,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -250,15 +251,14 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -277,7 +277,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -289,9 +289,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -304,7 +304,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -315,7 +315,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @return string|null
*/
public function getUuid()
public function getUuid(): ?string
{
return $this->container['uuid'];
}
@ -325,12 +325,12 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @param string|null $uuid uuid
*
* @return self
* @return $this
*/
public function setUuid($uuid)
public function setUuid(?string $uuid): static
{
if (is_null($uuid)) {
throw new \InvalidArgumentException('non-nullable uuid cannot be null');
throw new InvalidArgumentException('non-nullable uuid cannot be null');
}
$this->container['uuid'] = $uuid;
@ -343,7 +343,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
* @return float|null
* @deprecated
*/
public function getId()
public function getId(): ?float
{
return $this->container['id'];
}
@ -353,13 +353,13 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @param float|null $id id
*
* @return self
* @return $this
* @deprecated
*/
public function setId($id)
public function setId(?float $id): static
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
throw new InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
@ -372,7 +372,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
* @return \OpenAPI\Client\Model\DeprecatedObject|null
* @deprecated
*/
public function getDeprecatedRef()
public function getDeprecatedRef(): ?\OpenAPI\Client\Model\DeprecatedObject
{
return $this->container['deprecated_ref'];
}
@ -382,13 +382,13 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @param \OpenAPI\Client\Model\DeprecatedObject|null $deprecated_ref deprecated_ref
*
* @return self
* @return $this
* @deprecated
*/
public function setDeprecatedRef($deprecated_ref)
public function setDeprecatedRef(?\OpenAPI\Client\Model\DeprecatedObject $deprecated_ref): static
{
if (is_null($deprecated_ref)) {
throw new \InvalidArgumentException('non-nullable deprecated_ref cannot be null');
throw new InvalidArgumentException('non-nullable deprecated_ref cannot be null');
}
$this->container['deprecated_ref'] = $deprecated_ref;
@ -401,7 +401,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
* @return string[]|null
* @deprecated
*/
public function getBars()
public function getBars(): ?array
{
return $this->container['bars'];
}
@ -411,13 +411,13 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @param string[]|null $bars bars
*
* @return self
* @return $this
* @deprecated
*/
public function setBars($bars)
public function setBars(?array $bars): static
{
if (is_null($bars)) {
throw new \InvalidArgumentException('non-nullable bars cannot be null');
throw new InvalidArgumentException('non-nullable bars cannot be null');
}
$this->container['bars'] = $bars;
@ -430,7 +430,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -442,8 +442,8 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -456,7 +456,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -472,7 +472,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -484,8 +484,8 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -495,7 +495,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -508,7 +508,7 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* Order Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Order implements ModelInterface, ArrayAccess, \JsonSerializable
class Order implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'Order';
protected static string $openAPIModelName = 'Order';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'id' => 'int',
'pet_id' => 'int',
'quantity' => 'int',
@ -68,11 +71,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'id' => 'int64',
'pet_id' => 'int64',
'quantity' => 'int32',
@ -84,7 +85,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'id' => false,
@ -98,16 +99,16 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -115,9 +116,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -125,7 +126,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -135,7 +136,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -145,7 +146,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -178,9 +179,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'id' => 'id',
'pet_id' => 'petId',
'quantity' => 'quantity',
@ -192,9 +193,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'id' => 'setId',
'pet_id' => 'setPetId',
'quantity' => 'setQuantity',
@ -206,9 +207,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'id' => 'getId',
'pet_id' => 'getPetId',
'quantity' => 'getQuantity',
@ -221,9 +222,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -231,9 +232,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -241,9 +242,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -253,7 +254,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -279,15 +280,14 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -308,7 +308,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -320,9 +320,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -344,7 +344,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -355,7 +355,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getId()
public function getId(): ?int
{
return $this->container['id'];
}
@ -365,12 +365,12 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $id id
*
* @return self
* @return $this
*/
public function setId($id)
public function setId(?int $id): static
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
throw new InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
@ -382,7 +382,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getPetId()
public function getPetId(): ?int
{
return $this->container['pet_id'];
}
@ -392,12 +392,12 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $pet_id pet_id
*
* @return self
* @return $this
*/
public function setPetId($pet_id)
public function setPetId(?int $pet_id): static
{
if (is_null($pet_id)) {
throw new \InvalidArgumentException('non-nullable pet_id cannot be null');
throw new InvalidArgumentException('non-nullable pet_id cannot be null');
}
$this->container['pet_id'] = $pet_id;
@ -409,7 +409,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getQuantity()
public function getQuantity(): ?int
{
return $this->container['quantity'];
}
@ -419,12 +419,12 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $quantity quantity
*
* @return self
* @return $this
*/
public function setQuantity($quantity)
public function setQuantity(?int $quantity): static
{
if (is_null($quantity)) {
throw new \InvalidArgumentException('non-nullable quantity cannot be null');
throw new InvalidArgumentException('non-nullable quantity cannot be null');
}
$this->container['quantity'] = $quantity;
@ -436,7 +436,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \DateTime|null
*/
public function getShipDate()
public function getShipDate(): ?\DateTime
{
return $this->container['ship_date'];
}
@ -446,12 +446,12 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \DateTime|null $ship_date ship_date
*
* @return self
* @return $this
*/
public function setShipDate($ship_date)
public function setShipDate(?\DateTime $ship_date): static
{
if (is_null($ship_date)) {
throw new \InvalidArgumentException('non-nullable ship_date cannot be null');
throw new InvalidArgumentException('non-nullable ship_date cannot be null');
}
$this->container['ship_date'] = $ship_date;
@ -463,7 +463,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getStatus()
public function getStatus(): ?string
{
return $this->container['status'];
}
@ -473,16 +473,16 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $status Order Status
*
* @return self
* @return $this
*/
public function setStatus($status)
public function setStatus(?string $status): static
{
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
throw new InvalidArgumentException('non-nullable status cannot be null');
}
$allowedValues = $this->getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
@ -500,7 +500,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool|null
*/
public function getComplete()
public function getComplete(): ?bool
{
return $this->container['complete'];
}
@ -510,12 +510,12 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param bool|null $complete complete
*
* @return self
* @return $this
*/
public function setComplete($complete)
public function setComplete(?bool $complete): static
{
if (is_null($complete)) {
throw new \InvalidArgumentException('non-nullable complete cannot be null');
throw new InvalidArgumentException('non-nullable complete cannot be null');
}
$this->container['complete'] = $complete;
@ -528,7 +528,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -540,8 +540,8 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -554,7 +554,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -570,7 +570,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -582,8 +582,8 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -593,7 +593,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -606,7 +606,7 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* OuterComposite Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
class OuterComposite implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'OuterComposite';
protected static string $openAPIModelName = 'OuterComposite';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'my_number' => 'float',
'my_string' => 'string',
'my_boolean' => 'bool'
@ -65,11 +68,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'my_number' => null,
'my_string' => null,
'my_boolean' => null
@ -78,7 +79,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'my_number' => false,
@ -89,16 +90,16 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -106,9 +107,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -116,7 +117,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -126,7 +127,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -136,7 +137,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -169,9 +170,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'my_number' => 'my_number',
'my_string' => 'my_string',
'my_boolean' => 'my_boolean'
@ -180,9 +181,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'my_number' => 'setMyNumber',
'my_string' => 'setMyString',
'my_boolean' => 'setMyBoolean'
@ -191,9 +192,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'my_number' => 'getMyNumber',
'my_string' => 'getMyString',
'my_boolean' => 'getMyBoolean'
@ -203,9 +204,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -213,9 +214,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -223,9 +224,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -235,7 +236,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -244,15 +245,14 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -270,7 +270,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -282,9 +282,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -297,7 +297,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -308,7 +308,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return float|null
*/
public function getMyNumber()
public function getMyNumber(): ?float
{
return $this->container['my_number'];
}
@ -318,12 +318,12 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param float|null $my_number my_number
*
* @return self
* @return $this
*/
public function setMyNumber($my_number)
public function setMyNumber(?float $my_number): static
{
if (is_null($my_number)) {
throw new \InvalidArgumentException('non-nullable my_number cannot be null');
throw new InvalidArgumentException('non-nullable my_number cannot be null');
}
$this->container['my_number'] = $my_number;
@ -335,7 +335,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getMyString()
public function getMyString(): ?string
{
return $this->container['my_string'];
}
@ -345,12 +345,12 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $my_string my_string
*
* @return self
* @return $this
*/
public function setMyString($my_string)
public function setMyString(?string $my_string): static
{
if (is_null($my_string)) {
throw new \InvalidArgumentException('non-nullable my_string cannot be null');
throw new InvalidArgumentException('non-nullable my_string cannot be null');
}
$this->container['my_string'] = $my_string;
@ -362,7 +362,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool|null
*/
public function getMyBoolean()
public function getMyBoolean(): ?bool
{
return $this->container['my_boolean'];
}
@ -372,12 +372,12 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param bool|null $my_boolean my_boolean
*
* @return self
* @return $this
*/
public function setMyBoolean($my_boolean)
public function setMyBoolean(?bool $my_boolean): static
{
if (is_null($my_boolean)) {
throw new \InvalidArgumentException('non-nullable my_boolean cannot be null');
throw new InvalidArgumentException('non-nullable my_boolean cannot be null');
}
$this->container['my_boolean'] = $my_boolean;
@ -390,7 +390,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -402,8 +402,8 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -416,7 +416,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -432,7 +432,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -444,8 +444,8 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -455,7 +455,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -468,7 +468,7 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -27,7 +27,6 @@
*/
namespace OpenAPI\Client\Model;
use \OpenAPI\Client\ObjectSerializer;
/**
* OuterEnum Class Doc Comment

View File

@ -27,7 +27,6 @@
*/
namespace OpenAPI\Client\Model;
use \OpenAPI\Client\ObjectSerializer;
/**
* OuterEnumDefaultValue Class Doc Comment

View File

@ -27,7 +27,6 @@
*/
namespace OpenAPI\Client\Model;
use \OpenAPI\Client\ObjectSerializer;
/**
* OuterEnumInteger Class Doc Comment

View File

@ -27,7 +27,6 @@
*/
namespace OpenAPI\Client\Model;
use \OpenAPI\Client\ObjectSerializer;
/**
* OuterEnumIntegerDefaultValue Class Doc Comment

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* OuterObjectWithEnumProperty Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonSerializable
class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,32 +52,30 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*
* @var string
*/
protected static $openAPIModelName = 'OuterObjectWithEnumProperty';
protected static string $openAPIModelName = 'OuterObjectWithEnumProperty';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'value' => '\OpenAPI\Client\Model\OuterEnumInteger'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'value' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'value' => false
@ -83,16 +84,16 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -100,9 +101,9 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -110,7 +111,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -120,7 +121,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -130,7 +131,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -163,27 +164,27 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'value' => 'value'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'value' => 'setValue'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'value' => 'getValue'
];
@ -191,9 +192,9 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -201,9 +202,9 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -211,9 +212,9 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -223,7 +224,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -232,15 +233,14 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -256,7 +256,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -268,9 +268,9 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -286,7 +286,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -297,7 +297,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*
* @return \OpenAPI\Client\Model\OuterEnumInteger
*/
public function getValue()
public function getValue(): \OpenAPI\Client\Model\OuterEnumInteger
{
return $this->container['value'];
}
@ -307,12 +307,12 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*
* @param \OpenAPI\Client\Model\OuterEnumInteger $value value
*
* @return self
* @return $this
*/
public function setValue($value)
public function setValue(\OpenAPI\Client\Model\OuterEnumInteger $value): static
{
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
throw new InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
@ -325,7 +325,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -337,8 +337,8 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -351,7 +351,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -367,7 +367,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -379,8 +379,8 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -390,7 +390,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -403,7 +403,7 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* Pet Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
class Pet implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'Pet';
protected static string $openAPIModelName = 'Pet';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'id' => 'int',
'category' => '\OpenAPI\Client\Model\Category',
'name' => 'string',
@ -68,11 +71,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'id' => 'int64',
'category' => null,
'name' => null,
@ -84,7 +85,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'id' => false,
@ -98,16 +99,16 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -115,9 +116,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -125,7 +126,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -135,7 +136,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -145,7 +146,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -178,9 +179,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'id' => 'id',
'category' => 'category',
'name' => 'name',
@ -192,9 +193,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'id' => 'setId',
'category' => 'setCategory',
'name' => 'setName',
@ -206,9 +207,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'id' => 'getId',
'category' => 'getCategory',
'name' => 'getName',
@ -221,9 +222,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -231,9 +232,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -241,9 +242,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -253,7 +254,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -279,15 +280,14 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -308,7 +308,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -320,9 +320,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -350,7 +350,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -361,7 +361,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getId()
public function getId(): ?int
{
return $this->container['id'];
}
@ -371,12 +371,12 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $id id
*
* @return self
* @return $this
*/
public function setId($id)
public function setId(?int $id): static
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
throw new InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
@ -388,7 +388,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \OpenAPI\Client\Model\Category|null
*/
public function getCategory()
public function getCategory(): ?\OpenAPI\Client\Model\Category
{
return $this->container['category'];
}
@ -398,12 +398,12 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \OpenAPI\Client\Model\Category|null $category category
*
* @return self
* @return $this
*/
public function setCategory($category)
public function setCategory(?\OpenAPI\Client\Model\Category $category): static
{
if (is_null($category)) {
throw new \InvalidArgumentException('non-nullable category cannot be null');
throw new InvalidArgumentException('non-nullable category cannot be null');
}
$this->container['category'] = $category;
@ -415,7 +415,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getName()
public function getName(): string
{
return $this->container['name'];
}
@ -425,12 +425,12 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string $name name
*
* @return self
* @return $this
*/
public function setName($name)
public function setName(string $name): static
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
throw new InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
@ -442,7 +442,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string[]
*/
public function getPhotoUrls()
public function getPhotoUrls(): array
{
return $this->container['photo_urls'];
}
@ -452,12 +452,12 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string[] $photo_urls photo_urls
*
* @return self
* @return $this
*/
public function setPhotoUrls($photo_urls)
public function setPhotoUrls(array $photo_urls): static
{
if (is_null($photo_urls)) {
throw new \InvalidArgumentException('non-nullable photo_urls cannot be null');
throw new InvalidArgumentException('non-nullable photo_urls cannot be null');
}
@ -471,7 +471,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return \OpenAPI\Client\Model\Tag[]|null
*/
public function getTags()
public function getTags(): ?array
{
return $this->container['tags'];
}
@ -481,12 +481,12 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param \OpenAPI\Client\Model\Tag[]|null $tags tags
*
* @return self
* @return $this
*/
public function setTags($tags)
public function setTags(?array $tags): static
{
if (is_null($tags)) {
throw new \InvalidArgumentException('non-nullable tags cannot be null');
throw new InvalidArgumentException('non-nullable tags cannot be null');
}
$this->container['tags'] = $tags;
@ -498,7 +498,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getStatus()
public function getStatus(): ?string
{
return $this->container['status'];
}
@ -508,16 +508,16 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $status pet status in the store
*
* @return self
* @return $this
*/
public function setStatus($status)
public function setStatus(?string $status): static
{
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
throw new InvalidArgumentException('non-nullable status cannot be null');
}
$allowedValues = $this->getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
@ -536,7 +536,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -548,8 +548,8 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -562,7 +562,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -578,7 +578,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -590,8 +590,8 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -601,7 +601,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -614,7 +614,7 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* ReadOnlyFirst Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
class ReadOnlyFirst implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'ReadOnlyFirst';
protected static string $openAPIModelName = 'ReadOnlyFirst';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'bar' => 'string',
'baz' => 'string'
];
@ -64,11 +67,9 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'bar' => null,
'baz' => null
];
@ -76,7 +77,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'bar' => false,
@ -86,16 +87,16 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -103,9 +104,9 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -113,7 +114,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -123,7 +124,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -133,7 +134,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -166,9 +167,9 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'bar' => 'bar',
'baz' => 'baz'
];
@ -176,9 +177,9 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'bar' => 'setBar',
'baz' => 'setBaz'
];
@ -186,9 +187,9 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'bar' => 'getBar',
'baz' => 'getBaz'
];
@ -197,9 +198,9 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -207,9 +208,9 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -217,9 +218,9 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -229,7 +230,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -238,15 +239,14 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -263,7 +263,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -275,9 +275,9 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -290,7 +290,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -301,7 +301,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getBar()
public function getBar(): ?string
{
return $this->container['bar'];
}
@ -311,12 +311,12 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $bar bar
*
* @return self
* @return $this
*/
public function setBar($bar)
public function setBar(?string $bar): static
{
if (is_null($bar)) {
throw new \InvalidArgumentException('non-nullable bar cannot be null');
throw new InvalidArgumentException('non-nullable bar cannot be null');
}
$this->container['bar'] = $bar;
@ -328,7 +328,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getBaz()
public function getBaz(): ?string
{
return $this->container['baz'];
}
@ -338,12 +338,12 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $baz baz
*
* @return self
* @return $this
*/
public function setBaz($baz)
public function setBaz(?string $baz): static
{
if (is_null($baz)) {
throw new \InvalidArgumentException('non-nullable baz cannot be null');
throw new InvalidArgumentException('non-nullable baz cannot be null');
}
$this->container['baz'] = $baz;
@ -356,7 +356,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -368,8 +368,8 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -382,7 +382,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -398,7 +398,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -410,8 +410,8 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -421,7 +421,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -434,7 +434,7 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -27,7 +27,6 @@
*/
namespace OpenAPI\Client\Model;
use \OpenAPI\Client\ObjectSerializer;
/**
* SingleRefType Class Doc Comment

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* SpecialModelName Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
class SpecialModelName implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,32 +52,30 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = '_special_model.name_';
protected static string $openAPIModelName = '_special_model.name_';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'special_property_name' => 'int'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'special_property_name' => 'int64'
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'special_property_name' => false
@ -83,16 +84,16 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -100,9 +101,9 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -110,7 +111,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -120,7 +121,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -130,7 +131,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -163,27 +164,27 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'special_property_name' => '$special[property.name]'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'special_property_name' => 'setSpecialPropertyName'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'special_property_name' => 'getSpecialPropertyName'
];
@ -191,9 +192,9 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -201,9 +202,9 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -211,9 +212,9 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -223,7 +224,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -232,15 +233,14 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -256,7 +256,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -268,9 +268,9 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -283,7 +283,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -294,7 +294,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getSpecialPropertyName()
public function getSpecialPropertyName(): ?int
{
return $this->container['special_property_name'];
}
@ -304,12 +304,12 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $special_property_name special_property_name
*
* @return self
* @return $this
*/
public function setSpecialPropertyName($special_property_name)
public function setSpecialPropertyName(?int $special_property_name): static
{
if (is_null($special_property_name)) {
throw new \InvalidArgumentException('non-nullable special_property_name cannot be null');
throw new InvalidArgumentException('non-nullable special_property_name cannot be null');
}
$this->container['special_property_name'] = $special_property_name;
@ -322,7 +322,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -334,8 +334,8 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -348,7 +348,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -364,7 +364,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -376,8 +376,8 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -387,7 +387,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -400,7 +400,7 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* Tag Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
class Tag implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'Tag';
protected static string $openAPIModelName = 'Tag';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'id' => 'int',
'name' => 'string'
];
@ -64,11 +67,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'id' => 'int64',
'name' => null
];
@ -76,7 +77,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'id' => false,
@ -86,16 +87,16 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -103,9 +104,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -113,7 +114,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -123,7 +124,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -133,7 +134,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -166,9 +167,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'id' => 'id',
'name' => 'name'
];
@ -176,9 +177,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'id' => 'setId',
'name' => 'setName'
];
@ -186,9 +187,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'id' => 'getId',
'name' => 'getName'
];
@ -197,9 +198,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -207,9 +208,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -217,9 +218,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -229,7 +230,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -238,15 +239,14 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -263,7 +263,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -275,9 +275,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -290,7 +290,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -301,7 +301,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getId()
public function getId(): ?int
{
return $this->container['id'];
}
@ -311,12 +311,12 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $id id
*
* @return self
* @return $this
*/
public function setId($id)
public function setId(?int $id): static
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
throw new InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
@ -328,7 +328,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getName()
public function getName(): ?string
{
return $this->container['name'];
}
@ -338,12 +338,12 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $name name
*
* @return self
* @return $this
*/
public function setName($name)
public function setName(?string $name): static
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
throw new InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
@ -356,7 +356,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -368,8 +368,8 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -382,7 +382,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -398,7 +398,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -410,8 +410,8 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -421,7 +421,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -434,7 +434,7 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,8 +28,11 @@
namespace OpenAPI\Client\Model;
use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;
use ArrayAccess;
use JsonSerializable;
use InvalidArgumentException;
use ReturnTypeWillChange;
use OpenAPI\Client\ObjectSerializer;
/**
* User Class Doc Comment
@ -38,9 +41,9 @@ use \OpenAPI\Client\ObjectSerializer;
* @package OpenAPI\Client
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
* @implements ArrayAccess<string, mixed>
*/
class User implements ModelInterface, ArrayAccess, \JsonSerializable
class User implements ModelInterface, ArrayAccess, JsonSerializable
{
public const DISCRIMINATOR = null;
@ -49,14 +52,14 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @var string
*/
protected static $openAPIModelName = 'User';
protected static string $openAPIModelName = 'User';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
* @var array<string, string>
*/
protected static $openAPITypes = [
protected static array $openAPITypes = [
'id' => 'int',
'username' => 'string',
'first_name' => 'string',
@ -70,11 +73,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
* @var array<string, string|null>
*/
protected static $openAPIFormats = [
protected static array $openAPIFormats = [
'id' => 'int64',
'username' => null,
'first_name' => null,
@ -88,7 +89,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
* @var array<string, bool>
*/
protected static array $openAPINullables = [
'id' => false,
@ -104,16 +105,16 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
* @var array<string, bool>
*/
protected array $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPITypes()
public static function openAPITypes(): array
{
return self::$openAPITypes;
}
@ -121,9 +122,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
* @return array<string, string>
*/
public static function openAPIFormats()
public static function openAPIFormats(): array
{
return self::$openAPIFormats;
}
@ -131,7 +132,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable properties
*
* @return array
* @return array<string, bool>
*/
protected static function openAPINullables(): array
{
@ -141,7 +142,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
* @return array<string, bool>
*/
private function getOpenAPINullablesSetToNull(): array
{
@ -151,7 +152,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
* @param array<string, bool> $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
@ -184,9 +185,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
* @var array<string, string>
*/
protected static $attributeMap = [
protected static array $attributeMap = [
'id' => 'id',
'username' => 'username',
'first_name' => 'firstName',
@ -200,9 +201,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
* @var array<string, string>
*/
protected static $setters = [
protected static array $setters = [
'id' => 'setId',
'username' => 'setUsername',
'first_name' => 'setFirstName',
@ -216,9 +217,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
* @var array<string, string>
*/
protected static $getters = [
protected static array $getters = [
'id' => 'getId',
'username' => 'getUsername',
'first_name' => 'getFirstName',
@ -233,9 +234,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
* @return array<string, string>
*/
public static function attributeMap()
public static function attributeMap(): array
{
return self::$attributeMap;
}
@ -243,9 +244,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
* @return array<string, string>
*/
public static function setters()
public static function setters(): array
{
return self::$setters;
}
@ -253,9 +254,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
* @return array<string, string>
*/
public static function getters()
public static function getters(): array
{
return self::$getters;
}
@ -265,7 +266,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function getModelName()
public function getModelName(): string
{
return self::$openAPIModelName;
}
@ -274,15 +275,14 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Associative array for storing property values
*
* @var mixed[]
* @var array
*/
protected $container = [];
protected array $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
* @param array $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
@ -305,7 +305,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
@ -317,9 +317,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
* @return string[] invalid properties with reasons
*/
public function listInvalidProperties()
public function listInvalidProperties(): array
{
$invalidProperties = [];
@ -332,7 +332,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return bool True if all properties are valid
*/
public function valid()
public function valid(): bool
{
return count($this->listInvalidProperties()) === 0;
}
@ -343,7 +343,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getId()
public function getId(): ?int
{
return $this->container['id'];
}
@ -353,12 +353,12 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $id id
*
* @return self
* @return $this
*/
public function setId($id)
public function setId(?int $id): static
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
throw new InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
@ -370,7 +370,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getUsername()
public function getUsername(): ?string
{
return $this->container['username'];
}
@ -380,12 +380,12 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $username username
*
* @return self
* @return $this
*/
public function setUsername($username)
public function setUsername(?string $username): static
{
if (is_null($username)) {
throw new \InvalidArgumentException('non-nullable username cannot be null');
throw new InvalidArgumentException('non-nullable username cannot be null');
}
$this->container['username'] = $username;
@ -397,7 +397,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getFirstName()
public function getFirstName(): ?string
{
return $this->container['first_name'];
}
@ -407,12 +407,12 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $first_name first_name
*
* @return self
* @return $this
*/
public function setFirstName($first_name)
public function setFirstName(?string $first_name): static
{
if (is_null($first_name)) {
throw new \InvalidArgumentException('non-nullable first_name cannot be null');
throw new InvalidArgumentException('non-nullable first_name cannot be null');
}
$this->container['first_name'] = $first_name;
@ -424,7 +424,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getLastName()
public function getLastName(): ?string
{
return $this->container['last_name'];
}
@ -434,12 +434,12 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $last_name last_name
*
* @return self
* @return $this
*/
public function setLastName($last_name)
public function setLastName(?string $last_name): static
{
if (is_null($last_name)) {
throw new \InvalidArgumentException('non-nullable last_name cannot be null');
throw new InvalidArgumentException('non-nullable last_name cannot be null');
}
$this->container['last_name'] = $last_name;
@ -451,7 +451,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getEmail()
public function getEmail(): ?string
{
return $this->container['email'];
}
@ -461,12 +461,12 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $email email
*
* @return self
* @return $this
*/
public function setEmail($email)
public function setEmail(?string $email): static
{
if (is_null($email)) {
throw new \InvalidArgumentException('non-nullable email cannot be null');
throw new InvalidArgumentException('non-nullable email cannot be null');
}
$this->container['email'] = $email;
@ -478,7 +478,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getPassword()
public function getPassword(): ?string
{
return $this->container['password'];
}
@ -488,12 +488,12 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $password password
*
* @return self
* @return $this
*/
public function setPassword($password)
public function setPassword(?string $password): static
{
if (is_null($password)) {
throw new \InvalidArgumentException('non-nullable password cannot be null');
throw new InvalidArgumentException('non-nullable password cannot be null');
}
$this->container['password'] = $password;
@ -505,7 +505,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string|null
*/
public function getPhone()
public function getPhone(): ?string
{
return $this->container['phone'];
}
@ -515,12 +515,12 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param string|null $phone phone
*
* @return self
* @return $this
*/
public function setPhone($phone)
public function setPhone(?string $phone): static
{
if (is_null($phone)) {
throw new \InvalidArgumentException('non-nullable phone cannot be null');
throw new InvalidArgumentException('non-nullable phone cannot be null');
}
$this->container['phone'] = $phone;
@ -532,7 +532,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return int|null
*/
public function getUserStatus()
public function getUserStatus(): ?int
{
return $this->container['user_status'];
}
@ -542,12 +542,12 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @param int|null $user_status User Status
*
* @return self
* @return $this
*/
public function setUserStatus($user_status)
public function setUserStatus(?int $user_status): static
{
if (is_null($user_status)) {
throw new \InvalidArgumentException('non-nullable user_status cannot be null');
throw new InvalidArgumentException('non-nullable user_status cannot be null');
}
$this->container['user_status'] = $user_status;
@ -560,7 +560,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return boolean
*/
public function offsetExists($offset): bool
public function offsetExists(mixed $offset): bool
{
return isset($this->container[$offset]);
}
@ -572,8 +572,8 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
#[ReturnTypeWillChange]
public function offsetGet(mixed $offset): mixed
{
return $this->container[$offset] ?? null;
}
@ -586,7 +586,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetSet($offset, $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
@ -602,7 +602,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return void
*/
public function offsetUnset($offset): void
public function offsetUnset(mixed $offset): void
{
unset($this->container[$offset]);
}
@ -614,8 +614,8 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
#[ReturnTypeWillChange]
public function jsonSerialize(): mixed
{
return ObjectSerializer::sanitizeForSerialization($this);
}
@ -625,7 +625,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
@ -638,7 +638,7 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*
* @return string
*/
public function toHeaderValue()
public function toHeaderValue(): string
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}

View File

@ -28,6 +28,8 @@
namespace OpenAPI\Client;
use DateTimeInterface;
use DateTime;
use GuzzleHttp\Psr7\Utils;
use OpenAPI\Client\Model\ModelInterface;
@ -42,14 +44,16 @@ use OpenAPI\Client\Model\ModelInterface;
class ObjectSerializer
{
/** @var string */
private static $dateTimeFormat = \DateTime::ATOM;
private static string $dateTimeFormat = DateTimeInterface::ATOM;
/**
* Change the date format
*
* @param string $format the new date format to use
*
* @return void
*/
public static function setDateTimeFormat($format)
public static function setDateTimeFormat(string $format): void
{
self::$dateTimeFormat = $format;
}
@ -58,18 +62,18 @@ class ObjectSerializer
* Serialize data
*
* @param mixed $data the data to serialize
* @param string $type the OpenAPIToolsType of the data
* @param string $format the format of the OpenAPITools type of the data
* @param string|null $type the OpenAPIToolsType of the data
* @param string|null $format the format of the OpenAPITools type of the data
*
* @return scalar|object|array|null serialized form of $data
*/
public static function sanitizeForSerialization($data, $type = null, $format = null)
public static function sanitizeForSerialization(mixed $data, string $type = null, string $format = null): mixed
{
if (is_scalar($data) || null === $data) {
return $data;
}
if ($data instanceof \DateTime) {
if ($data instanceof DateTime) {
return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat);
}
@ -119,7 +123,7 @@ class ObjectSerializer
*
* @return string the sanitized filename
*/
public static function sanitizeFilename($filename)
public static function sanitizeFilename(string $filename): string
{
if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) {
return $match[1];
@ -135,10 +139,8 @@ class ObjectSerializer
*
* @return string the shorten timestamp
*/
public static function sanitizeTimestamp($timestamp)
public static function sanitizeTimestamp(string $timestamp): string
{
if (!is_string($timestamp)) return $timestamp;
return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp);
}
@ -150,7 +152,7 @@ class ObjectSerializer
*
* @return string the serialized object
*/
public static function toPathValue($value)
public static function toPathValue(string $value): string
{
return rawurlencode(self::toString($value));
}
@ -163,7 +165,7 @@ class ObjectSerializer
*
* @return bool true if $value is empty
*/
private static function isEmptyValue($value, string $openApiType): bool
private static function isEmptyValue(mixed $value, string $openApiType): bool
{
# If empty() returns false, it is not empty regardless of its type.
if (!empty($value)) {
@ -175,27 +177,19 @@ class ObjectSerializer
return true;
}
switch ($openApiType) {
return match ($openApiType) {
# For numeric values, false and '' are considered empty.
# This comparison is safe for floating point values, since the previous call to empty() will
# filter out values that don't match 0.
case 'int':
case 'integer':
return $value !== 0;
case 'number':
case 'float':
return $value !== 0 && $value !== 0.0;
'int','integer' => $value !== 0,
'number'|'float' => $value !== 0 && $value !== 0.0,
# For boolean values, '' is considered empty
case 'bool':
case 'boolean':
return !in_array($value, [false, 0], true);
'bool','boolean' => !in_array($value, [false, 0], true),
# For all the other types, any value at this point can be considered empty.
default:
return true;
}
default => true
};
}
/**
@ -204,7 +198,7 @@ class ObjectSerializer
*
* @param mixed $value Parameter value
* @param string $paramName Parameter name
* @param string $openApiType OpenAPIType eg. array or object
* @param string $openApiType OpenAPIType e.g. array or object
* @param string $style Parameter serialization style
* @param bool $explode Parameter explode option
* @param bool $required Whether query param is required or not
@ -212,7 +206,7 @@ class ObjectSerializer
* @return array
*/
public static function toQueryValue(
$value,
mixed $value,
string $paramName,
string $openApiType = 'string',
string $style = 'form',
@ -233,7 +227,7 @@ class ObjectSerializer
}
# Handle DateTime objects in query
if($openApiType === "\\DateTime" && $value instanceof \DateTime) {
if($openApiType === "\DateTime" && $value instanceof DateTime) {
return ["{$paramName}" => $value->format(self::$dateTimeFormat)];
}
@ -246,7 +240,7 @@ class ObjectSerializer
if (!is_array($arr)) return $arr;
foreach ($arr as $k => $v) {
$prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k;
$prop = ($style === 'deepObject') ? "{$name}[{$k}]" : $k;
if (is_array($v)) {
$flattenArray($v, $prop, $result);
@ -284,7 +278,7 @@ class ObjectSerializer
*
* @return int|string Boolean value in format
*/
public static function convertBoolToQueryStringFormat(bool $value)
public static function convertBoolToQueryStringFormat(bool $value): int|string
{
if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) {
return $value ? 'true' : 'false';
@ -302,7 +296,7 @@ class ObjectSerializer
*
* @return string the header string
*/
public static function toHeaderValue($value)
public static function toHeaderValue(string $value): string
{
$callable = [$value, 'toHeaderValue'];
if (is_callable($callable)) {
@ -321,7 +315,7 @@ class ObjectSerializer
*
* @return string the form string
*/
public static function toFormValue($value)
public static function toFormValue(string|\SplFileObject $value): string
{
if ($value instanceof \SplFileObject) {
return $value->getRealPath();
@ -336,13 +330,13 @@ class ObjectSerializer
* If it's a datetime object, format it in ISO8601
* If it's a boolean, convert it to "true" or "false".
*
* @param string|bool|\DateTime $value the value of the parameter
* @param string|bool|DateTime $value the value of the parameter
*
* @return string the header string
*/
public static function toString($value)
public static function toString(string|bool|DateTime $value): string
{
if ($value instanceof \DateTime) { // datetime in ISO8601 format
if ($value instanceof DateTime) { // datetime in ISO8601 format
return $value->format(self::$dateTimeFormat);
} elseif (is_bool($value)) {
return $value ? 'true' : 'false';
@ -361,31 +355,19 @@ class ObjectSerializer
*
* @return string
*/
public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false)
public static function serializeCollection(array $collection, string $style, bool $allowCollectionFormatMulti = false): string
{
if ($allowCollectionFormatMulti && ('multi' === $style)) {
// http_build_query() almost does the job for us. We just
// need to fix the result of multidimensional arrays.
return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&'));
}
switch ($style) {
case 'pipeDelimited':
case 'pipes':
return implode('|', $collection);
case 'tsv':
return implode("\t", $collection);
case 'spaceDelimited':
case 'ssv':
return implode(' ', $collection);
case 'simple':
case 'csv':
// Deliberate fall through. CSV is default format.
default:
return implode(',', $collection);
}
return match ($style) {
'pipeDelimited', 'pipes' => implode('|', $collection),
'tsv' => implode("\t", $collection),
'spaceDelimited', 'ssv' => implode(' ', $collection),
default => implode(',', $collection),
};
}
/**
@ -393,12 +375,12 @@ class ObjectSerializer
*
* @param mixed $data object or primitive to be deserialized
* @param string $class class name is passed as a string
* @param string[] $httpHeaders HTTP headers
* @param string $discriminator discriminator if polymorphism is used
* @param string[]|null $httpHeaders HTTP headers
* @param string|null $discriminator discriminator if polymorphism is used
*
* @return object|array|null a single or an array of $class instances
*/
public static function deserialize($data, $class, $httpHeaders = null)
public static function deserialize(mixed $data, string $class, string $httpHeaders = null): object|array|null
{
if (null === $data) {
return null;
@ -442,7 +424,7 @@ class ObjectSerializer
return $data;
}
if ($class === '\DateTime') {
if ($class === 'DateTime') {
// Some APIs return an invalid, empty string as a
// date-time property. DateTime::__construct() will return
// the current time for empty input which is probably not
@ -451,12 +433,12 @@ class ObjectSerializer
// this graceful.
if (!empty($data)) {
try {
return new \DateTime($data);
return new DateTime($data);
} catch (\Exception $exception) {
// Some APIs return a date-time with too high nanosecond
// precision for php's DateTime to handle.
// With provided regexp 6 digits of microseconds saved
return new \DateTime(self::sanitizeTimestamp($data));
return new DateTime(self::sanitizeTimestamp($data));
}
} else {
return null;
@ -556,7 +538,7 @@ class ObjectSerializer
* @return string
*/
public static function buildQuery(
$data,
array|object $data,
string $numeric_prefix = '',
?string $arg_separator = null,
int $encoding_type = \PHP_QUERY_RFC3986