Skip to content

Commit

Permalink
Improve Book typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
loic425 committed Dec 14, 2023
1 parent e20417e commit a4f0ee5
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions tests/Application/src/Entity/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Book implements ResourceInterface, TranslatableInterface
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private int $id;
private ?int $id = null;

/**
* @Serializer\Expose
Expand All @@ -51,46 +51,32 @@ class Book implements ResourceInterface, TranslatableInterface
#[ORM\Column(length: 255)]
private ?string $author = null;

/**
* @return int
*/
public function getId()
public function getId(): ?int
{
return $this->id;
}

/**
* @return string
*
* @Serializer\VirtualProperty()
*
* @Serializer\SerializedName("title")
*/
public function getTitle()
public function getTitle(): ?string
{
return $this->getTranslation()->getTitle();
}

/**
* @param string $title
*/
public function setTitle($title)
public function setTitle(?string $title): void
{
$this->getTranslation()->setTitle($title);
}

/**
* @return string
*/
public function getAuthor()
public function getAuthor(): ?string
{
return $this->author;
}

/**
* @param string $author
*/
public function setAuthor($author)
public function setAuthor(?string $author): void
{
$this->author = $author;
}
Expand Down

0 comments on commit a4f0ee5

Please sign in to comment.