From 4ddc299e5bd5383da8a0dd653a38ccad832a150b Mon Sep 17 00:00:00 2001 From: Meritoo Date: Thu, 20 Jun 2019 21:04:44 +0200 Subject: [PATCH] Fix "Cannot call method add on possibly null value" bug pointed by Psalm --- src/Utilities/Date.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Utilities/Date.php b/src/Utilities/Date.php index 30ff7d1..421b411 100644 --- a/src/Utilities/Date.php +++ b/src/Utilities/Date.php @@ -120,7 +120,10 @@ class Date if (null !== $lastMonth) { $dateStart = $lastMonth->getEndDate(); - $dateStart->add(new DateInterval('P1D')); + + if (null !== $dateStart) { + $dateStart->add(new DateInterval('P1D')); + } } if (null !== $nextMonth) {