diff --git a/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache b/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache index 9dba64f5345c..962a4cdb2d59 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache @@ -52,7 +52,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} */ public function getSerialized{{nameInPascalCase}}(): string|null { - return $this->{{name}}?->value ? (string) $this->{{name}}->value : null; + return !is_null($this->{{name}}?->value) ? (string) $this->{{name}}->value : null; } /**