[#13998][Bug][PHP] Move isNullable section to the top of the setter function in templates (#14005)

* Move isNullable section to the top

* Manage extra lines
This commit is contained in:
Mustansir Soni 2022-11-21 15:18:36 +09:00 committed by GitHub
parent 903ff0ba47
commit a96777b6f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 147 additions and 397 deletions

View File

@ -387,66 +387,6 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
*/
public function {{setter}}(${{name}})
{
{{#isEnum}}
$allowedValues = $this->{{getter}}AllowableValues();
{{^isContainer}}
if ({{^required}}!is_null(${{name}}) && {{/required}}!in_array(${{{name}}}, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for '{{name}}', must be one of '%s'",
${{{name}}},
implode("', '", $allowedValues)
)
);
}
{{/isContainer}}
{{#isContainer}}
if ({{^required}}!is_null(${{name}}) && {{/required}}array_diff(${{{name}}}, $allowedValues)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for '{{name}}', must be one of '%s'",
implode("', '", $allowedValues)
)
);
}
{{/isContainer}}
{{/isEnum}}
{{#hasValidation}}
{{#maxLength}}
if ({{^required}}!is_null(${{name}}) && {{/required}}(mb_strlen(${{name}}) > {{maxLength}})) {
throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.');
}{{/maxLength}}
{{#minLength}}
if ({{^required}}!is_null(${{name}}) && {{/required}}(mb_strlen(${{name}}) < {{minLength}})) {
throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.');
}
{{/minLength}}
{{#maximum}}
if ({{^required}}!is_null(${{name}}) && {{/required}}(${{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}}.');
}
{{/maximum}}
{{#minimum}}
if ({{^required}}!is_null(${{name}}) && {{/required}}(${{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}}.');
}
{{/minimum}}
{{#pattern}}
if ({{^required}}!is_null(${{name}}) && {{/required}}(!preg_match("{{{pattern}}}", ${{name}}))) {
throw new \InvalidArgumentException("invalid value for \${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.");
}
{{/pattern}}
{{#maxItems}}
if ({{^required}}!is_null(${{name}}) && {{/required}}(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}}.');
}{{/maxItems}}
{{#minItems}}
if ({{^required}}!is_null(${{name}}) && {{/required}}(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}}.');
}
{{/minItems}}
{{/hasValidation}}
{{#isNullable}}
if (is_null(${{name}})) {
array_push($this->openAPINullablesSetToNull, '{{name}}');
@ -464,7 +404,65 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
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(
sprintf(
"Invalid value '%s' for '{{name}}', must be one of '%s'",
${{{name}}},
implode("', '", $allowedValues)
)
);
}
{{/isContainer}}
{{#isContainer}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}array_diff(${{{name}}}, $allowedValues)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for '{{name}}', must be one of '%s'",
implode("', '", $allowedValues)
)
);
}
{{/isContainer}}
{{/isEnum}}
{{#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}}.');
}{{/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}}.');
}
{{/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}}.');
}
{{/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}}.');
}
{{/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}}}.");
}
{{/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}}.');
}{{/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}}.');
}
{{/minItems}}
{{/hasValidation}}
$this->container['{{name}}'] = ${{name}};
return $this;

View File

@ -315,11 +315,9 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*/
public function setMapProperty($map_property)
{
if (is_null($map_property)) {
throw new \InvalidArgumentException('non-nullable map_property cannot be null');
}
$this->container['map_property'] = $map_property;
return $this;
@ -344,11 +342,9 @@ class AdditionalPropertiesClass implements ModelInterface, ArrayAccess, \JsonSer
*/
public function setMapOfMapProperty($map_of_map_property)
{
if (is_null($map_of_map_property)) {
throw new \InvalidArgumentException('non-nullable map_of_map_property cannot be null');
}
$this->container['map_of_map_property'] = $map_of_map_property;
return $this;

View File

@ -315,11 +315,9 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*/
public function setUsername($username)
{
if (is_null($username)) {
throw new \InvalidArgumentException('non-nullable username cannot be null');
}
$this->container['username'] = $username;
return $this;
@ -344,11 +342,9 @@ class AllOfWithSingleRef implements ModelInterface, ArrayAccess, \JsonSerializab
*/
public function setSingleRefType($single_ref_type)
{
if (is_null($single_ref_type)) {
throw new \InvalidArgumentException('non-nullable single_ref_type cannot be null');
}
$this->container['single_ref_type'] = $single_ref_type;
return $this;

View File

@ -321,11 +321,9 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setClassName($class_name)
{
if (is_null($class_name)) {
throw new \InvalidArgumentException('non-nullable class_name cannot be null');
}
$this->container['class_name'] = $class_name;
return $this;
@ -350,11 +348,9 @@ class Animal implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setColor($color)
{
if (is_null($color)) {
throw new \InvalidArgumentException('non-nullable color cannot be null');
}
$this->container['color'] = $color;
return $this;

View File

@ -322,11 +322,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setCode($code)
{
if (is_null($code)) {
throw new \InvalidArgumentException('non-nullable code cannot be null');
}
$this->container['code'] = $code;
return $this;
@ -351,11 +349,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setType($type)
{
if (is_null($type)) {
throw new \InvalidArgumentException('non-nullable type cannot be null');
}
$this->container['type'] = $type;
return $this;
@ -380,11 +376,9 @@ class ApiResponse implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setMessage($message)
{
if (is_null($message)) {
throw new \InvalidArgumentException('non-nullable message cannot be null');
}
$this->container['message'] = $message;
return $this;

View File

@ -308,11 +308,9 @@ class ArrayOfArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSeri
*/
public function setArrayArrayNumber($array_array_number)
{
if (is_null($array_array_number)) {
throw new \InvalidArgumentException('non-nullable array_array_number cannot be null');
}
$this->container['array_array_number'] = $array_array_number;
return $this;

View File

@ -308,11 +308,9 @@ class ArrayOfNumberOnly implements ModelInterface, ArrayAccess, \JsonSerializabl
*/
public function setArrayNumber($array_number)
{
if (is_null($array_number)) {
throw new \InvalidArgumentException('non-nullable array_number cannot be null');
}
$this->container['array_number'] = $array_number;
return $this;

View File

@ -330,18 +330,16 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setArrayOfString($array_of_string)
{
if (!is_null($array_of_string) && (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.');
}
if (!is_null($array_of_string) && (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.');
}
if (is_null($array_of_string)) {
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.');
}
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.');
}
$this->container['array_of_string'] = $array_of_string;
return $this;
@ -366,11 +364,9 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setArrayArrayOfInteger($array_array_of_integer)
{
if (is_null($array_array_of_integer)) {
throw new \InvalidArgumentException('non-nullable array_array_of_integer cannot be null');
}
$this->container['array_array_of_integer'] = $array_array_of_integer;
return $this;
@ -395,11 +391,9 @@ class ArrayTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setArrayArrayOfModel($array_array_of_model)
{
if (is_null($array_array_of_model)) {
throw new \InvalidArgumentException('non-nullable array_array_of_model cannot be null');
}
$this->container['array_array_of_model'] = $array_array_of_model;
return $this;

View File

@ -343,11 +343,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setSmallCamel($small_camel)
{
if (is_null($small_camel)) {
throw new \InvalidArgumentException('non-nullable small_camel cannot be null');
}
$this->container['small_camel'] = $small_camel;
return $this;
@ -372,11 +370,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setCapitalCamel($capital_camel)
{
if (is_null($capital_camel)) {
throw new \InvalidArgumentException('non-nullable capital_camel cannot be null');
}
$this->container['capital_camel'] = $capital_camel;
return $this;
@ -401,11 +397,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setSmallSnake($small_snake)
{
if (is_null($small_snake)) {
throw new \InvalidArgumentException('non-nullable small_snake cannot be null');
}
$this->container['small_snake'] = $small_snake;
return $this;
@ -430,11 +424,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setCapitalSnake($capital_snake)
{
if (is_null($capital_snake)) {
throw new \InvalidArgumentException('non-nullable capital_snake cannot be null');
}
$this->container['capital_snake'] = $capital_snake;
return $this;
@ -459,11 +451,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setScaEthFlowPoints($sca_eth_flow_points)
{
if (is_null($sca_eth_flow_points)) {
throw new \InvalidArgumentException('non-nullable sca_eth_flow_points cannot be null');
}
$this->container['sca_eth_flow_points'] = $sca_eth_flow_points;
return $this;
@ -488,11 +478,9 @@ class Capitalization implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setAttName($att_name)
{
if (is_null($att_name)) {
throw new \InvalidArgumentException('non-nullable att_name cannot be null');
}
$this->container['att_name'] = $att_name;
return $this;

View File

@ -302,11 +302,9 @@ class Cat extends Animal
*/
public function setDeclawed($declawed)
{
if (is_null($declawed)) {
throw new \InvalidArgumentException('non-nullable declawed cannot be null');
}
$this->container['declawed'] = $declawed;
return $this;

View File

@ -308,11 +308,9 @@ class CatAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setDeclawed($declawed)
{
if (is_null($declawed)) {
throw new \InvalidArgumentException('non-nullable declawed cannot be null');
}
$this->container['declawed'] = $declawed;
return $this;

View File

@ -318,11 +318,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
@ -347,11 +345,9 @@ class Category implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;

View File

@ -309,11 +309,9 @@ class ClassModel implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setClass($_class)
{
if (is_null($_class)) {
throw new \InvalidArgumentException('non-nullable _class cannot be null');
}
$this->container['_class'] = $_class;
return $this;

View File

@ -308,11 +308,9 @@ class Client implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setClient($client)
{
if (is_null($client)) {
throw new \InvalidArgumentException('non-nullable client cannot be null');
}
$this->container['client'] = $client;
return $this;

View File

@ -308,11 +308,9 @@ class DeprecatedObject implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;

View File

@ -302,11 +302,9 @@ class Dog extends Animal
*/
public function setBreed($breed)
{
if (is_null($breed)) {
throw new \InvalidArgumentException('non-nullable breed cannot be null');
}
$this->container['breed'] = $breed;
return $this;

View File

@ -308,11 +308,9 @@ class DogAllOf implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setBreed($breed)
{
if (is_null($breed)) {
throw new \InvalidArgumentException('non-nullable breed cannot be null');
}
$this->container['breed'] = $breed;
return $this;

View File

@ -354,8 +354,11 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setJustSymbol($just_symbol)
{
if (is_null($just_symbol)) {
throw new \InvalidArgumentException('non-nullable just_symbol cannot be null');
}
$allowedValues = $this->getJustSymbolAllowableValues();
if (!is_null($just_symbol) && !in_array($just_symbol, $allowedValues, true)) {
if (!in_array($just_symbol, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'just_symbol', must be one of '%s'",
@ -364,11 +367,6 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
)
);
}
if (is_null($just_symbol)) {
throw new \InvalidArgumentException('non-nullable just_symbol cannot be null');
}
$this->container['just_symbol'] = $just_symbol;
return $this;
@ -393,8 +391,11 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setArrayEnum($array_enum)
{
if (is_null($array_enum)) {
throw new \InvalidArgumentException('non-nullable array_enum cannot be null');
}
$allowedValues = $this->getArrayEnumAllowableValues();
if (!is_null($array_enum) && array_diff($array_enum, $allowedValues)) {
if (array_diff($array_enum, $allowedValues)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for 'array_enum', must be one of '%s'",
@ -402,11 +403,6 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
)
);
}
if (is_null($array_enum)) {
throw new \InvalidArgumentException('non-nullable array_enum cannot be null');
}
$this->container['array_enum'] = $array_enum;
return $this;

View File

@ -460,8 +460,11 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setEnumString($enum_string)
{
if (is_null($enum_string)) {
throw new \InvalidArgumentException('non-nullable enum_string cannot be null');
}
$allowedValues = $this->getEnumStringAllowableValues();
if (!is_null($enum_string) && !in_array($enum_string, $allowedValues, true)) {
if (!in_array($enum_string, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'enum_string', must be one of '%s'",
@ -470,11 +473,6 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
)
);
}
if (is_null($enum_string)) {
throw new \InvalidArgumentException('non-nullable enum_string cannot be null');
}
$this->container['enum_string'] = $enum_string;
return $this;
@ -499,6 +497,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setEnumStringRequired($enum_string_required)
{
if (is_null($enum_string_required)) {
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(
@ -509,11 +510,6 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
)
);
}
if (is_null($enum_string_required)) {
throw new \InvalidArgumentException('non-nullable enum_string_required cannot be null');
}
$this->container['enum_string_required'] = $enum_string_required;
return $this;
@ -538,8 +534,11 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setEnumInteger($enum_integer)
{
if (is_null($enum_integer)) {
throw new \InvalidArgumentException('non-nullable enum_integer cannot be null');
}
$allowedValues = $this->getEnumIntegerAllowableValues();
if (!is_null($enum_integer) && !in_array($enum_integer, $allowedValues, true)) {
if (!in_array($enum_integer, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'enum_integer', must be one of '%s'",
@ -548,11 +547,6 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
)
);
}
if (is_null($enum_integer)) {
throw new \InvalidArgumentException('non-nullable enum_integer cannot be null');
}
$this->container['enum_integer'] = $enum_integer;
return $this;
@ -577,8 +571,11 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setEnumNumber($enum_number)
{
if (is_null($enum_number)) {
throw new \InvalidArgumentException('non-nullable enum_number cannot be null');
}
$allowedValues = $this->getEnumNumberAllowableValues();
if (!is_null($enum_number) && !in_array($enum_number, $allowedValues, true)) {
if (!in_array($enum_number, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'enum_number', must be one of '%s'",
@ -587,11 +584,6 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
)
);
}
if (is_null($enum_number)) {
throw new \InvalidArgumentException('non-nullable enum_number cannot be null');
}
$this->container['enum_number'] = $enum_number;
return $this;
@ -616,7 +608,6 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setOuterEnum($outer_enum)
{
if (is_null($outer_enum)) {
array_push($this->openAPINullablesSetToNull, 'outer_enum');
} else {
@ -627,7 +618,6 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['outer_enum'] = $outer_enum;
return $this;
@ -652,11 +642,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setOuterEnumInteger($outer_enum_integer)
{
if (is_null($outer_enum_integer)) {
throw new \InvalidArgumentException('non-nullable outer_enum_integer cannot be null');
}
$this->container['outer_enum_integer'] = $outer_enum_integer;
return $this;
@ -681,11 +669,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setOuterEnumDefaultValue($outer_enum_default_value)
{
if (is_null($outer_enum_default_value)) {
throw new \InvalidArgumentException('non-nullable outer_enum_default_value cannot be null');
}
$this->container['outer_enum_default_value'] = $outer_enum_default_value;
return $this;
@ -710,11 +696,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setOuterEnumIntegerDefaultValue($outer_enum_integer_default_value)
{
if (is_null($outer_enum_integer_default_value)) {
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;
return $this;

View File

@ -309,11 +309,9 @@ class File implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setSourceUri($source_uri)
{
if (is_null($source_uri)) {
throw new \InvalidArgumentException('non-nullable source_uri cannot be null');
}
$this->container['source_uri'] = $source_uri;
return $this;

View File

@ -315,11 +315,9 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*/
public function setFile($file)
{
if (is_null($file)) {
throw new \InvalidArgumentException('non-nullable file cannot be null');
}
$this->container['file'] = $file;
return $this;
@ -344,11 +342,9 @@ class FileSchemaTestClass implements ModelInterface, ArrayAccess, \JsonSerializa
*/
public function setFiles($files)
{
if (is_null($files)) {
throw new \InvalidArgumentException('non-nullable files cannot be null');
}
$this->container['files'] = $files;
return $this;

View File

@ -308,11 +308,9 @@ class Foo implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setBar($bar)
{
if (is_null($bar)) {
throw new \InvalidArgumentException('non-nullable bar cannot be null');
}
$this->container['bar'] = $bar;
return $this;

View File

@ -308,11 +308,9 @@ class FooGetDefaultResponse implements ModelInterface, ArrayAccess, \JsonSeriali
*/
public function setString($string)
{
if (is_null($string)) {
throw new \InvalidArgumentException('non-nullable string cannot be null');
}
$this->container['string'] = $string;
return $this;

View File

@ -485,19 +485,17 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setInteger($integer)
{
if (!is_null($integer) && ($integer > 100)) {
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be smaller than or equal to 100.');
}
if (!is_null($integer) && ($integer < 10)) {
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.');
}
if (is_null($integer)) {
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.');
}
if (($integer < 10)) {
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.');
}
$this->container['integer'] = $integer;
return $this;
@ -522,19 +520,17 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setInt32($int32)
{
if (!is_null($int32) && ($int32 > 200)) {
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be smaller than or equal to 200.');
}
if (!is_null($int32) && ($int32 < 20)) {
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.');
}
if (is_null($int32)) {
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.');
}
if (($int32 < 20)) {
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.');
}
$this->container['int32'] = $int32;
return $this;
@ -559,11 +555,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setInt64($int64)
{
if (is_null($int64)) {
throw new \InvalidArgumentException('non-nullable int64 cannot be null');
}
$this->container['int64'] = $int64;
return $this;
@ -588,6 +582,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setNumber($number)
{
if (is_null($number)) {
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.');
@ -596,11 +593,6 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be bigger than or equal to 32.1.');
}
if (is_null($number)) {
throw new \InvalidArgumentException('non-nullable number cannot be null');
}
$this->container['number'] = $number;
return $this;
@ -625,19 +617,17 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setFloat($float)
{
if (!is_null($float) && ($float > 987.6)) {
throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be smaller than or equal to 987.6.');
}
if (!is_null($float) && ($float < 54.3)) {
throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be bigger than or equal to 54.3.');
}
if (is_null($float)) {
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.');
}
if (($float < 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;
return $this;
@ -662,19 +652,17 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setDouble($double)
{
if (!is_null($double) && ($double > 123.4)) {
throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be smaller than or equal to 123.4.');
}
if (!is_null($double) && ($double < 67.8)) {
throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be bigger than or equal to 67.8.');
}
if (is_null($double)) {
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.');
}
if (($double < 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;
return $this;
@ -699,11 +687,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setDecimal($decimal)
{
if (is_null($decimal)) {
throw new \InvalidArgumentException('non-nullable decimal cannot be null');
}
$this->container['decimal'] = $decimal;
return $this;
@ -728,16 +714,14 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setString($string)
{
if (!is_null($string) && (!preg_match("/[a-z]/i", $string))) {
throw new \InvalidArgumentException("invalid value for \$string when calling FormatTest., must conform to the pattern /[a-z]/i.");
}
if (is_null($string)) {
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.");
}
$this->container['string'] = $string;
return $this;
@ -762,11 +746,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setByte($byte)
{
if (is_null($byte)) {
throw new \InvalidArgumentException('non-nullable byte cannot be null');
}
$this->container['byte'] = $byte;
return $this;
@ -791,11 +773,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setBinary($binary)
{
if (is_null($binary)) {
throw new \InvalidArgumentException('non-nullable binary cannot be null');
}
$this->container['binary'] = $binary;
return $this;
@ -820,11 +800,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setDate($date)
{
if (is_null($date)) {
throw new \InvalidArgumentException('non-nullable date cannot be null');
}
$this->container['date'] = $date;
return $this;
@ -849,11 +827,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setDateTime($date_time)
{
if (is_null($date_time)) {
throw new \InvalidArgumentException('non-nullable date_time cannot be null');
}
$this->container['date_time'] = $date_time;
return $this;
@ -878,11 +854,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setUuid($uuid)
{
if (is_null($uuid)) {
throw new \InvalidArgumentException('non-nullable uuid cannot be null');
}
$this->container['uuid'] = $uuid;
return $this;
@ -907,6 +881,9 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setPassword($password)
{
if (is_null($password)) {
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.');
}
@ -914,11 +891,6 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be bigger than or equal to 10.');
}
if (is_null($password)) {
throw new \InvalidArgumentException('non-nullable password cannot be null');
}
$this->container['password'] = $password;
return $this;
@ -943,16 +915,14 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setPatternWithDigits($pattern_with_digits)
{
if (!is_null($pattern_with_digits) && (!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}$/.");
}
if (is_null($pattern_with_digits)) {
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}$/.");
}
$this->container['pattern_with_digits'] = $pattern_with_digits;
return $this;
@ -977,16 +947,14 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setPatternWithDigitsAndDelimiter($pattern_with_digits_and_delimiter)
{
if (!is_null($pattern_with_digits_and_delimiter) && (!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.");
}
if (is_null($pattern_with_digits_and_delimiter)) {
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.");
}
$this->container['pattern_with_digits_and_delimiter'] = $pattern_with_digits_and_delimiter;
return $this;

View File

@ -315,11 +315,9 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setBar($bar)
{
if (is_null($bar)) {
throw new \InvalidArgumentException('non-nullable bar cannot be null');
}
$this->container['bar'] = $bar;
return $this;
@ -344,11 +342,9 @@ class HasOnlyReadOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setFoo($foo)
{
if (is_null($foo)) {
throw new \InvalidArgumentException('non-nullable foo cannot be null');
}
$this->container['foo'] = $foo;
return $this;

View File

@ -309,7 +309,6 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
*/
public function setNullableMessage($nullable_message)
{
if (is_null($nullable_message)) {
array_push($this->openAPINullablesSetToNull, 'nullable_message');
} else {
@ -320,7 +319,6 @@ class HealthCheckResult implements ModelInterface, ArrayAccess, \JsonSerializabl
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['nullable_message'] = $nullable_message;
return $this;

View File

@ -344,11 +344,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setMapMapOfString($map_map_of_string)
{
if (is_null($map_map_of_string)) {
throw new \InvalidArgumentException('non-nullable map_map_of_string cannot be null');
}
$this->container['map_map_of_string'] = $map_map_of_string;
return $this;
@ -373,8 +371,11 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setMapOfEnumString($map_of_enum_string)
{
if (is_null($map_of_enum_string)) {
throw new \InvalidArgumentException('non-nullable map_of_enum_string cannot be null');
}
$allowedValues = $this->getMapOfEnumStringAllowableValues();
if (!is_null($map_of_enum_string) && array_diff($map_of_enum_string, $allowedValues)) {
if (array_diff($map_of_enum_string, $allowedValues)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value for 'map_of_enum_string', must be one of '%s'",
@ -382,11 +383,6 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
)
);
}
if (is_null($map_of_enum_string)) {
throw new \InvalidArgumentException('non-nullable map_of_enum_string cannot be null');
}
$this->container['map_of_enum_string'] = $map_of_enum_string;
return $this;
@ -411,11 +407,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setDirectMap($direct_map)
{
if (is_null($direct_map)) {
throw new \InvalidArgumentException('non-nullable direct_map cannot be null');
}
$this->container['direct_map'] = $direct_map;
return $this;
@ -440,11 +434,9 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setIndirectMap($indirect_map)
{
if (is_null($indirect_map)) {
throw new \InvalidArgumentException('non-nullable indirect_map cannot be null');
}
$this->container['indirect_map'] = $indirect_map;
return $this;

View File

@ -322,11 +322,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*/
public function setUuid($uuid)
{
if (is_null($uuid)) {
throw new \InvalidArgumentException('non-nullable uuid cannot be null');
}
$this->container['uuid'] = $uuid;
return $this;
@ -351,11 +349,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*/
public function setDateTime($date_time)
{
if (is_null($date_time)) {
throw new \InvalidArgumentException('non-nullable date_time cannot be null');
}
$this->container['date_time'] = $date_time;
return $this;
@ -380,11 +376,9 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ModelInterface, Arr
*/
public function setMap($map)
{
if (is_null($map)) {
throw new \InvalidArgumentException('non-nullable map cannot be null');
}
$this->container['map'] = $map;
return $this;

View File

@ -316,11 +316,9 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
@ -345,11 +343,9 @@ class Model200Response implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setClass($class)
{
if (is_null($class)) {
throw new \InvalidArgumentException('non-nullable class cannot be null');
}
$this->container['class'] = $class;
return $this;

View File

@ -308,11 +308,9 @@ class ModelList implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function set123List($_123_list)
{
if (is_null($_123_list)) {
throw new \InvalidArgumentException('non-nullable _123_list cannot be null');
}
$this->container['_123_list'] = $_123_list;
return $this;

View File

@ -309,11 +309,9 @@ class ModelReturn implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setReturn($return)
{
if (is_null($return)) {
throw new \InvalidArgumentException('non-nullable return cannot be null');
}
$this->container['return'] = $return;
return $this;

View File

@ -333,11 +333,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
@ -362,11 +360,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setSnakeCase($snake_case)
{
if (is_null($snake_case)) {
throw new \InvalidArgumentException('non-nullable snake_case cannot be null');
}
$this->container['snake_case'] = $snake_case;
return $this;
@ -391,11 +387,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setProperty($property)
{
if (is_null($property)) {
throw new \InvalidArgumentException('non-nullable property cannot be null');
}
$this->container['property'] = $property;
return $this;
@ -420,11 +414,9 @@ class Name implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function set123Number($_123_number)
{
if (is_null($_123_number)) {
throw new \InvalidArgumentException('non-nullable _123_number cannot be null');
}
$this->container['_123_number'] = $_123_number;
return $this;

View File

@ -385,7 +385,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setIntegerProp($integer_prop)
{
if (is_null($integer_prop)) {
array_push($this->openAPINullablesSetToNull, 'integer_prop');
} else {
@ -396,7 +395,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['integer_prop'] = $integer_prop;
return $this;
@ -421,7 +419,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setNumberProp($number_prop)
{
if (is_null($number_prop)) {
array_push($this->openAPINullablesSetToNull, 'number_prop');
} else {
@ -432,7 +429,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['number_prop'] = $number_prop;
return $this;
@ -457,7 +453,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setBooleanProp($boolean_prop)
{
if (is_null($boolean_prop)) {
array_push($this->openAPINullablesSetToNull, 'boolean_prop');
} else {
@ -468,7 +463,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['boolean_prop'] = $boolean_prop;
return $this;
@ -493,7 +487,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setStringProp($string_prop)
{
if (is_null($string_prop)) {
array_push($this->openAPINullablesSetToNull, 'string_prop');
} else {
@ -504,7 +497,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['string_prop'] = $string_prop;
return $this;
@ -529,7 +521,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setDateProp($date_prop)
{
if (is_null($date_prop)) {
array_push($this->openAPINullablesSetToNull, 'date_prop');
} else {
@ -540,7 +531,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['date_prop'] = $date_prop;
return $this;
@ -565,7 +555,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setDatetimeProp($datetime_prop)
{
if (is_null($datetime_prop)) {
array_push($this->openAPINullablesSetToNull, 'datetime_prop');
} else {
@ -576,7 +565,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['datetime_prop'] = $datetime_prop;
return $this;
@ -601,7 +589,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setArrayNullableProp($array_nullable_prop)
{
if (is_null($array_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'array_nullable_prop');
} else {
@ -612,7 +599,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['array_nullable_prop'] = $array_nullable_prop;
return $this;
@ -637,7 +623,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setArrayAndItemsNullableProp($array_and_items_nullable_prop)
{
if (is_null($array_and_items_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'array_and_items_nullable_prop');
} else {
@ -648,7 +633,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['array_and_items_nullable_prop'] = $array_and_items_nullable_prop;
return $this;
@ -673,11 +657,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setArrayItemsNullable($array_items_nullable)
{
if (is_null($array_items_nullable)) {
throw new \InvalidArgumentException('non-nullable array_items_nullable cannot be null');
}
$this->container['array_items_nullable'] = $array_items_nullable;
return $this;
@ -702,7 +684,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setObjectNullableProp($object_nullable_prop)
{
if (is_null($object_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'object_nullable_prop');
} else {
@ -713,7 +694,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['object_nullable_prop'] = $object_nullable_prop;
return $this;
@ -738,7 +718,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setObjectAndItemsNullableProp($object_and_items_nullable_prop)
{
if (is_null($object_and_items_nullable_prop)) {
array_push($this->openAPINullablesSetToNull, 'object_and_items_nullable_prop');
} else {
@ -749,7 +728,6 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
$this->container['object_and_items_nullable_prop'] = $object_and_items_nullable_prop;
return $this;
@ -774,11 +752,9 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setObjectItemsNullable($object_items_nullable)
{
if (is_null($object_items_nullable)) {
throw new \InvalidArgumentException('non-nullable object_items_nullable cannot be null');
}
$this->container['object_items_nullable'] = $object_items_nullable;
return $this;

View File

@ -308,11 +308,9 @@ class NumberOnly implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setJustNumber($just_number)
{
if (is_null($just_number)) {
throw new \InvalidArgumentException('non-nullable just_number cannot be null');
}
$this->container['just_number'] = $just_number;
return $this;

View File

@ -329,11 +329,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*/
public function setUuid($uuid)
{
if (is_null($uuid)) {
throw new \InvalidArgumentException('non-nullable uuid cannot be null');
}
$this->container['uuid'] = $uuid;
return $this;
@ -360,11 +358,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
@ -391,11 +387,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*/
public function setDeprecatedRef($deprecated_ref)
{
if (is_null($deprecated_ref)) {
throw new \InvalidArgumentException('non-nullable deprecated_ref cannot be null');
}
$this->container['deprecated_ref'] = $deprecated_ref;
return $this;
@ -422,11 +416,9 @@ class ObjectWithDeprecatedFields implements ModelInterface, ArrayAccess, \JsonSe
*/
public function setBars($bars)
{
if (is_null($bars)) {
throw new \InvalidArgumentException('non-nullable bars cannot be null');
}
$this->container['bars'] = $bars;
return $this;

View File

@ -369,11 +369,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
@ -398,11 +396,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setPetId($pet_id)
{
if (is_null($pet_id)) {
throw new \InvalidArgumentException('non-nullable pet_id cannot be null');
}
$this->container['pet_id'] = $pet_id;
return $this;
@ -427,11 +423,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setQuantity($quantity)
{
if (is_null($quantity)) {
throw new \InvalidArgumentException('non-nullable quantity cannot be null');
}
$this->container['quantity'] = $quantity;
return $this;
@ -456,11 +450,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setShipDate($ship_date)
{
if (is_null($ship_date)) {
throw new \InvalidArgumentException('non-nullable ship_date cannot be null');
}
$this->container['ship_date'] = $ship_date;
return $this;
@ -485,8 +477,11 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setStatus($status)
{
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($status) && !in_array($status, $allowedValues, true)) {
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
@ -495,11 +490,6 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
)
);
}
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$this->container['status'] = $status;
return $this;
@ -524,11 +514,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setComplete($complete)
{
if (is_null($complete)) {
throw new \InvalidArgumentException('non-nullable complete cannot be null');
}
$this->container['complete'] = $complete;
return $this;

View File

@ -322,11 +322,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setMyNumber($my_number)
{
if (is_null($my_number)) {
throw new \InvalidArgumentException('non-nullable my_number cannot be null');
}
$this->container['my_number'] = $my_number;
return $this;
@ -351,11 +349,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setMyString($my_string)
{
if (is_null($my_string)) {
throw new \InvalidArgumentException('non-nullable my_string cannot be null');
}
$this->container['my_string'] = $my_string;
return $this;
@ -380,11 +376,9 @@ class OuterComposite implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setMyBoolean($my_boolean)
{
if (is_null($my_boolean)) {
throw new \InvalidArgumentException('non-nullable my_boolean cannot be null');
}
$this->container['my_boolean'] = $my_boolean;
return $this;

View File

@ -311,11 +311,9 @@ class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonS
*/
public function setValue($value)
{
if (is_null($value)) {
throw new \InvalidArgumentException('non-nullable value cannot be null');
}
$this->container['value'] = $value;
return $this;

View File

@ -375,11 +375,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
@ -404,11 +402,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setCategory($category)
{
if (is_null($category)) {
throw new \InvalidArgumentException('non-nullable category cannot be null');
}
$this->container['category'] = $category;
return $this;
@ -433,11 +429,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;
@ -462,13 +456,11 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setPhotoUrls($photo_urls)
{
if (is_null($photo_urls)) {
throw new \InvalidArgumentException('non-nullable photo_urls cannot be null');
}
$this->container['photo_urls'] = $photo_urls;
return $this;
@ -493,11 +485,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setTags($tags)
{
if (is_null($tags)) {
throw new \InvalidArgumentException('non-nullable tags cannot be null');
}
$this->container['tags'] = $tags;
return $this;
@ -522,8 +512,11 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setStatus($status)
{
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($status) && !in_array($status, $allowedValues, true)) {
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
@ -532,11 +525,6 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
)
);
}
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$this->container['status'] = $status;
return $this;

View File

@ -315,11 +315,9 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setBar($bar)
{
if (is_null($bar)) {
throw new \InvalidArgumentException('non-nullable bar cannot be null');
}
$this->container['bar'] = $bar;
return $this;
@ -344,11 +342,9 @@ class ReadOnlyFirst implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setBaz($baz)
{
if (is_null($baz)) {
throw new \InvalidArgumentException('non-nullable baz cannot be null');
}
$this->container['baz'] = $baz;
return $this;

View File

@ -308,11 +308,9 @@ class SpecialModelName implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setSpecialPropertyName($special_property_name)
{
if (is_null($special_property_name)) {
throw new \InvalidArgumentException('non-nullable special_property_name cannot be null');
}
$this->container['special_property_name'] = $special_property_name;
return $this;

View File

@ -315,11 +315,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
@ -344,11 +342,9 @@ class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setName($name)
{
if (is_null($name)) {
throw new \InvalidArgumentException('non-nullable name cannot be null');
}
$this->container['name'] = $name;
return $this;

View File

@ -357,11 +357,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
@ -386,11 +384,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setUsername($username)
{
if (is_null($username)) {
throw new \InvalidArgumentException('non-nullable username cannot be null');
}
$this->container['username'] = $username;
return $this;
@ -415,11 +411,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setFirstName($first_name)
{
if (is_null($first_name)) {
throw new \InvalidArgumentException('non-nullable first_name cannot be null');
}
$this->container['first_name'] = $first_name;
return $this;
@ -444,11 +438,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setLastName($last_name)
{
if (is_null($last_name)) {
throw new \InvalidArgumentException('non-nullable last_name cannot be null');
}
$this->container['last_name'] = $last_name;
return $this;
@ -473,11 +465,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setEmail($email)
{
if (is_null($email)) {
throw new \InvalidArgumentException('non-nullable email cannot be null');
}
$this->container['email'] = $email;
return $this;
@ -502,11 +492,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setPassword($password)
{
if (is_null($password)) {
throw new \InvalidArgumentException('non-nullable password cannot be null');
}
$this->container['password'] = $password;
return $this;
@ -531,11 +519,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setPhone($phone)
{
if (is_null($phone)) {
throw new \InvalidArgumentException('non-nullable phone cannot be null');
}
$this->container['phone'] = $phone;
return $this;
@ -560,11 +546,9 @@ class User implements ModelInterface, ArrayAccess, \JsonSerializable
*/
public function setUserStatus($user_status)
{
if (is_null($user_status)) {
throw new \InvalidArgumentException('non-nullable user_status cannot be null');
}
$this->container['user_status'] = $user_status;
return $this;