Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ a release.
---

## [Unreleased]
### New
- Timestampable: Add types to createdAt and updatedAt
### Deprecated
- Sluggable: Annotation-specific mapping parameters (#2837)

Expand Down
12 changes: 6 additions & 6 deletions src/Timestampable/Traits/Timestampable.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ trait Timestampable
/**
* @var \DateTime|null
*/
protected $createdAt;
protected ?\DateTime $createdAt;

/**
* @var \DateTime|null
*/
protected $updatedAt;
protected ?\DateTime $updatedAt;

/**
* Sets createdAt.
*
* @return $this
*/
public function setCreatedAt(\DateTime $createdAt)
public function setCreatedAt(\DateTime $createdAt): static
{
$this->createdAt = $createdAt;

Expand All @@ -45,7 +45,7 @@ public function setCreatedAt(\DateTime $createdAt)
*
* @return \DateTime|null
*/
public function getCreatedAt()
public function getCreatedAt(): ?\DateTime
{
return $this->createdAt;
}
Expand All @@ -55,7 +55,7 @@ public function getCreatedAt()
*
* @return $this
*/
public function setUpdatedAt(\DateTime $updatedAt)
public function setUpdatedAt(\DateTime $updatedAt): static
{
$this->updatedAt = $updatedAt;

Expand All @@ -67,7 +67,7 @@ public function setUpdatedAt(\DateTime $updatedAt)
*
* @return \DateTime|null
*/
public function getUpdatedAt()
public function getUpdatedAt(): ?\DateTime
{
return $this->updatedAt;
}
Expand Down
12 changes: 6 additions & 6 deletions src/Timestampable/Traits/TimestampableEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trait TimestampableEntity
*/
#[Gedmo\Timestampable(on: 'create')]
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
protected $createdAt;
protected ?\DateTime $createdAt;

/**
* @var \DateTime|null
Expand All @@ -42,14 +42,14 @@ trait TimestampableEntity
*/
#[Gedmo\Timestampable(on: 'update')]
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
protected $updatedAt;
protected ?\DateTime $updatedAt;

/**
* Sets createdAt.
*
* @return $this
*/
public function setCreatedAt(\DateTime $createdAt)
public function setCreatedAt(\DateTime $createdAt): static
{
$this->createdAt = $createdAt;

Expand All @@ -61,7 +61,7 @@ public function setCreatedAt(\DateTime $createdAt)
*
* @return \DateTime|null
*/
public function getCreatedAt()
public function getCreatedAt(): ?\DateTime
{
return $this->createdAt;
}
Expand All @@ -71,7 +71,7 @@ public function getCreatedAt()
*
* @return $this
*/
public function setUpdatedAt(\DateTime $updatedAt)
public function setUpdatedAt(\DateTime $updatedAt): static
{
$this->updatedAt = $updatedAt;

Expand All @@ -83,7 +83,7 @@ public function setUpdatedAt(\DateTime $updatedAt)
*
* @return \DateTime|null
*/
public function getUpdatedAt()
public function getUpdatedAt(): ?\DateTime
{
return $this->updatedAt;
}
Expand Down