Skip to content

Commit ad9e239

Browse files
authored
[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
1 parent 4aaaae7 commit ad9e239

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
188188
*/
189189
public function listInvalidProperties()
190190
{
191-
{{#parent}}
191+
{{#parentSchema}}
192192
$invalidProperties = parent::listInvalidProperties();
193-
{{/parent}}
194-
{{^parent}}
193+
{{/parentSchema}}
194+
{{^parentSchema}}
195195
$invalidProperties = [];
196-
{{/parent}}
196+
{{/parentSchema}}
197197

198198
{{#vars}}
199199
{{#required}}

samples/client/petstore/php/OpenAPIClient-php/lib/Model/NullableClass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public function __construct(array $data = null)
254254
*/
255255
public function listInvalidProperties()
256256
{
257-
$invalidProperties = parent::listInvalidProperties();
257+
$invalidProperties = [];
258258

259259
return $invalidProperties;
260260
}

0 commit comments

Comments
 (0)