forked from loafle/openapi-generator-original
[php-symfony] Fix return type in model setters. (#6085)
* Fix return type in model setters. Previously return type was same, as method arguments. It`s wrong, and cause errors like "Return value of Foo::setSuccess() must be of the type bool, object returned" We cant use self and current {{classname}} as return type, because that can break class inheritance. So, better remove type hint on setters, until PHP-devs dont make realization for return static * Add return self type hint for setters * Revert "Add return self type hint for setters" This reverts commit 07dd9715
This commit is contained in:
parent
3bbaedd9bc
commit
0032e04530
@ -35,7 +35,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function {{setter}}({{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{name}}{{^required}} = null{{/required}}){{#vendorExtensions.x-parameter-type}}: {{^required}}?{{/required}}{{vendorExtensions.x-parameter-type}}{{/vendorExtensions.x-parameter-type}}
|
public function {{setter}}({{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{name}}{{^required}} = null{{/required}})
|
||||||
{
|
{
|
||||||
$this->{{name}} = ${{name}};
|
$this->{{name}} = ${{name}};
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ class Order
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setShipDate(\DateTime $shipDate = null): ?\DateTime
|
public function setShipDate(\DateTime $shipDate = null)
|
||||||
{
|
{
|
||||||
$this->shipDate = $shipDate;
|
$this->shipDate = $shipDate;
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ class Pet
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setCategory(Category $category = null): ?Category
|
public function setCategory(Category $category = null)
|
||||||
{
|
{
|
||||||
$this->category = $category;
|
$this->category = $category;
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ class Pet
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setPhotoUrls(array $photoUrls): array
|
public function setPhotoUrls(array $photoUrls)
|
||||||
{
|
{
|
||||||
$this->photoUrls = $photoUrls;
|
$this->photoUrls = $photoUrls;
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ class Pet
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setTags(array $tags = null): ?array
|
public function setTags(array $tags = null)
|
||||||
{
|
{
|
||||||
$this->tags = $tags;
|
$this->tags = $tags;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user