public function setDate($year, $month, $day)
{
// Workaround for PHP issue.
$date = $this->modify('+0 day');
if ($this instanceof DateTimeImmutable) {
// Reflection is necessary to access the parent method
// of the immutable object
$method = new \ReflectionMethod('DateTimeImmutable', 'setDate');
return $method->invoke($date, $year, $month, $day);
}
return parent::setDate($year, $month, $day);
}