From a1c3ba8543e2351f0781614de402f5a0f868c38c Mon Sep 17 00:00:00 2001 From: Meritoo Date: Thu, 20 Jun 2019 20:21:14 +0200 Subject: [PATCH] Fix "Cannot call method sub 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 6b614f6..4d950fa 100644 --- a/src/Utilities/Date.php +++ b/src/Utilities/Date.php @@ -125,7 +125,10 @@ class Date if (null !== $nextMonth) { $dateEnd = $nextMonth->getStartDate(); - $dateEnd->sub(new DateInterval('P1D')); + + if (null !== $dateEnd) { + $dateEnd->sub(new DateInterval('P1D')); + } } break;