Skip to content

fix(php-nextgen): do not call static methods dynamically #21163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
{{/required}}
{{#isEnum}}
{{^isContainer}}
$allowedValues = $this->{{getter}}AllowableValues();
$allowedValues = self::{{getter}}AllowableValues();
if (!is_null($this->container['{{name}}']) && !in_array($this->container['{{name}}'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for '{{name}}', must be one of '%s'",
Expand Down Expand Up @@ -416,7 +416,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
}
{{/isNullable}}
{{#isEnum}}
$allowedValues = $this->{{getter}}AllowableValues();
$allowedValues = self::{{getter}}AllowableValues();
{{^isContainer}}
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}!in_array(${{{name}}}, $allowedValues, true)) {
{{#enumUnknownDefaultCase}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public function setArrayStringEnumDefault(?array $array_string_enum_default): st
if (is_null($array_string_enum_default)) {
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)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function listInvalidProperties(): array
if ($this->container['photo_urls'] === 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)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
Expand Down Expand Up @@ -512,7 +512,7 @@ public function setStatus(?string $status): static
if (is_null($status)) {
throw new InvalidArgumentException('non-nullable status cannot be null');
}
$allowedValues = $this->getStatusAllowableValues();
$allowedValues = self::getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public function setOutcomes(?array $outcomes): static
if (is_null($outcomes)) {
throw new InvalidArgumentException('non-nullable outcomes cannot be null');
}
$allowedValues = $this->getOutcomesAllowableValues();
$allowedValues = self::getOutcomesAllowableValues();
if (array_diff($outcomes, $allowedValues)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public function setArrayStringEnumDefault(?array $array_string_enum_default): st
if (is_null($array_string_enum_default)) {
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)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
4 changes: 2 additions & 2 deletions samples/client/echo_api/php-nextgen/src/Model/Pet.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function listInvalidProperties(): array
if ($this->container['photo_urls'] === 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)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
Expand Down Expand Up @@ -512,7 +512,7 @@ public function setStatus(?string $status): static
if (is_null($status)) {
throw new InvalidArgumentException('non-nullable status cannot be null');
}
$allowedValues = $this->getStatusAllowableValues();
$allowedValues = self::getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
2 changes: 1 addition & 1 deletion samples/client/echo_api/php-nextgen/src/Model/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public function setOutcomes(?array $outcomes): static
if (is_null($outcomes)) {
throw new InvalidArgumentException('non-nullable outcomes cannot be null');
}
$allowedValues = $this->getOutcomesAllowableValues();
$allowedValues = self::getOutcomesAllowableValues();
if (array_diff($outcomes, $allowedValues)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public function listInvalidProperties(): array
{
$invalidProperties = [];

$allowedValues = $this->getJustSymbolAllowableValues();
$allowedValues = self::getJustSymbolAllowableValues();
if (!is_null($this->container['just_symbol']) && !in_array($this->container['just_symbol'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'just_symbol', must be one of '%s'",
Expand Down Expand Up @@ -355,7 +355,7 @@ public function setJustSymbol(?string $just_symbol): static
if (is_null($just_symbol)) {
throw new InvalidArgumentException('non-nullable just_symbol cannot be null');
}
$allowedValues = $this->getJustSymbolAllowableValues();
$allowedValues = self::getJustSymbolAllowableValues();
if (!in_array($just_symbol, $allowedValues, true)) {
throw new InvalidArgumentException(
sprintf(
Expand Down Expand Up @@ -392,7 +392,7 @@ public function setArrayEnum(?array $array_enum): static
if (is_null($array_enum)) {
throw new InvalidArgumentException('non-nullable array_enum cannot be null');
}
$allowedValues = $this->getArrayEnumAllowableValues();
$allowedValues = self::getArrayEnumAllowableValues();
if (array_diff($array_enum, $allowedValues)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public function listInvalidProperties(): array
{
$invalidProperties = [];

$allowedValues = $this->getEnumStringAllowableValues();
$allowedValues = self::getEnumStringAllowableValues();
if (!is_null($this->container['enum_string']) && !in_array($this->container['enum_string'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'enum_string', must be one of '%s'",
Expand All @@ -397,7 +397,7 @@ public function listInvalidProperties(): array
if ($this->container['enum_string_required'] === 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)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'enum_string_required', must be one of '%s'",
Expand All @@ -406,7 +406,7 @@ public function listInvalidProperties(): array
);
}

$allowedValues = $this->getEnumIntegerAllowableValues();
$allowedValues = self::getEnumIntegerAllowableValues();
if (!is_null($this->container['enum_integer']) && !in_array($this->container['enum_integer'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'enum_integer', must be one of '%s'",
Expand All @@ -415,7 +415,7 @@ public function listInvalidProperties(): array
);
}

$allowedValues = $this->getEnumNumberAllowableValues();
$allowedValues = self::getEnumNumberAllowableValues();
if (!is_null($this->container['enum_number']) && !in_array($this->container['enum_number'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'enum_number', must be one of '%s'",
Expand Down Expand Up @@ -461,7 +461,7 @@ public function setEnumString(?string $enum_string): static
if (is_null($enum_string)) {
throw new InvalidArgumentException('non-nullable enum_string cannot be null');
}
$allowedValues = $this->getEnumStringAllowableValues();
$allowedValues = self::getEnumStringAllowableValues();
if (!in_array($enum_string, $allowedValues, true)) {
throw new InvalidArgumentException(
sprintf(
Expand Down Expand Up @@ -498,7 +498,7 @@ public function setEnumStringRequired(string $enum_string_required): static
if (is_null($enum_string_required)) {
throw new InvalidArgumentException('non-nullable enum_string_required cannot be null');
}
$allowedValues = $this->getEnumStringRequiredAllowableValues();
$allowedValues = self::getEnumStringRequiredAllowableValues();
if (!in_array($enum_string_required, $allowedValues, true)) {
throw new InvalidArgumentException(
sprintf(
Expand Down Expand Up @@ -535,7 +535,7 @@ public function setEnumInteger(?int $enum_integer): static
if (is_null($enum_integer)) {
throw new InvalidArgumentException('non-nullable enum_integer cannot be null');
}
$allowedValues = $this->getEnumIntegerAllowableValues();
$allowedValues = self::getEnumIntegerAllowableValues();
if (!in_array($enum_integer, $allowedValues, true)) {
throw new InvalidArgumentException(
sprintf(
Expand Down Expand Up @@ -572,7 +572,7 @@ public function setEnumNumber(?float $enum_number): static
if (is_null($enum_number)) {
throw new InvalidArgumentException('non-nullable enum_number cannot be null');
}
$allowedValues = $this->getEnumNumberAllowableValues();
$allowedValues = self::getEnumNumberAllowableValues();
if (!in_array($enum_number, $allowedValues, true)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public function setMapOfEnumString(?array $map_of_enum_string): static
if (is_null($map_of_enum_string)) {
throw new InvalidArgumentException('non-nullable map_of_enum_string cannot be null');
}
$allowedValues = $this->getMapOfEnumStringAllowableValues();
$allowedValues = self::getMapOfEnumStringAllowableValues();
if (array_diff($map_of_enum_string, $allowedValues)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public function listInvalidProperties(): array
{
$invalidProperties = [];

$allowedValues = $this->getStatusAllowableValues();
$allowedValues = self::getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
Expand Down Expand Up @@ -478,7 +478,7 @@ public function setStatus(?string $status): static
if (is_null($status)) {
throw new InvalidArgumentException('non-nullable status cannot be null');
}
$allowedValues = $this->getStatusAllowableValues();
$allowedValues = self::getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public function listInvalidProperties(): array
{
$invalidProperties = [];

$allowedValues = $this->getTypeAllowableValues();
$allowedValues = self::getTypeAllowableValues();
if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'type', must be one of '%s'",
Expand Down Expand Up @@ -341,7 +341,7 @@ public function setType(?string $type): static
if (is_null($type)) {
throw new InvalidArgumentException('non-nullable type cannot be null');
}
$allowedValues = $this->getTypeAllowableValues();
$allowedValues = self::getTypeAllowableValues();
if (!in_array($type, $allowedValues, true)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public function listInvalidProperties(): array
if ($this->container['photo_urls'] === 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)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
Expand Down Expand Up @@ -513,7 +513,7 @@ public function setStatus(?string $status): static
if (is_null($status)) {
throw new InvalidArgumentException('non-nullable status cannot be null');
}
$allowedValues = $this->getStatusAllowableValues();
$allowedValues = self::getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new InvalidArgumentException(
sprintf(
Expand Down
Loading