mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 12:40:53 +00:00
fix(php-nextgen): do not call static methods dynamically (#21163)
This commit is contained in:
parent
daeffde719
commit
2327562af4
@ -301,7 +301,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
|
|||||||
{{/required}}
|
{{/required}}
|
||||||
{{#isEnum}}
|
{{#isEnum}}
|
||||||
{{^isContainer}}
|
{{^isContainer}}
|
||||||
$allowedValues = $this->{{getter}}AllowableValues();
|
$allowedValues = self::{{getter}}AllowableValues();
|
||||||
if (!is_null($this->container['{{name}}']) && !in_array($this->container['{{name}}'], $allowedValues, true)) {
|
if (!is_null($this->container['{{name}}']) && !in_array($this->container['{{name}}'], $allowedValues, true)) {
|
||||||
$invalidProperties[] = sprintf(
|
$invalidProperties[] = sprintf(
|
||||||
"invalid value '%s' for '{{name}}', must be one of '%s'",
|
"invalid value '%s' for '{{name}}', must be one of '%s'",
|
||||||
@ -416,7 +416,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
|
|||||||
}
|
}
|
||||||
{{/isNullable}}
|
{{/isNullable}}
|
||||||
{{#isEnum}}
|
{{#isEnum}}
|
||||||
$allowedValues = $this->{{getter}}AllowableValues();
|
$allowedValues = self::{{getter}}AllowableValues();
|
||||||
{{^isContainer}}
|
{{^isContainer}}
|
||||||
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}!in_array(${{{name}}}, $allowedValues, true)) {
|
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}!in_array(${{{name}}}, $allowedValues, true)) {
|
||||||
{{#enumUnknownDefaultCase}}
|
{{#enumUnknownDefaultCase}}
|
||||||
|
@ -404,7 +404,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($array_string_enum_default)) {
|
if (is_null($array_string_enum_default)) {
|
||||||
throw new InvalidArgumentException('non-nullable array_string_enum_default cannot be null');
|
throw new InvalidArgumentException('non-nullable array_string_enum_default cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getArrayStringEnumDefaultAllowableValues();
|
$allowedValues = self::getArrayStringEnumDefaultAllowableValues();
|
||||||
if (array_diff($array_string_enum_default, $allowedValues)) {
|
if (array_diff($array_string_enum_default, $allowedValues)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -331,7 +331,7 @@ class Pet implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if ($this->container['photo_urls'] === null) {
|
if ($this->container['photo_urls'] === null) {
|
||||||
$invalidProperties[] = "'photo_urls' can't be null";
|
$invalidProperties[] = "'photo_urls' can't be null";
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getStatusAllowableValues();
|
$allowedValues = self::getStatusAllowableValues();
|
||||||
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
|
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
|
||||||
$invalidProperties[] = sprintf(
|
$invalidProperties[] = sprintf(
|
||||||
"invalid value '%s' for 'status', must be one of '%s'",
|
"invalid value '%s' for 'status', must be one of '%s'",
|
||||||
@ -512,7 +512,7 @@ class Pet implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($status)) {
|
if (is_null($status)) {
|
||||||
throw new InvalidArgumentException('non-nullable status cannot be null');
|
throw new InvalidArgumentException('non-nullable status cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getStatusAllowableValues();
|
$allowedValues = self::getStatusAllowableValues();
|
||||||
if (!in_array($status, $allowedValues, true)) {
|
if (!in_array($status, $allowedValues, true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -361,7 +361,7 @@ class Query implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($outcomes)) {
|
if (is_null($outcomes)) {
|
||||||
throw new InvalidArgumentException('non-nullable outcomes cannot be null');
|
throw new InvalidArgumentException('non-nullable outcomes cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getOutcomesAllowableValues();
|
$allowedValues = self::getOutcomesAllowableValues();
|
||||||
if (array_diff($outcomes, $allowedValues)) {
|
if (array_diff($outcomes, $allowedValues)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -404,7 +404,7 @@ class DefaultValue implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($array_string_enum_default)) {
|
if (is_null($array_string_enum_default)) {
|
||||||
throw new InvalidArgumentException('non-nullable array_string_enum_default cannot be null');
|
throw new InvalidArgumentException('non-nullable array_string_enum_default cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getArrayStringEnumDefaultAllowableValues();
|
$allowedValues = self::getArrayStringEnumDefaultAllowableValues();
|
||||||
if (array_diff($array_string_enum_default, $allowedValues)) {
|
if (array_diff($array_string_enum_default, $allowedValues)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -331,7 +331,7 @@ class Pet implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if ($this->container['photo_urls'] === null) {
|
if ($this->container['photo_urls'] === null) {
|
||||||
$invalidProperties[] = "'photo_urls' can't be null";
|
$invalidProperties[] = "'photo_urls' can't be null";
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getStatusAllowableValues();
|
$allowedValues = self::getStatusAllowableValues();
|
||||||
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
|
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
|
||||||
$invalidProperties[] = sprintf(
|
$invalidProperties[] = sprintf(
|
||||||
"invalid value '%s' for 'status', must be one of '%s'",
|
"invalid value '%s' for 'status', must be one of '%s'",
|
||||||
@ -512,7 +512,7 @@ class Pet implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($status)) {
|
if (is_null($status)) {
|
||||||
throw new InvalidArgumentException('non-nullable status cannot be null');
|
throw new InvalidArgumentException('non-nullable status cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getStatusAllowableValues();
|
$allowedValues = self::getStatusAllowableValues();
|
||||||
if (!in_array($status, $allowedValues, true)) {
|
if (!in_array($status, $allowedValues, true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -361,7 +361,7 @@ class Query implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($outcomes)) {
|
if (is_null($outcomes)) {
|
||||||
throw new InvalidArgumentException('non-nullable outcomes cannot be null');
|
throw new InvalidArgumentException('non-nullable outcomes cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getOutcomesAllowableValues();
|
$allowedValues = self::getOutcomesAllowableValues();
|
||||||
if (array_diff($outcomes, $allowedValues)) {
|
if (array_diff($outcomes, $allowedValues)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -309,7 +309,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
{
|
{
|
||||||
$invalidProperties = [];
|
$invalidProperties = [];
|
||||||
|
|
||||||
$allowedValues = $this->getJustSymbolAllowableValues();
|
$allowedValues = self::getJustSymbolAllowableValues();
|
||||||
if (!is_null($this->container['just_symbol']) && !in_array($this->container['just_symbol'], $allowedValues, true)) {
|
if (!is_null($this->container['just_symbol']) && !in_array($this->container['just_symbol'], $allowedValues, true)) {
|
||||||
$invalidProperties[] = sprintf(
|
$invalidProperties[] = sprintf(
|
||||||
"invalid value '%s' for 'just_symbol', must be one of '%s'",
|
"invalid value '%s' for 'just_symbol', must be one of '%s'",
|
||||||
@ -355,7 +355,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($just_symbol)) {
|
if (is_null($just_symbol)) {
|
||||||
throw new InvalidArgumentException('non-nullable just_symbol cannot be null');
|
throw new InvalidArgumentException('non-nullable just_symbol cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getJustSymbolAllowableValues();
|
$allowedValues = self::getJustSymbolAllowableValues();
|
||||||
if (!in_array($just_symbol, $allowedValues, true)) {
|
if (!in_array($just_symbol, $allowedValues, true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
@ -392,7 +392,7 @@ class EnumArrays implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($array_enum)) {
|
if (is_null($array_enum)) {
|
||||||
throw new InvalidArgumentException('non-nullable array_enum cannot be null');
|
throw new InvalidArgumentException('non-nullable array_enum cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getArrayEnumAllowableValues();
|
$allowedValues = self::getArrayEnumAllowableValues();
|
||||||
if (array_diff($array_enum, $allowedValues)) {
|
if (array_diff($array_enum, $allowedValues)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -385,7 +385,7 @@ class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
{
|
{
|
||||||
$invalidProperties = [];
|
$invalidProperties = [];
|
||||||
|
|
||||||
$allowedValues = $this->getEnumStringAllowableValues();
|
$allowedValues = self::getEnumStringAllowableValues();
|
||||||
if (!is_null($this->container['enum_string']) && !in_array($this->container['enum_string'], $allowedValues, true)) {
|
if (!is_null($this->container['enum_string']) && !in_array($this->container['enum_string'], $allowedValues, true)) {
|
||||||
$invalidProperties[] = sprintf(
|
$invalidProperties[] = sprintf(
|
||||||
"invalid value '%s' for 'enum_string', must be one of '%s'",
|
"invalid value '%s' for 'enum_string', must be one of '%s'",
|
||||||
@ -397,7 +397,7 @@ class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if ($this->container['enum_string_required'] === null) {
|
if ($this->container['enum_string_required'] === null) {
|
||||||
$invalidProperties[] = "'enum_string_required' can't be null";
|
$invalidProperties[] = "'enum_string_required' can't be null";
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getEnumStringRequiredAllowableValues();
|
$allowedValues = self::getEnumStringRequiredAllowableValues();
|
||||||
if (!is_null($this->container['enum_string_required']) && !in_array($this->container['enum_string_required'], $allowedValues, true)) {
|
if (!is_null($this->container['enum_string_required']) && !in_array($this->container['enum_string_required'], $allowedValues, true)) {
|
||||||
$invalidProperties[] = sprintf(
|
$invalidProperties[] = sprintf(
|
||||||
"invalid value '%s' for 'enum_string_required', must be one of '%s'",
|
"invalid value '%s' for 'enum_string_required', must be one of '%s'",
|
||||||
@ -406,7 +406,7 @@ class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$allowedValues = $this->getEnumIntegerAllowableValues();
|
$allowedValues = self::getEnumIntegerAllowableValues();
|
||||||
if (!is_null($this->container['enum_integer']) && !in_array($this->container['enum_integer'], $allowedValues, true)) {
|
if (!is_null($this->container['enum_integer']) && !in_array($this->container['enum_integer'], $allowedValues, true)) {
|
||||||
$invalidProperties[] = sprintf(
|
$invalidProperties[] = sprintf(
|
||||||
"invalid value '%s' for 'enum_integer', must be one of '%s'",
|
"invalid value '%s' for 'enum_integer', must be one of '%s'",
|
||||||
@ -415,7 +415,7 @@ class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$allowedValues = $this->getEnumNumberAllowableValues();
|
$allowedValues = self::getEnumNumberAllowableValues();
|
||||||
if (!is_null($this->container['enum_number']) && !in_array($this->container['enum_number'], $allowedValues, true)) {
|
if (!is_null($this->container['enum_number']) && !in_array($this->container['enum_number'], $allowedValues, true)) {
|
||||||
$invalidProperties[] = sprintf(
|
$invalidProperties[] = sprintf(
|
||||||
"invalid value '%s' for 'enum_number', must be one of '%s'",
|
"invalid value '%s' for 'enum_number', must be one of '%s'",
|
||||||
@ -461,7 +461,7 @@ class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($enum_string)) {
|
if (is_null($enum_string)) {
|
||||||
throw new InvalidArgumentException('non-nullable enum_string cannot be null');
|
throw new InvalidArgumentException('non-nullable enum_string cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getEnumStringAllowableValues();
|
$allowedValues = self::getEnumStringAllowableValues();
|
||||||
if (!in_array($enum_string, $allowedValues, true)) {
|
if (!in_array($enum_string, $allowedValues, true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
@ -498,7 +498,7 @@ class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($enum_string_required)) {
|
if (is_null($enum_string_required)) {
|
||||||
throw new InvalidArgumentException('non-nullable enum_string_required cannot be null');
|
throw new InvalidArgumentException('non-nullable enum_string_required cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getEnumStringRequiredAllowableValues();
|
$allowedValues = self::getEnumStringRequiredAllowableValues();
|
||||||
if (!in_array($enum_string_required, $allowedValues, true)) {
|
if (!in_array($enum_string_required, $allowedValues, true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
@ -535,7 +535,7 @@ class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($enum_integer)) {
|
if (is_null($enum_integer)) {
|
||||||
throw new InvalidArgumentException('non-nullable enum_integer cannot be null');
|
throw new InvalidArgumentException('non-nullable enum_integer cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getEnumIntegerAllowableValues();
|
$allowedValues = self::getEnumIntegerAllowableValues();
|
||||||
if (!in_array($enum_integer, $allowedValues, true)) {
|
if (!in_array($enum_integer, $allowedValues, true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
@ -572,7 +572,7 @@ class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($enum_number)) {
|
if (is_null($enum_number)) {
|
||||||
throw new InvalidArgumentException('non-nullable enum_number cannot be null');
|
throw new InvalidArgumentException('non-nullable enum_number cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getEnumNumberAllowableValues();
|
$allowedValues = self::getEnumNumberAllowableValues();
|
||||||
if (!in_array($enum_number, $allowedValues, true)) {
|
if (!in_array($enum_number, $allowedValues, true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -372,7 +372,7 @@ class MapTest implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($map_of_enum_string)) {
|
if (is_null($map_of_enum_string)) {
|
||||||
throw new InvalidArgumentException('non-nullable map_of_enum_string cannot be null');
|
throw new InvalidArgumentException('non-nullable map_of_enum_string cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getMapOfEnumStringAllowableValues();
|
$allowedValues = self::getMapOfEnumStringAllowableValues();
|
||||||
if (array_diff($map_of_enum_string, $allowedValues)) {
|
if (array_diff($map_of_enum_string, $allowedValues)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -324,7 +324,7 @@ class Order implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
{
|
{
|
||||||
$invalidProperties = [];
|
$invalidProperties = [];
|
||||||
|
|
||||||
$allowedValues = $this->getStatusAllowableValues();
|
$allowedValues = self::getStatusAllowableValues();
|
||||||
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
|
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
|
||||||
$invalidProperties[] = sprintf(
|
$invalidProperties[] = sprintf(
|
||||||
"invalid value '%s' for 'status', must be one of '%s'",
|
"invalid value '%s' for 'status', must be one of '%s'",
|
||||||
@ -478,7 +478,7 @@ class Order implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($status)) {
|
if (is_null($status)) {
|
||||||
throw new InvalidArgumentException('non-nullable status cannot be null');
|
throw new InvalidArgumentException('non-nullable status cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getStatusAllowableValues();
|
$allowedValues = self::getStatusAllowableValues();
|
||||||
if (!in_array($status, $allowedValues, true)) {
|
if (!in_array($status, $allowedValues, true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -295,7 +295,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, JsonSerializabl
|
|||||||
{
|
{
|
||||||
$invalidProperties = [];
|
$invalidProperties = [];
|
||||||
|
|
||||||
$allowedValues = $this->getTypeAllowableValues();
|
$allowedValues = self::getTypeAllowableValues();
|
||||||
if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
|
if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
|
||||||
$invalidProperties[] = sprintf(
|
$invalidProperties[] = sprintf(
|
||||||
"invalid value '%s' for 'type', must be one of '%s'",
|
"invalid value '%s' for 'type', must be one of '%s'",
|
||||||
@ -341,7 +341,7 @@ class ParentWithNullable implements ModelInterface, ArrayAccess, JsonSerializabl
|
|||||||
if (is_null($type)) {
|
if (is_null($type)) {
|
||||||
throw new InvalidArgumentException('non-nullable type cannot be null');
|
throw new InvalidArgumentException('non-nullable type cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getTypeAllowableValues();
|
$allowedValues = self::getTypeAllowableValues();
|
||||||
if (!in_array($type, $allowedValues, true)) {
|
if (!in_array($type, $allowedValues, true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -330,7 +330,7 @@ class Pet implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if ($this->container['photo_urls'] === null) {
|
if ($this->container['photo_urls'] === null) {
|
||||||
$invalidProperties[] = "'photo_urls' can't be null";
|
$invalidProperties[] = "'photo_urls' can't be null";
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getStatusAllowableValues();
|
$allowedValues = self::getStatusAllowableValues();
|
||||||
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
|
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
|
||||||
$invalidProperties[] = sprintf(
|
$invalidProperties[] = sprintf(
|
||||||
"invalid value '%s' for 'status', must be one of '%s'",
|
"invalid value '%s' for 'status', must be one of '%s'",
|
||||||
@ -513,7 +513,7 @@ class Pet implements ModelInterface, ArrayAccess, JsonSerializable
|
|||||||
if (is_null($status)) {
|
if (is_null($status)) {
|
||||||
throw new InvalidArgumentException('non-nullable status cannot be null');
|
throw new InvalidArgumentException('non-nullable status cannot be null');
|
||||||
}
|
}
|
||||||
$allowedValues = $this->getStatusAllowableValues();
|
$allowedValues = self::getStatusAllowableValues();
|
||||||
if (!in_array($status, $allowedValues, true)) {
|
if (!in_array($status, $allowedValues, true)) {
|
||||||
throw new InvalidArgumentException(
|
throw new InvalidArgumentException(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user