Fix "Cannot call method sub on possibly null value" bug pointed by Psalm

This commit is contained in:
Meritoo
2019-06-20 20:21:14 +02:00
parent 6efbf940a3
commit a1c3ba8543

View File

@@ -125,7 +125,10 @@ class Date
if (null !== $nextMonth) { if (null !== $nextMonth) {
$dateEnd = $nextMonth->getStartDate(); $dateEnd = $nextMonth->getStartDate();
$dateEnd->sub(new DateInterval('P1D'));
if (null !== $dateEnd) {
$dateEnd->sub(new DateInterval('P1D'));
}
} }
break; break;