Daniel Metzner 3b15bb8a4e
[PHP] Enhance Symfony generator (#12532)
* Enhance Symfony generator

  - Add missing typehints
  - Add missing use statements
  - Simplify model ctor
  - Change fallthrough Exception to Throwable
  - prevent storing result of void methods
  - fix validate method
  - add default null values to model properties
  - simplify API interface return values
  - fix/rework default value implementation
  - fix optional params deprecation warnings
  - ..

For more details check out the PR: https://github.com/OpenAPITools/openapi-generator/pull/12532

* Enhance Symfony generator Tests

  - Skip risky tests
  - Fix type hint error
  - Fix class exists tests
  - Fix broken doc block
  - Enhance annotations
  - Update phpunit.xml.dist
  - Fix test config resource location
2022-06-25 20:53:21 +08:00

263 lines
4.9 KiB
PHP

<?php
/**
* Pet
*
* PHP version 8.1.1
*
* @category Class
* @package OpenAPI\Server\Model
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPI\Server\Model;
use Symfony\Component\Validator\Constraints as Assert;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\SerializedName;
/**
* Class representing the Pet model.
*
* A pet for sale in the pet store
*
* @package OpenAPI\Server\Model
* @author OpenAPI Generator team
*/
class Pet
{
/**
* @var int|null
* @SerializedName("id")
* @Assert\Type("int")
* @Type("int")
*/
protected ?int $id = null;
/**
* @var Category|null
* @SerializedName("category")
* @Assert\Type("OpenAPI\Server\Model\Category")
* @Type("OpenAPI\Server\Model\Category")
*/
protected ?Category $category = null;
/**
* @var string|null
* @SerializedName("name")
* @Assert\NotNull()
* @Assert\Type("string")
* @Type("string")
*/
protected ?string $name = null;
/**
* @var array|null
* @SerializedName("photoUrls")
* @Assert\NotNull()
* @Assert\All({
* @Assert\Type("string")
* })
* @Type("array<string>")
*/
protected ?array $photoUrls = null;
/**
* @var array|null
* @SerializedName("tags")
* @Assert\All({
* @Assert\Type("OpenAPI\Server\Model\Tag")
* })
* @Type("array<OpenAPI\Server\Model\Tag>")
*/
protected ?array $tags = null;
/**
* pet status in the store
*
* @var string|null
* @SerializedName("status")
* @Assert\Choice({ "available", "pending", "sold" })
* @Assert\Type("string")
* @Type("string")
*/
protected ?string $status = null;
/**
* Constructor
* @param array|null $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
$this->id = $data['id'] ?? null;
$this->category = $data['category'] ?? null;
$this->name = $data['name'] ?? null;
$this->photoUrls = $data['photoUrls'] ?? null;
$this->tags = $data['tags'] ?? null;
$this->status = $data['status'] ?? null;
}
/**
* Gets id.
*
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* Sets id.
*
* @param int|null $id
*
* @return $this
*/
public function setId(?int $id = null): self
{
$this->id = $id;
return $this;
}
/**
* Gets category.
*
* @return Category|null
*/
public function getCategory(): ?Category
{
return $this->category;
}
/**
* Sets category.
*
* @param Category|null $category
*
* @return $this
*/
public function setCategory(?Category $category = null): self
{
$this->category = $category;
return $this;
}
/**
* Gets name.
*
* @return string|null
*/
public function getName(): ?string
{
return $this->name;
}
/**
* Sets name.
*
* @param string|null $name
*
* @return $this
*/
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
/**
* Gets photoUrls.
*
* @return array|null
*/
public function getPhotoUrls(): ?array
{
return $this->photoUrls;
}
/**
* Sets photoUrls.
*
* @param array|null $photoUrls
*
* @return $this
*/
public function setPhotoUrls(?array $photoUrls): self
{
$this->photoUrls = $photoUrls;
return $this;
}
/**
* Gets tags.
*
* @return array|null
*/
public function getTags(): ?array
{
return $this->tags;
}
/**
* Sets tags.
*
* @param array|null $tags
*
* @return $this
*/
public function setTags(?array $tags = null): self
{
$this->tags = $tags;
return $this;
}
/**
* Gets status.
*
* @return string|null
*/
public function getStatus(): ?string
{
return $this->status;
}
/**
* Sets status.
*
* @param string|null $status pet status in the store
*
* @return $this
*/
public function setStatus(?string $status = null): self
{
$this->status = $status;
return $this;
}
}