Skip to content

Commit

Permalink
Add return types to getter and fluent setter (OpenAPITools#5348)
Browse files Browse the repository at this point in the history
* Add return types to getter and fluent setter

* Add build example output
  • Loading branch information
xvilo authored Feb 25, 2020
1 parent b05df5d commit c0fcffd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}
*
* @return {{{vendorExtensions.x-comment-type}}}{{^required}}|null{{/required}}
*/
public function {{getter}}()
public function {{getter}}(){{#vendorExtensions.x-parameter-type}}: {{^required}}?{{/required}}{{vendorExtensions.x-parameter-type}}{{/vendorExtensions.x-parameter-type}}
{
return $this->{{name}};
}
Expand All @@ -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}}){{#vendorExtensions.x-parameter-type}}: {{^required}}?{{/required}}{{vendorExtensions.x-parameter-type}}{{/vendorExtensions.x-parameter-type}}
{
$this->{{name}} = ${{name}};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function setQuantity($quantity = null)
*
* @return \DateTime|null
*/
public function getShipDate()
public function getShipDate(): ?\DateTime
{
return $this->shipDate;
}
Expand All @@ -197,7 +197,7 @@ public function getShipDate()
*
* @return $this
*/
public function setShipDate(\DateTime $shipDate = null)
public function setShipDate(\DateTime $shipDate = null): ?\DateTime
{
$this->shipDate = $shipDate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function setId($id = null)
*
* @return OpenAPI\Server\Model\Category|null
*/
public function getCategory()
public function getCategory(): ?Category
{
return $this->category;
}
Expand All @@ -155,7 +155,7 @@ public function getCategory()
*
* @return $this
*/
public function setCategory(Category $category = null)
public function setCategory(Category $category = null): ?Category
{
$this->category = $category;

Expand Down Expand Up @@ -191,7 +191,7 @@ public function setName($name)
*
* @return string[]
*/
public function getPhotoUrls()
public function getPhotoUrls(): array
{
return $this->photoUrls;
}
Expand All @@ -203,7 +203,7 @@ public function getPhotoUrls()
*
* @return $this
*/
public function setPhotoUrls(array $photoUrls)
public function setPhotoUrls(array $photoUrls): array
{
$this->photoUrls = $photoUrls;

Expand All @@ -215,7 +215,7 @@ public function setPhotoUrls(array $photoUrls)
*
* @return OpenAPI\Server\Model\Tag[]|null
*/
public function getTags()
public function getTags(): ?array
{
return $this->tags;
}
Expand All @@ -227,7 +227,7 @@ public function getTags()
*
* @return $this
*/
public function setTags(array $tags = null)
public function setTags(array $tags = null): ?array
{
$this->tags = $tags;

Expand Down

0 comments on commit c0fcffd

Please sign in to comment.