You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public function setDate(?\DateTimeImmutable $date): self
{
$this->date = $date;
return $this;
}
public function getDate(): ?\DateTimeImmutable
{
return $this->date;
}
(note that typehint is \DateTimeImmutable, not \DateTimeInterface)
While this is technically correct from Doctrine's point of view, it will be better to prefer interface as typehint, especially when it is explicitly used in property's type.
The text was updated successfully, but these errors were encountered:
I'm currently working on the development of version 2.1, which will include the functionality to utilize PHP property types for getters/setters, including both the PHP property type and whether the property can be nullable. This will become the default behavior in version 3.0.
I will update this ticket once this feature becomes available.
In the meantime, if you wish to modify this behavior, you can override the Twig template.
Given the following property
generated output will be:
(note that typehint is \DateTimeImmutable, not \DateTimeInterface)
While this is technically correct from Doctrine's point of view, it will be better to prefer interface as typehint, especially when it is explicitly used in property's type.
The text was updated successfully, but these errors were encountered: