From 07dd97158f9fd0eea9e6160caf97054850e16415 Mon Sep 17 00:00:00 2001 From: reznikartem Date: Wed, 29 Apr 2020 16:37:09 +0200 Subject: [PATCH] Add return self type hint for setters --- .../resources/php-symfony/model_generic.mustache | 2 +- .../SymfonyBundle-php/Model/ApiResponse.php | 6 +++--- .../SymfonyBundle-php/Model/Category.php | 4 ++-- .../SymfonyBundle-php/Model/Order.php | 12 ++++++------ .../php-symfony/SymfonyBundle-php/Model/Pet.php | 12 ++++++------ .../php-symfony/SymfonyBundle-php/Model/Tag.php | 4 ++-- .../php-symfony/SymfonyBundle-php/Model/User.php | 16 ++++++++-------- 7 files changed, 28 insertions(+), 28 deletions(-) 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 54b34b9f903d..d8beef5b8db6 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 @@ -35,7 +35,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} * * @return $this */ - public function {{setter}}({{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{name}}{{^required}} = null{{/required}}) + public function {{setter}}({{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{name}}{{^required}} = null{{/required}}): self { $this->{{name}} = ${{name}}; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/ApiResponse.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/ApiResponse.php index 3c541cc76f9f..7e9a4f55b072 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/ApiResponse.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/ApiResponse.php @@ -95,7 +95,7 @@ public function getCode() * * @return $this */ - public function setCode($code = null) + public function setCode($code = null): self { $this->code = $code; @@ -119,7 +119,7 @@ public function getType() * * @return $this */ - public function setType($type = null) + public function setType($type = null): self { $this->type = $type; @@ -143,7 +143,7 @@ public function getMessage() * * @return $this */ - public function setMessage($message = null) + public function setMessage($message = null): self { $this->message = $message; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Category.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Category.php index b4c6f965236e..db6fe732a460 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Category.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Category.php @@ -86,7 +86,7 @@ public function getId() * * @return $this */ - public function setId($id = null) + public function setId($id = null): self { $this->id = $id; @@ -110,7 +110,7 @@ public function getName() * * @return $this */ - public function setName($name = null) + public function setName($name = null): self { $this->name = $name; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php index c79445f90cfd..8f7eda92510f 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php @@ -125,7 +125,7 @@ public function getId() * * @return $this */ - public function setId($id = null) + public function setId($id = null): self { $this->id = $id; @@ -149,7 +149,7 @@ public function getPetId() * * @return $this */ - public function setPetId($petId = null) + public function setPetId($petId = null): self { $this->petId = $petId; @@ -173,7 +173,7 @@ public function getQuantity() * * @return $this */ - public function setQuantity($quantity = null) + public function setQuantity($quantity = null): self { $this->quantity = $quantity; @@ -197,7 +197,7 @@ public function getShipDate(): ?\DateTime * * @return $this */ - public function setShipDate(\DateTime $shipDate = null) + public function setShipDate(\DateTime $shipDate = null): self { $this->shipDate = $shipDate; @@ -221,7 +221,7 @@ public function getStatus() * * @return $this */ - public function setStatus($status = null) + public function setStatus($status = null): self { $this->status = $status; @@ -245,7 +245,7 @@ public function isComplete() * * @return $this */ - public function setComplete($complete = null) + public function setComplete($complete = null): self { $this->complete = $complete; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php index d97cfb942a4a..517c7f9b2c2a 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php @@ -131,7 +131,7 @@ public function getId() * * @return $this */ - public function setId($id = null) + public function setId($id = null): self { $this->id = $id; @@ -155,7 +155,7 @@ public function getCategory(): ?Category * * @return $this */ - public function setCategory(Category $category = null) + public function setCategory(Category $category = null): self { $this->category = $category; @@ -179,7 +179,7 @@ public function getName() * * @return $this */ - public function setName($name) + public function setName($name): self { $this->name = $name; @@ -203,7 +203,7 @@ public function getPhotoUrls(): array * * @return $this */ - public function setPhotoUrls(array $photoUrls) + public function setPhotoUrls(array $photoUrls): self { $this->photoUrls = $photoUrls; @@ -227,7 +227,7 @@ public function getTags(): ?array * * @return $this */ - public function setTags(array $tags = null) + public function setTags(array $tags = null): self { $this->tags = $tags; @@ -251,7 +251,7 @@ public function getStatus() * * @return $this */ - public function setStatus($status = null) + public function setStatus($status = null): self { $this->status = $status; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Tag.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Tag.php index 404309c82618..5efe10669ce3 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Tag.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Tag.php @@ -86,7 +86,7 @@ public function getId() * * @return $this */ - public function setId($id = null) + public function setId($id = null): self { $this->id = $id; @@ -110,7 +110,7 @@ public function getName() * * @return $this */ - public function setName($name = null) + public function setName($name = null): self { $this->name = $name; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/User.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/User.php index b79d83bf0c2e..01bdec610972 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/User.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/User.php @@ -142,7 +142,7 @@ public function getId() * * @return $this */ - public function setId($id = null) + public function setId($id = null): self { $this->id = $id; @@ -166,7 +166,7 @@ public function getUsername() * * @return $this */ - public function setUsername($username = null) + public function setUsername($username = null): self { $this->username = $username; @@ -190,7 +190,7 @@ public function getFirstName() * * @return $this */ - public function setFirstName($firstName = null) + public function setFirstName($firstName = null): self { $this->firstName = $firstName; @@ -214,7 +214,7 @@ public function getLastName() * * @return $this */ - public function setLastName($lastName = null) + public function setLastName($lastName = null): self { $this->lastName = $lastName; @@ -238,7 +238,7 @@ public function getEmail() * * @return $this */ - public function setEmail($email = null) + public function setEmail($email = null): self { $this->email = $email; @@ -262,7 +262,7 @@ public function getPassword() * * @return $this */ - public function setPassword($password = null) + public function setPassword($password = null): self { $this->password = $password; @@ -286,7 +286,7 @@ public function getPhone() * * @return $this */ - public function setPhone($phone = null) + public function setPhone($phone = null): self { $this->phone = $phone; @@ -310,7 +310,7 @@ public function getUserStatus() * * @return $this */ - public function setUserStatus($userStatus = null) + public function setUserStatus($userStatus = null): self { $this->userStatus = $userStatus;