Skip to content

Commit

Permalink
Fix PHP 8 error in Template.php
Browse files Browse the repository at this point in the history
Required parameter $closure follows optional parameter $date

fixes whitecube#76
  • Loading branch information
martijngastkemper committed Jan 20, 2021
1 parent b1264c3 commit 1ebbe68
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Pages/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,12 @@ public function setDate($moment, $date = null)
* @param Closure $closure
* @return mixed
*/
public function setDateIf($moment, $date = null, Closure $closure)
public function setDateIf($moment, $date = null, Closure $closure = null)
{
if(!($date instanceof Carbon)) {
$date = new Carbon($date);
}

if($closure($date, $this->getDate($moment))) {
if($closure && $closure($date, $this->getDate($moment))) {
return $this->setDate($moment, $date);
}
}
Expand Down

0 comments on commit 1ebbe68

Please sign in to comment.