From 651e305d1487dae08efb9774940950d1bd01d805 Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Tue, 29 Oct 2024 17:47:59 +0100 Subject: [PATCH] fix: if model filed has type `any` we should generate it as `mixed` --- template/model_generic.mustache | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/template/model_generic.mustache b/template/model_generic.mustache index b7abd04..24541ec 100644 --- a/template/model_generic.mustache +++ b/template/model_generic.mustache @@ -246,9 +246,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa /** * Gets {{name}} - * @return {{^required}}?{{/required}}{{datatype}} + * @return {{^required}}{{#datatype}}?{{/datatype}}{{/required}}{{datatype}}{{^datatype}}mixed{{/datatype}} */ - public function {{getter}}(): {{^required}}?{{/required}}{{#required}}{{#nullable}}?{{/nullable}}{{/required}}{{^isListContainer}}{{^isMapContainer}}{{^isDouble}}{{datatype}}{{/isDouble}}{{/isMapContainer}}{{/isListContainer}}{{#isListContainer}}array{{/isListContainer}}{{#isMapContainer}}array{{/isMapContainer}}{{#isDouble}}float{{/isDouble}} + public function {{getter}}(): {{^required}}{{#datatype}}?{{/datatype}}{{/required}}{{#required}}{{#nullable}}?{{/nullable}}{{/required}}{{^isListContainer}}{{^isMapContainer}}{{^isDouble}}{{datatype}}{{/isDouble}}{{/isMapContainer}}{{/isListContainer}}{{#isListContainer}}array{{/isListContainer}}{{#isMapContainer}}array{{/isMapContainer}}{{#isDouble}}float{{/isDouble}}{{^datatype}}mixed{{/datatype}} { return $this->container['{{name}}']; } @@ -256,11 +256,11 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa /** * Sets {{name}} * - * @param {{^required}}?{{/required}}{{datatype}} ${{name}}{{#description}} {{{description}}}{{/description}}{{^description}} {{{name}}}{{/description}} + * @param {{^required}}{{#datatype}}?{{/datatype}}{{/required}}{{datatype}}{{^datatype}}mixed{{/datatype}} ${{name}}{{#description}} {{{description}}}{{/description}}{{^description}} {{{name}}}{{/description}} * * @return $this */ - public function {{setter}}({{^required}}?{{/required}}{{#required}}{{#nullable}}?{{/nullable}}{{/required}}{{^isListContainer}}{{^isMapContainer}}{{^isDouble}}{{datatype}}{{/isDouble}}{{/isMapContainer}}{{/isListContainer}}{{#isListContainer}}array{{/isListContainer}}{{#isMapContainer}}array{{/isMapContainer}}{{#isDouble}}float{{/isDouble}} ${{name}}): self + public function {{setter}}({{^required}}{{#datatype}}?{{/datatype}}{{/required}}{{#required}}{{#nullable}}?{{/nullable}}{{/required}}{{^isListContainer}}{{^isMapContainer}}{{^isDouble}}{{datatype}}{{/isDouble}}{{/isMapContainer}}{{/isListContainer}}{{#isListContainer}}array{{/isListContainer}}{{#isMapContainer}}array{{/isMapContainer}}{{#isDouble}}float{{/isDouble}}{{^datatype}}mixed{{/datatype}} ${{name}}): self { {{#isEnum}} $allowedValues = $this->{{getter}}AllowableValues();