forked from loafle/openapi-generator-original
Add return types to getter and fluent setter (#5348)
* Add return types to getter and fluent setter * Add build example output
This commit is contained in:
@@ -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}};
|
||||
}
|
||||
@@ -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}};
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ class Order
|
||||
*
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getShipDate()
|
||||
public function getShipDate(): ?\DateTime
|
||||
{
|
||||
return $this->shipDate;
|
||||
}
|
||||
@@ -197,7 +197,7 @@ class Order
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setShipDate(\DateTime $shipDate = null)
|
||||
public function setShipDate(\DateTime $shipDate = null): ?\DateTime
|
||||
{
|
||||
$this->shipDate = $shipDate;
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ class Pet
|
||||
*
|
||||
* @return OpenAPI\Server\Model\Category|null
|
||||
*/
|
||||
public function getCategory()
|
||||
public function getCategory(): ?Category
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ class Pet
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCategory(Category $category = null)
|
||||
public function setCategory(Category $category = null): ?Category
|
||||
{
|
||||
$this->category = $category;
|
||||
|
||||
@@ -191,7 +191,7 @@ class Pet
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getPhotoUrls()
|
||||
public function getPhotoUrls(): array
|
||||
{
|
||||
return $this->photoUrls;
|
||||
}
|
||||
@@ -203,7 +203,7 @@ class Pet
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPhotoUrls(array $photoUrls)
|
||||
public function setPhotoUrls(array $photoUrls): array
|
||||
{
|
||||
$this->photoUrls = $photoUrls;
|
||||
|
||||
@@ -215,7 +215,7 @@ class Pet
|
||||
*
|
||||
* @return OpenAPI\Server\Model\Tag[]|null
|
||||
*/
|
||||
public function getTags()
|
||||
public function getTags(): ?array
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ class Pet
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTags(array $tags = null)
|
||||
public function setTags(array $tags = null): ?array
|
||||
{
|
||||
$this->tags = $tags;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user