В типаже php можно использовать «self» или «object» в качестве типа возвращаемого значения такого метода, как метод setUpdatedAt (), и ссылка на класс, который использует черту или нет?
Мой вопрос действителен только в контексте «признака».
declare(strict_types=1);
trait Timestampable
{
/**
* @var \DateTimeInterface
* @ORM\Column(type="datetime")
*/
private \DateTimeInterface $createdAt;
/**
* @var \DateTimeInterface
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $updatedAt;
/**
* @return \DateTimeInterface
*/
public function getCreatedAt(): \DateTimeInterface
{
return $this->createdAt;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}