22
33namespace Safe ;
44
5- use DateInterval ;
6- use DateTime ;
7- use DateTimeInterface ;
8- use DateTimeZone ;
95use Safe \Exceptions \DatetimeException ;
106
117/**
@@ -23,7 +19,7 @@ class DateTimeImmutable extends \DateTimeImmutable
2319 /**
2420 * DateTimeImmutable constructor.
2521 * @param string $time
26- * @param DateTimeZone|null $timezone
22+ * @param \ DateTimeZone|null $timezone
2723 * @throws \Exception
2824 */
2925 public function __construct ($ time = 'now ' , $ timezone = null )
@@ -52,7 +48,7 @@ public function getInnerDateTime(): \DateTimeImmutable
5248 /**
5349 * @param string $format
5450 * @param string $time
55- * @param DateTimeZone|null $timezone
51+ * @param \ DateTimeZone|null $timezone
5652 * @throws DatetimeException
5753 */
5854 public static function createFromFormat ($ format , $ time , $ timezone = null )
@@ -80,12 +76,12 @@ public function format($format): string
8076 }
8177
8278 /**
83- * @param DateTimeInterface $datetime2
79+ * @param \ DateTimeInterface $datetime2
8480 * @param bool $absolute
85- * @return DateInterval
81+ * @return \ DateInterval
8682 * @throws DatetimeException
8783 */
88- public function diff ($ datetime2 , $ absolute = false ): DateInterval
84+ public function diff ($ datetime2 , $ absolute = false ): \ DateInterval
8985 {
9086 /** @var \DateInterval|false $result */
9187 $ result = $ this ->innerDateTime ->diff ($ datetime2 , $ absolute );
@@ -178,7 +174,7 @@ public function setTimestamp($unixtimestamp): self
178174 }
179175
180176 /**
181- * @param DateTimeZone $timezone
177+ * @param \ DateTimeZone $timezone
182178 * @return DateTimeImmutable
183179 * @throws DatetimeException
184180 */
@@ -193,7 +189,7 @@ public function setTimezone($timezone): self
193189 }
194190
195191 /**
196- * @param DateInterval $interval
192+ * @param \ DateInterval $interval
197193 * @return DateTimeImmutable
198194 * @throws DatetimeException
199195 */
@@ -224,7 +220,7 @@ public function getOffset(): int
224220 //overload getters to use the inner datetime immutable instead of itself
225221
226222 /**
227- * @param DateInterval $interval
223+ * @param \ DateInterval $interval
228224 * @return DateTimeImmutable
229225 */
230226 public function add ($ interval ): self
@@ -233,12 +229,14 @@ public function add($interval): self
233229 }
234230
235231 /**
236- * @param DateTime $dateTime
232+ * @param \ DateTime $dateTime
237233 * @return DateTimeImmutable
238234 */
239235 public static function createFromMutable ($ dateTime ): self
240236 {
241- return self ::createFromRegular (parent ::createFromMutable ($ dateTime ));
237+ $ date = \DateTimeImmutable::createFromMutable ($ dateTime );
238+
239+ return self ::createFromRegular ($ date );
242240 }
243241
244242 /**
@@ -250,7 +248,7 @@ public static function __set_state($array): self
250248 return self ::createFromRegular (parent ::__set_state ($ array ));
251249 }
252250
253- public function getTimezone (): DateTimeZone
251+ public function getTimezone (): \ DateTimeZone
254252 {
255253 return $ this ->innerDateTime ->getTimezone ();
256254 }
0 commit comments