Skip to content

Commit 2327562

Browse files
authored
fix(php-nextgen): do not call static methods dynamically (OpenAPITools#21163)
1 parent daeffde commit 2327562

File tree

13 files changed

+28
-28
lines changed

13 files changed

+28
-28
lines changed

modules/openapi-generator/src/main/resources/php-nextgen/model_generic.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
301301
{{/required}}
302302
{{#isEnum}}
303303
{{^isContainer}}
304-
$allowedValues = $this->{{getter}}AllowableValues();
304+
$allowedValues = self::{{getter}}AllowableValues();
305305
if (!is_null($this->container['{{name}}']) && !in_array($this->container['{{name}}'], $allowedValues, true)) {
306306
$invalidProperties[] = sprintf(
307307
"invalid value '%s' for '{{name}}', must be one of '%s'",
@@ -416,7 +416,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
416416
}
417417
{{/isNullable}}
418418
{{#isEnum}}
419-
$allowedValues = $this->{{getter}}AllowableValues();
419+
$allowedValues = self::{{getter}}AllowableValues();
420420
{{^isContainer}}
421421
if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}!in_array(${{{name}}}, $allowedValues, true)) {
422422
{{#enumUnknownDefaultCase}}

samples/client/echo_api/php-nextgen-streaming/src/Model/DefaultValue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public function setArrayStringEnumDefault(?array $array_string_enum_default): st
404404
if (is_null($array_string_enum_default)) {
405405
throw new InvalidArgumentException('non-nullable array_string_enum_default cannot be null');
406406
}
407-
$allowedValues = $this->getArrayStringEnumDefaultAllowableValues();
407+
$allowedValues = self::getArrayStringEnumDefaultAllowableValues();
408408
if (array_diff($array_string_enum_default, $allowedValues)) {
409409
throw new InvalidArgumentException(
410410
sprintf(

samples/client/echo_api/php-nextgen-streaming/src/Model/Pet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public function listInvalidProperties(): array
331331
if ($this->container['photo_urls'] === null) {
332332
$invalidProperties[] = "'photo_urls' can't be null";
333333
}
334-
$allowedValues = $this->getStatusAllowableValues();
334+
$allowedValues = self::getStatusAllowableValues();
335335
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
336336
$invalidProperties[] = sprintf(
337337
"invalid value '%s' for 'status', must be one of '%s'",
@@ -512,7 +512,7 @@ public function setStatus(?string $status): static
512512
if (is_null($status)) {
513513
throw new InvalidArgumentException('non-nullable status cannot be null');
514514
}
515-
$allowedValues = $this->getStatusAllowableValues();
515+
$allowedValues = self::getStatusAllowableValues();
516516
if (!in_array($status, $allowedValues, true)) {
517517
throw new InvalidArgumentException(
518518
sprintf(

samples/client/echo_api/php-nextgen-streaming/src/Model/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ public function setOutcomes(?array $outcomes): static
361361
if (is_null($outcomes)) {
362362
throw new InvalidArgumentException('non-nullable outcomes cannot be null');
363363
}
364-
$allowedValues = $this->getOutcomesAllowableValues();
364+
$allowedValues = self::getOutcomesAllowableValues();
365365
if (array_diff($outcomes, $allowedValues)) {
366366
throw new InvalidArgumentException(
367367
sprintf(

samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public function setArrayStringEnumDefault(?array $array_string_enum_default): st
404404
if (is_null($array_string_enum_default)) {
405405
throw new InvalidArgumentException('non-nullable array_string_enum_default cannot be null');
406406
}
407-
$allowedValues = $this->getArrayStringEnumDefaultAllowableValues();
407+
$allowedValues = self::getArrayStringEnumDefaultAllowableValues();
408408
if (array_diff($array_string_enum_default, $allowedValues)) {
409409
throw new InvalidArgumentException(
410410
sprintf(

samples/client/echo_api/php-nextgen/src/Model/Pet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public function listInvalidProperties(): array
331331
if ($this->container['photo_urls'] === null) {
332332
$invalidProperties[] = "'photo_urls' can't be null";
333333
}
334-
$allowedValues = $this->getStatusAllowableValues();
334+
$allowedValues = self::getStatusAllowableValues();
335335
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
336336
$invalidProperties[] = sprintf(
337337
"invalid value '%s' for 'status', must be one of '%s'",
@@ -512,7 +512,7 @@ public function setStatus(?string $status): static
512512
if (is_null($status)) {
513513
throw new InvalidArgumentException('non-nullable status cannot be null');
514514
}
515-
$allowedValues = $this->getStatusAllowableValues();
515+
$allowedValues = self::getStatusAllowableValues();
516516
if (!in_array($status, $allowedValues, true)) {
517517
throw new InvalidArgumentException(
518518
sprintf(

samples/client/echo_api/php-nextgen/src/Model/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ public function setOutcomes(?array $outcomes): static
361361
if (is_null($outcomes)) {
362362
throw new InvalidArgumentException('non-nullable outcomes cannot be null');
363363
}
364-
$allowedValues = $this->getOutcomesAllowableValues();
364+
$allowedValues = self::getOutcomesAllowableValues();
365365
if (array_diff($outcomes, $allowedValues)) {
366366
throw new InvalidArgumentException(
367367
sprintf(

samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/EnumArrays.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public function listInvalidProperties(): array
309309
{
310310
$invalidProperties = [];
311311

312-
$allowedValues = $this->getJustSymbolAllowableValues();
312+
$allowedValues = self::getJustSymbolAllowableValues();
313313
if (!is_null($this->container['just_symbol']) && !in_array($this->container['just_symbol'], $allowedValues, true)) {
314314
$invalidProperties[] = sprintf(
315315
"invalid value '%s' for 'just_symbol', must be one of '%s'",
@@ -355,7 +355,7 @@ public function setJustSymbol(?string $just_symbol): static
355355
if (is_null($just_symbol)) {
356356
throw new InvalidArgumentException('non-nullable just_symbol cannot be null');
357357
}
358-
$allowedValues = $this->getJustSymbolAllowableValues();
358+
$allowedValues = self::getJustSymbolAllowableValues();
359359
if (!in_array($just_symbol, $allowedValues, true)) {
360360
throw new InvalidArgumentException(
361361
sprintf(
@@ -392,7 +392,7 @@ public function setArrayEnum(?array $array_enum): static
392392
if (is_null($array_enum)) {
393393
throw new InvalidArgumentException('non-nullable array_enum cannot be null');
394394
}
395-
$allowedValues = $this->getArrayEnumAllowableValues();
395+
$allowedValues = self::getArrayEnumAllowableValues();
396396
if (array_diff($array_enum, $allowedValues)) {
397397
throw new InvalidArgumentException(
398398
sprintf(

samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/EnumTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ public function listInvalidProperties(): array
385385
{
386386
$invalidProperties = [];
387387

388-
$allowedValues = $this->getEnumStringAllowableValues();
388+
$allowedValues = self::getEnumStringAllowableValues();
389389
if (!is_null($this->container['enum_string']) && !in_array($this->container['enum_string'], $allowedValues, true)) {
390390
$invalidProperties[] = sprintf(
391391
"invalid value '%s' for 'enum_string', must be one of '%s'",
@@ -397,7 +397,7 @@ public function listInvalidProperties(): array
397397
if ($this->container['enum_string_required'] === null) {
398398
$invalidProperties[] = "'enum_string_required' can't be null";
399399
}
400-
$allowedValues = $this->getEnumStringRequiredAllowableValues();
400+
$allowedValues = self::getEnumStringRequiredAllowableValues();
401401
if (!is_null($this->container['enum_string_required']) && !in_array($this->container['enum_string_required'], $allowedValues, true)) {
402402
$invalidProperties[] = sprintf(
403403
"invalid value '%s' for 'enum_string_required', must be one of '%s'",
@@ -406,7 +406,7 @@ public function listInvalidProperties(): array
406406
);
407407
}
408408

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

418-
$allowedValues = $this->getEnumNumberAllowableValues();
418+
$allowedValues = self::getEnumNumberAllowableValues();
419419
if (!is_null($this->container['enum_number']) && !in_array($this->container['enum_number'], $allowedValues, true)) {
420420
$invalidProperties[] = sprintf(
421421
"invalid value '%s' for 'enum_number', must be one of '%s'",
@@ -461,7 +461,7 @@ public function setEnumString(?string $enum_string): static
461461
if (is_null($enum_string)) {
462462
throw new InvalidArgumentException('non-nullable enum_string cannot be null');
463463
}
464-
$allowedValues = $this->getEnumStringAllowableValues();
464+
$allowedValues = self::getEnumStringAllowableValues();
465465
if (!in_array($enum_string, $allowedValues, true)) {
466466
throw new InvalidArgumentException(
467467
sprintf(
@@ -498,7 +498,7 @@ public function setEnumStringRequired(string $enum_string_required): static
498498
if (is_null($enum_string_required)) {
499499
throw new InvalidArgumentException('non-nullable enum_string_required cannot be null');
500500
}
501-
$allowedValues = $this->getEnumStringRequiredAllowableValues();
501+
$allowedValues = self::getEnumStringRequiredAllowableValues();
502502
if (!in_array($enum_string_required, $allowedValues, true)) {
503503
throw new InvalidArgumentException(
504504
sprintf(
@@ -535,7 +535,7 @@ public function setEnumInteger(?int $enum_integer): static
535535
if (is_null($enum_integer)) {
536536
throw new InvalidArgumentException('non-nullable enum_integer cannot be null');
537537
}
538-
$allowedValues = $this->getEnumIntegerAllowableValues();
538+
$allowedValues = self::getEnumIntegerAllowableValues();
539539
if (!in_array($enum_integer, $allowedValues, true)) {
540540
throw new InvalidArgumentException(
541541
sprintf(
@@ -572,7 +572,7 @@ public function setEnumNumber(?float $enum_number): static
572572
if (is_null($enum_number)) {
573573
throw new InvalidArgumentException('non-nullable enum_number cannot be null');
574574
}
575-
$allowedValues = $this->getEnumNumberAllowableValues();
575+
$allowedValues = self::getEnumNumberAllowableValues();
576576
if (!in_array($enum_number, $allowedValues, true)) {
577577
throw new InvalidArgumentException(
578578
sprintf(

samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/MapTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public function setMapOfEnumString(?array $map_of_enum_string): static
372372
if (is_null($map_of_enum_string)) {
373373
throw new InvalidArgumentException('non-nullable map_of_enum_string cannot be null');
374374
}
375-
$allowedValues = $this->getMapOfEnumStringAllowableValues();
375+
$allowedValues = self::getMapOfEnumStringAllowableValues();
376376
if (array_diff($map_of_enum_string, $allowedValues)) {
377377
throw new InvalidArgumentException(
378378
sprintf(

0 commit comments

Comments
 (0)