From ad9e2395ac22f8ec6c5c3076455f802e0b329858 Mon Sep 17 00:00:00 2001 From: Andre Praca Date: Wed, 28 Apr 2021 10:08:50 +0300 Subject: [PATCH] [PHP] Fix parentSchema conditional causing parent call when parent isn't present (#8705) * Fix parentSchema conditional we cannot call `parent::` if parent isn't present. Everywhere else in the schema we're checking for `{{parentSchema}}` but here we're checking for `{{parent}}` which is causing errors when parent is not present * Update samples --- .../src/main/resources/php/model_generic.mustache | 8 ++++---- .../php/OpenAPIClient-php/lib/Model/NullableClass.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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 276b2bd9d8c..64bb657af16 100644 --- a/modules/openapi-generator/src/main/resources/php/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/php/model_generic.mustache @@ -188,12 +188,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par */ public function listInvalidProperties() { - {{#parent}} + {{#parentSchema}} $invalidProperties = parent::listInvalidProperties(); - {{/parent}} - {{^parent}} + {{/parentSchema}} + {{^parentSchema}} $invalidProperties = []; - {{/parent}} + {{/parentSchema}} {{#vars}} {{#required}} 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 353f25b955c..95cfccff0f3 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php @@ -254,7 +254,7 @@ class NullableClass implements ModelInterface, ArrayAccess, \JsonSerializable */ public function listInvalidProperties() { - $invalidProperties = parent::listInvalidProperties(); + $invalidProperties = []; return $invalidProperties; }