diff --git a/modules/openapi-generator/src/main/resources/php/model_generic.mustache b/modules/openapi-generator/src/main/resources/php/model_generic.mustache index 97bb1d93201c..b4eb47f5fbab 100644 --- a/modules/openapi-generator/src/main/resources/php/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/php/model_generic.mustache @@ -387,10 +387,27 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par */ public function {{setter}}(${{name}}) { + {{#isNullable}} + if (is_null(${{name}})) { + array_push($this->openAPINullablesSetToNull, '{{name}}'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('{{name}}', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + {{/isNullable}} + {{^isNullable}} + if (is_null(${{name}})) { + throw new \InvalidArgumentException('non-nullable {{name}} cannot be null'); + } + {{/isNullable}} {{#isEnum}} $allowedValues = $this->{{getter}}AllowableValues(); {{^isContainer}} - if ({{^required}}!is_null(${{name}}) && {{/required}}!in_array(${{{name}}}, $allowedValues, true)) { + 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'", @@ -401,7 +418,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par } {{/isContainer}} {{#isContainer}} - if ({{^required}}!is_null(${{name}}) && {{/required}}array_diff(${{{name}}}, $allowedValues)) { + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}array_diff(${{{name}}}, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for '{{name}}', must be one of '%s'", @@ -413,58 +430,39 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par {{/isEnum}} {{#hasValidation}} {{#maxLength}} - if ({{^required}}!is_null(${{name}}) && {{/required}}(mb_strlen(${{name}}) > {{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 ({{^required}}!is_null(${{name}}) && {{/required}}(mb_strlen(${{name}}) < {{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 ({{^required}}!is_null(${{name}}) && {{/required}}(${{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{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 ({{^required}}!is_null(${{name}}) && {{/required}}(${{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{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 ({{^required}}!is_null(${{name}}) && {{/required}}(!preg_match("{{{pattern}}}", ${{name}}))) { + 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 ({{^required}}!is_null(${{name}}) && {{/required}}(count(${{name}}) > {{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 ({{^required}}!is_null(${{name}}) && {{/required}}(count(${{name}}) < {{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}} - - {{#isNullable}} - if (is_null(${{name}})) { - array_push($this->openAPINullablesSetToNull, '{{name}}'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('{{name}}', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - {{/isNullable}} - {{^isNullable}} - if (is_null(${{name}})) { - throw new \InvalidArgumentException('non-nullable {{name}} cannot be null'); - } - {{/isNullable}} - $this->container['{{name}}'] = ${{name}}; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php index 6095d6c06e83..c7723b96bece 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AdditionalPropertiesClass.php @@ -315,11 +315,9 @@ public function getMapProperty() */ 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 @@ public function getMapOfMapProperty() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AllOfWithSingleRef.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AllOfWithSingleRef.php index cafe95c642f0..4dc30029ec40 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AllOfWithSingleRef.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/AllOfWithSingleRef.php @@ -315,11 +315,9 @@ public function getUsername() */ 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 @@ public function getSingleRefType() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php index e05f0eed07e7..54933034d898 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php @@ -321,11 +321,9 @@ public function getClassName() */ 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 @@ public function getColor() */ public function setColor($color) { - if (is_null($color)) { throw new \InvalidArgumentException('non-nullable color cannot be null'); } - $this->container['color'] = $color; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php index c6e4de696fe2..35ebf67a80a2 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ApiResponse.php @@ -322,11 +322,9 @@ public function getCode() */ 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 @@ public function getType() */ 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 @@ public function getMessage() */ public function setMessage($message) { - if (is_null($message)) { throw new \InvalidArgumentException('non-nullable message cannot be null'); } - $this->container['message'] = $message; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php index 599b6ee88fc4..4536a27bdccf 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfArrayOfNumberOnly.php @@ -308,11 +308,9 @@ public function getArrayArrayNumber() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php index 0b48cda7dea4..68e1e72ded19 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayOfNumberOnly.php @@ -308,11 +308,9 @@ public function getArrayNumber() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php index 43548ef9e13c..be146a5f1417 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ArrayTest.php @@ -330,18 +330,16 @@ public function getArrayOfString() */ public function setArrayOfString($array_of_string) { + if (is_null($array_of_string)) { + throw new \InvalidArgumentException('non-nullable array_of_string cannot be null'); + } - if (!is_null($array_of_string) && (count($array_of_string) > 3)) { + 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 (!is_null($array_of_string) && (count($array_of_string) < 0)) { + 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.'); } - - if (is_null($array_of_string)) { - throw new \InvalidArgumentException('non-nullable array_of_string cannot be null'); - } - $this->container['array_of_string'] = $array_of_string; return $this; @@ -366,11 +364,9 @@ public function getArrayArrayOfInteger() */ 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 @@ public function getArrayArrayOfModel() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php index d00d79f3b94c..7ccb2b146202 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Capitalization.php @@ -343,11 +343,9 @@ public function getSmallCamel() */ 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 @@ public function getCapitalCamel() */ 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 @@ public function getSmallSnake() */ 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 @@ public function getCapitalSnake() */ 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 @@ public function getScaEthFlowPoints() */ 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 @@ public function getAttName() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php index a3d285433e1b..ada330fdec14 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Cat.php @@ -302,11 +302,9 @@ public function getDeclawed() */ public function setDeclawed($declawed) { - if (is_null($declawed)) { throw new \InvalidArgumentException('non-nullable declawed cannot be null'); } - $this->container['declawed'] = $declawed; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php index e592863ff2ec..63a3ada7b77e 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/CatAllOf.php @@ -308,11 +308,9 @@ public function getDeclawed() */ public function setDeclawed($declawed) { - if (is_null($declawed)) { throw new \InvalidArgumentException('non-nullable declawed cannot be null'); } - $this->container['declawed'] = $declawed; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php index e949bd0e8c1f..a1c61187c28f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Category.php @@ -318,11 +318,9 @@ public function getId() */ 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 @@ public function getName() */ public function setName($name) { - if (is_null($name)) { throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['name'] = $name; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php index 9afa4408ba39..b1569c319bd8 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ClassModel.php @@ -309,11 +309,9 @@ public function getClass() */ public function setClass($_class) { - if (is_null($_class)) { throw new \InvalidArgumentException('non-nullable _class cannot be null'); } - $this->container['_class'] = $_class; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php index 1ad15d389ea9..aca8c8ac468a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Client.php @@ -308,11 +308,9 @@ public function getClient() */ public function setClient($client) { - if (is_null($client)) { throw new \InvalidArgumentException('non-nullable client cannot be null'); } - $this->container['client'] = $client; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DeprecatedObject.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DeprecatedObject.php index 89f357fa31c4..a6236d1ed7eb 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DeprecatedObject.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DeprecatedObject.php @@ -308,11 +308,9 @@ public function getName() */ public function setName($name) { - if (is_null($name)) { throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['name'] = $name; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php index 9a6f314555ae..4dca9f50519a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Dog.php @@ -302,11 +302,9 @@ public function getBreed() */ public function setBreed($breed) { - if (is_null($breed)) { throw new \InvalidArgumentException('non-nullable breed cannot be null'); } - $this->container['breed'] = $breed; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php index 381f28c52f13..10016b86d392 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/DogAllOf.php @@ -308,11 +308,9 @@ public function getBreed() */ public function setBreed($breed) { - if (is_null($breed)) { throw new \InvalidArgumentException('non-nullable breed cannot be null'); } - $this->container['breed'] = $breed; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php index a4dce3cd46ec..b460781dc7d6 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumArrays.php @@ -354,8 +354,11 @@ public function getJustSymbol() */ 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 @@ public function setJustSymbol($just_symbol) ) ); } - - 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 @@ public function getArrayEnum() */ 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 @@ public function setArrayEnum($array_enum) ) ); } - - if (is_null($array_enum)) { - throw new \InvalidArgumentException('non-nullable array_enum cannot be null'); - } - $this->container['array_enum'] = $array_enum; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php index 48f2761d0b09..732ede548354 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/EnumTest.php @@ -460,8 +460,11 @@ public function getEnumString() */ 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 @@ public function setEnumString($enum_string) ) ); } - - 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 @@ public function getEnumStringRequired() */ 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 @@ public function setEnumStringRequired($enum_string_required) ) ); } - - 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 @@ public function getEnumInteger() */ 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 @@ public function setEnumInteger($enum_integer) ) ); } - - 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 @@ public function getEnumNumber() */ 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 @@ public function setEnumNumber($enum_number) ) ); } - - 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 @@ public function getOuterEnum() */ public function setOuterEnum($outer_enum) { - if (is_null($outer_enum)) { array_push($this->openAPINullablesSetToNull, 'outer_enum'); } else { @@ -627,7 +618,6 @@ public function setOuterEnum($outer_enum) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['outer_enum'] = $outer_enum; return $this; @@ -652,11 +642,9 @@ public function getOuterEnumInteger() */ 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 @@ public function getOuterEnumDefaultValue() */ 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 @@ public function getOuterEnumIntegerDefaultValue() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php index cddd9e67e5ff..5261e068f9e0 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/File.php @@ -309,11 +309,9 @@ public function getSourceUri() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php index 8e95875e1081..d8220a4c8967 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FileSchemaTestClass.php @@ -315,11 +315,9 @@ public function getFile() */ 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 @@ public function getFiles() */ public function setFiles($files) { - if (is_null($files)) { throw new \InvalidArgumentException('non-nullable files cannot be null'); } - $this->container['files'] = $files; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php index 3b72445bae73..407e15edb3d2 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Foo.php @@ -308,11 +308,9 @@ public function getBar() */ public function setBar($bar) { - if (is_null($bar)) { throw new \InvalidArgumentException('non-nullable bar cannot be null'); } - $this->container['bar'] = $bar; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FooGetDefaultResponse.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FooGetDefaultResponse.php index 0bf9ecabb272..fed1ba7e4795 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FooGetDefaultResponse.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FooGetDefaultResponse.php @@ -308,11 +308,9 @@ public function getString() */ public function setString($string) { - if (is_null($string)) { throw new \InvalidArgumentException('non-nullable string cannot be null'); } - $this->container['string'] = $string; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php index 5d663a560ada..3a1232107c3d 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FormatTest.php @@ -485,19 +485,17 @@ public function getInteger() */ public function setInteger($integer) { + if (is_null($integer)) { + throw new \InvalidArgumentException('non-nullable integer cannot be null'); + } - if (!is_null($integer) && ($integer > 100)) { + if (($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)) { + if (($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'); - } - $this->container['integer'] = $integer; return $this; @@ -522,19 +520,17 @@ public function getInt32() */ public function setInt32($int32) { + if (is_null($int32)) { + throw new \InvalidArgumentException('non-nullable int32 cannot be null'); + } - if (!is_null($int32) && ($int32 > 200)) { + if (($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)) { + if (($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'); - } - $this->container['int32'] = $int32; return $this; @@ -559,11 +555,9 @@ public function getInt64() */ 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 @@ public function getNumber() */ 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 @@ public function setNumber($number) 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 @@ public function getFloat() */ public function setFloat($float) { + if (is_null($float)) { + throw new \InvalidArgumentException('non-nullable float cannot be null'); + } - if (!is_null($float) && ($float > 987.6)) { + if (($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)) { + if (($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'); - } - $this->container['float'] = $float; return $this; @@ -662,19 +652,17 @@ public function getDouble() */ public function setDouble($double) { + if (is_null($double)) { + throw new \InvalidArgumentException('non-nullable double cannot be null'); + } - if (!is_null($double) && ($double > 123.4)) { + if (($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)) { + if (($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'); - } - $this->container['double'] = $double; return $this; @@ -699,11 +687,9 @@ public function getDecimal() */ 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 @@ public function getString() */ 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 @@ public function getByte() */ 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 @@ public function getBinary() */ 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 @@ public function getDate() */ 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 @@ public function getDateTime() */ 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 @@ public function getUuid() */ 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 @@ public function getPassword() */ 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 @@ public function setPassword($password) 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 @@ public function getPatternWithDigits() */ 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 @@ public function getPatternWithDigitsAndDelimiter() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php index 6c1ebb236cbc..4e5d9667a16a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HasOnlyReadOnly.php @@ -315,11 +315,9 @@ public function getBar() */ 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 @@ public function getFoo() */ public function setFoo($foo) { - if (is_null($foo)) { throw new \InvalidArgumentException('non-nullable foo cannot be null'); } - $this->container['foo'] = $foo; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php index ceb2e3dc9650..ab66586a7df8 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/HealthCheckResult.php @@ -309,7 +309,6 @@ public function getNullableMessage() */ public function setNullableMessage($nullable_message) { - if (is_null($nullable_message)) { array_push($this->openAPINullablesSetToNull, 'nullable_message'); } else { @@ -320,7 +319,6 @@ public function setNullableMessage($nullable_message) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['nullable_message'] = $nullable_message; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php index 77ef369970f5..d342581b3d57 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php @@ -344,11 +344,9 @@ public function getMapMapOfString() */ 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 @@ public function getMapOfEnumString() */ 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 @@ 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'); - } - $this->container['map_of_enum_string'] = $map_of_enum_string; return $this; @@ -411,11 +407,9 @@ public function getDirectMap() */ 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 @@ public function getIndirectMap() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php index 64c477b8e8a8..949822112e05 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php @@ -322,11 +322,9 @@ public function getUuid() */ 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 @@ public function getDateTime() */ 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 @@ public function getMap() */ public function setMap($map) { - if (is_null($map)) { throw new \InvalidArgumentException('non-nullable map cannot be null'); } - $this->container['map'] = $map; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php index 3a748b33e582..39fa7f66769a 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Model200Response.php @@ -316,11 +316,9 @@ public function getName() */ 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 @@ public function getClass() */ public function setClass($class) { - if (is_null($class)) { throw new \InvalidArgumentException('non-nullable class cannot be null'); } - $this->container['class'] = $class; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php index b19a6627a462..54e8d8248e9d 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelList.php @@ -308,11 +308,9 @@ public function get123List() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php index a6daf5654e7e..4a8c14cce782 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ModelReturn.php @@ -309,11 +309,9 @@ public function getReturn() */ public function setReturn($return) { - if (is_null($return)) { throw new \InvalidArgumentException('non-nullable return cannot be null'); } - $this->container['return'] = $return; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php index 7884a02677e3..d73ef9029373 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Name.php @@ -333,11 +333,9 @@ public function getName() */ 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 @@ public function getSnakeCase() */ 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 @@ public function getProperty() */ 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 @@ public function get123Number() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php index 1e581fd54d2d..c0c279f43653 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php @@ -385,7 +385,6 @@ public function getIntegerProp() */ public function setIntegerProp($integer_prop) { - if (is_null($integer_prop)) { array_push($this->openAPINullablesSetToNull, 'integer_prop'); } else { @@ -396,7 +395,6 @@ public function setIntegerProp($integer_prop) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['integer_prop'] = $integer_prop; return $this; @@ -421,7 +419,6 @@ public function getNumberProp() */ public function setNumberProp($number_prop) { - if (is_null($number_prop)) { array_push($this->openAPINullablesSetToNull, 'number_prop'); } else { @@ -432,7 +429,6 @@ public function setNumberProp($number_prop) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['number_prop'] = $number_prop; return $this; @@ -457,7 +453,6 @@ public function getBooleanProp() */ public function setBooleanProp($boolean_prop) { - if (is_null($boolean_prop)) { array_push($this->openAPINullablesSetToNull, 'boolean_prop'); } else { @@ -468,7 +463,6 @@ public function setBooleanProp($boolean_prop) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['boolean_prop'] = $boolean_prop; return $this; @@ -493,7 +487,6 @@ public function getStringProp() */ public function setStringProp($string_prop) { - if (is_null($string_prop)) { array_push($this->openAPINullablesSetToNull, 'string_prop'); } else { @@ -504,7 +497,6 @@ public function setStringProp($string_prop) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['string_prop'] = $string_prop; return $this; @@ -529,7 +521,6 @@ public function getDateProp() */ public function setDateProp($date_prop) { - if (is_null($date_prop)) { array_push($this->openAPINullablesSetToNull, 'date_prop'); } else { @@ -540,7 +531,6 @@ public function setDateProp($date_prop) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['date_prop'] = $date_prop; return $this; @@ -565,7 +555,6 @@ public function getDatetimeProp() */ public function setDatetimeProp($datetime_prop) { - if (is_null($datetime_prop)) { array_push($this->openAPINullablesSetToNull, 'datetime_prop'); } else { @@ -576,7 +565,6 @@ public function setDatetimeProp($datetime_prop) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['datetime_prop'] = $datetime_prop; return $this; @@ -601,7 +589,6 @@ public function getArrayNullableProp() */ public function setArrayNullableProp($array_nullable_prop) { - if (is_null($array_nullable_prop)) { array_push($this->openAPINullablesSetToNull, 'array_nullable_prop'); } else { @@ -612,7 +599,6 @@ public function setArrayNullableProp($array_nullable_prop) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['array_nullable_prop'] = $array_nullable_prop; return $this; @@ -637,7 +623,6 @@ public function getArrayAndItemsNullableProp() */ 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 @@ public function setArrayAndItemsNullableProp($array_and_items_nullable_prop) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['array_and_items_nullable_prop'] = $array_and_items_nullable_prop; return $this; @@ -673,11 +657,9 @@ public function getArrayItemsNullable() */ 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 @@ public function getObjectNullableProp() */ public function setObjectNullableProp($object_nullable_prop) { - if (is_null($object_nullable_prop)) { array_push($this->openAPINullablesSetToNull, 'object_nullable_prop'); } else { @@ -713,7 +694,6 @@ public function setObjectNullableProp($object_nullable_prop) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['object_nullable_prop'] = $object_nullable_prop; return $this; @@ -738,7 +718,6 @@ public function getObjectAndItemsNullableProp() */ 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 @@ public function setObjectAndItemsNullableProp($object_and_items_nullable_prop) $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } - $this->container['object_and_items_nullable_prop'] = $object_and_items_nullable_prop; return $this; @@ -774,11 +752,9 @@ public function getObjectItemsNullable() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php index 58170b216d45..ccf2473be265 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NumberOnly.php @@ -308,11 +308,9 @@ public function getJustNumber() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ObjectWithDeprecatedFields.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ObjectWithDeprecatedFields.php index 33804e49923c..978dd38bd5ad 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ObjectWithDeprecatedFields.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ObjectWithDeprecatedFields.php @@ -329,11 +329,9 @@ public function getUuid() */ 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 @@ public function getId() */ 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 @@ public function getDeprecatedRef() */ 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 @@ public function getBars() */ public function setBars($bars) { - if (is_null($bars)) { throw new \InvalidArgumentException('non-nullable bars cannot be null'); } - $this->container['bars'] = $bars; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php index 0f4b29e1dcf3..f4f93fa08813 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Order.php @@ -369,11 +369,9 @@ public function getId() */ 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 @@ public function getPetId() */ 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 @@ public function getQuantity() */ 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 @@ public function getShipDate() */ 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 @@ public function getStatus() */ 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 @@ public function setStatus($status) ) ); } - - if (is_null($status)) { - throw new \InvalidArgumentException('non-nullable status cannot be null'); - } - $this->container['status'] = $status; return $this; @@ -524,11 +514,9 @@ public function getComplete() */ public function setComplete($complete) { - if (is_null($complete)) { throw new \InvalidArgumentException('non-nullable complete cannot be null'); } - $this->container['complete'] = $complete; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php index 3c9d0db77b25..12914baca5a7 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterComposite.php @@ -322,11 +322,9 @@ public function getMyNumber() */ 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 @@ public function getMyString() */ 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 @@ public function getMyBoolean() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterObjectWithEnumProperty.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterObjectWithEnumProperty.php index 6c6f6bf4194f..536394ab9619 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterObjectWithEnumProperty.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterObjectWithEnumProperty.php @@ -311,11 +311,9 @@ public function getValue() */ public function setValue($value) { - if (is_null($value)) { throw new \InvalidArgumentException('non-nullable value cannot be null'); } - $this->container['value'] = $value; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php index fb159c67d1f9..98a5fd4d3513 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php @@ -375,11 +375,9 @@ public function getId() */ 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 @@ public function getCategory() */ 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 @@ public function getName() */ 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 @@ public function getPhotoUrls() */ 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 @@ public function getTags() */ 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 @@ public function getStatus() */ 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 @@ public function setStatus($status) ) ); } - - if (is_null($status)) { - throw new \InvalidArgumentException('non-nullable status cannot be null'); - } - $this->container['status'] = $status; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php index b1ff1440f8ea..d19e25f94e49 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/ReadOnlyFirst.php @@ -315,11 +315,9 @@ public function getBar() */ 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 @@ public function getBaz() */ public function setBaz($baz) { - if (is_null($baz)) { throw new \InvalidArgumentException('non-nullable baz cannot be null'); } - $this->container['baz'] = $baz; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php index 62926ebe5055..bedd77e5783f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/SpecialModelName.php @@ -308,11 +308,9 @@ public function getSpecialPropertyName() */ 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; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php index 677b235ef636..02735328a1b3 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Tag.php @@ -315,11 +315,9 @@ public function getId() */ 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 @@ public function getName() */ public function setName($name) { - if (is_null($name)) { throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $this->container['name'] = $name; return $this; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php index e057867304d8..77555f1c0248 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/User.php @@ -357,11 +357,9 @@ public function getId() */ 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 @@ public function getUsername() */ 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 @@ public function getFirstName() */ 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 @@ public function getLastName() */ 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 @@ public function getEmail() */ 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 @@ public function getPassword() */ 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 @@ public function getPhone() */ 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 @@ public function getUserStatus() */ 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;