Skip to content

Commit

Permalink
ReleaseDate === "" (empty) should be set to null
Browse files Browse the repository at this point in the history
Fixed setter and annotation of getter
  • Loading branch information
ptheofan authored Sep 25, 2021
1 parent e330e8f commit 9ca2267
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Tmdb/Model/Movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ public function setProductionCountries(GenericCollection $productionCountries)
}

/**
* @return DateTime
* @return ?DateTime
*/
public function getReleaseDate()
{
Expand All @@ -580,7 +580,9 @@ public function getReleaseDate()
*/
public function setReleaseDate($releaseDate = null)
{
if (!$releaseDate instanceof DateTime && $releaseDate !== null) {
if (empty($releaseDate)) {
$this->releaseDate = null;
} elseif (!$releaseDate instanceof DateTime) {
$releaseDate = new DateTime($releaseDate);
}

Expand Down

0 comments on commit 9ca2267

Please sign in to comment.