[Pkg-owncloud-commits] [php-sabre-vobject] 05/341: Work in progress on migration. Lots of issues still.

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 13:35:25 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabre-vobject.

commit e3d49e13fe59b565c7e05a0cff6639684bcab44a
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Sat Sep 20 03:23:11 2014 +0100

    Work in progress on migration. Lots of issues still.
---
 lib/Component/VAlarm.php                           |   2 +-
 lib/Component/VCalendar.php                        |   2 +-
 lib/Component/VEvent.php                           |  11 +-
 lib/Component/VFreeBusy.php                        |   9 +-
 lib/Component/VJournal.php                         |   9 +-
 lib/Component/VTodo.php                            |   9 +-
 lib/DateTimeParser.php                             |  19 +-
 lib/FreeBusyGenerator.php                          |  32 +-
 lib/Property/ICalendar/DateTime.php                |  74 +--
 lib/Property/ICalendar/Duration.php                |   8 +-
 lib/Property/ICalendar/Period.php                  |  22 +-
 lib/Property/Time.php                              |   6 +-
 lib/Property/VCard/Date.php                        |   2 +-
 lib/Property/VCard/DateAndOrTime.php               |  46 +-
 lib/Property/VCard/DateTime.php                    |   2 +-
 lib/Property/VCard/TimeStamp.php                   |   6 +-
 lib/Recur/EventIterator.php                        |  62 +--
 lib/Recur/RDateIterator.php                        |  26 +-
 lib/Recur/RRuleIterator.php                        | 102 +++--
 tests/VObject/DateTimeParserTest.php               | 148 +++---
 tests/VObject/EmClientTest.php                     |   4 +-
 tests/VObject/FreeBusyGeneratorTest.php            |  10 +-
 .../EventIterator/InfiniteLoopProblemTest.php      |  12 +-
 tests/VObject/Recur/EventIterator/Issue48Test.php  |   8 +-
 tests/VObject/Recur/EventIterator/Issue50Test.php  |  12 +-
 tests/VObject/Recur/EventIterator/MainTest.php     | 504 ++++++++++-----------
 tests/VObject/Recur/RDateIteratorTest.php          |  18 +-
 27 files changed, 589 insertions(+), 576 deletions(-)

diff --git a/lib/Component/VAlarm.php b/lib/Component/VAlarm.php
index 9ea9ac0..08b7cb5 100644
--- a/lib/Component/VAlarm.php
+++ b/lib/Component/VAlarm.php
@@ -82,7 +82,7 @@ class VAlarm extends VObject\Component {
      * @param DateTime $end
      * @return bool
      */
-    function isInTimeRange(DateTimeInterface $start, DateTimeIterface $end) {
+    function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
 
         $effectiveTrigger = $this->getEffectiveTriggerTime();
 
diff --git a/lib/Component/VCalendar.php b/lib/Component/VCalendar.php
index 3709dd9..0a07594 100644
--- a/lib/Component/VCalendar.php
+++ b/lib/Component/VCalendar.php
@@ -292,7 +292,7 @@ class VCalendar extends VObject\Document {
                     // We only need to update the first timezone, because
                     // setDateTimes will match all other timezones to the
                     // first.
-                    $dt[0]->setTimeZone(new \DateTimeZone('UTC'));
+                    $dt[0] = $dt[0]->setTimeZone(new \DateTimeZone('UTC'));
                     $child->setDateTimes($dt);
                 }
 
diff --git a/lib/Component/VEvent.php b/lib/Component/VEvent.php
index b943bde..ce6b5be 100644
--- a/lib/Component/VEvent.php
+++ b/lib/Component/VEvent.php
@@ -2,6 +2,7 @@
 
 namespace Sabre\VObject\Component;
 
+use DateTimeInterface;
 use Sabre\VObject;
 use Sabre\VObject\Recur\EventIterator;
 
@@ -23,11 +24,11 @@ class VEvent extends VObject\Component {
      * The rules used to determine if an event falls within the specified
      * time-range is based on the CalDAV specification.
      *
-     * @param \DateTime $start
-     * @param \DateTime $end
+     * @param DateTimeInterface $start
+     * @param DateTimeInterface $end
      * @return bool
      */
-    function isInTimeRange(\DateTime $start, \DateTime $end) {
+    function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
 
         if ($this->RRULE) {
             $it = new EventIterator($this);
@@ -56,10 +57,10 @@ class VEvent extends VObject\Component {
 
         } elseif (isset($this->DURATION)) {
             $effectiveEnd = clone $effectiveStart;
-            $effectiveEnd->add(VObject\DateTimeParser::parseDuration($this->DURATION));
+            $effectiveEnd = $effectiveEnd->add(VObject\DateTimeParser::parseDuration($this->DURATION));
         } elseif (!$this->DTSTART->hasTime()) {
             $effectiveEnd = clone $effectiveStart;
-            $effectiveEnd->modify('+1 day');
+            $effectiveEnd = $effectiveEnd->modify('+1 day');
         } else {
             $effectiveEnd = clone $effectiveStart;
         }
diff --git a/lib/Component/VFreeBusy.php b/lib/Component/VFreeBusy.php
index cea208e..7a360ff 100644
--- a/lib/Component/VFreeBusy.php
+++ b/lib/Component/VFreeBusy.php
@@ -2,6 +2,7 @@
 
 namespace Sabre\VObject\Component;
 
+use DateTimeInterface;
 use Sabre\VObject;
 
 /**
@@ -20,11 +21,11 @@ class VFreeBusy extends VObject\Component {
      * Checks based on the contained FREEBUSY information, if a timeslot is
      * available.
      *
-     * @param DateTime $start
-     * @param Datetime $end
+     * @param DateTimeInterface $start
+     * @param DateTimeInterface $end
      * @return bool
      */
-    function isFree(\DateTime $start, \Datetime $end) {
+    function isFree(DateTimeInterface $start, DatetimeInterface $end) {
 
         foreach($this->select('FREEBUSY') as $freebusy) {
 
@@ -48,7 +49,7 @@ class VFreeBusy extends VObject\Component {
                 $busyEnd = VObject\DateTimeParser::parse($busyEnd);
                 if ($busyEnd instanceof \DateInterval) {
                     $tmp = clone $busyStart;
-                    $tmp->add($busyEnd);
+                    $tmp = $tmp->add($busyEnd);
                     $busyEnd = $tmp;
                 }
 
diff --git a/lib/Component/VJournal.php b/lib/Component/VJournal.php
index 48a4631..92f8a80 100644
--- a/lib/Component/VJournal.php
+++ b/lib/Component/VJournal.php
@@ -2,6 +2,7 @@
 
 namespace Sabre\VObject\Component;
 
+use DateTimeInterface;
 use Sabre\VObject;
 
 /**
@@ -22,17 +23,17 @@ class VJournal extends VObject\Component {
      * The rules used to determine if an event falls within the specified
      * time-range is based on the CalDAV specification.
      *
-     * @param DateTime $start
-     * @param DateTime $end
+     * @param DateTimeInterface $start
+     * @param DateTimeInterface $end
      * @return bool
      */
-    function isInTimeRange(\DateTime $start, \DateTime $end) {
+    function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
 
         $dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
         if ($dtstart) {
             $effectiveEnd = clone $dtstart;
             if (!$this->DTSTART->hasTime()) {
-                $effectiveEnd->modify('+1 day');
+                $effectiveEnd = $effectiveEnd->modify('+1 day');
             }
 
             return ($start <= $effectiveEnd && $end > $dtstart);
diff --git a/lib/Component/VTodo.php b/lib/Component/VTodo.php
index 4e42a10..c0cb318 100644
--- a/lib/Component/VTodo.php
+++ b/lib/Component/VTodo.php
@@ -2,6 +2,7 @@
 
 namespace Sabre\VObject\Component;
 
+use DateTimeInterface;
 use Sabre\VObject;
 
 /**
@@ -22,11 +23,11 @@ class VTodo extends VObject\Component {
      * The rules used to determine if an event falls within the specified
      * time-range is based on the CalDAV specification.
      *
-     * @param DateTime $start
-     * @param DateTime $end
+     * @param DateTimeInterface $start
+     * @param DateTimeInterface $end
      * @return bool
      */
-    function isInTimeRange(\DateTime $start, \DateTime $end) {
+    function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end) {
 
         $dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
         $duration = isset($this->DURATION)?VObject\DateTimeParser::parseDuration($this->DURATION):null;
@@ -37,7 +38,7 @@ class VTodo extends VObject\Component {
         if ($dtstart) {
             if ($duration) {
                 $effectiveEnd = clone $dtstart;
-                $effectiveEnd->add($duration);
+                $effectiveEnd = $effectiveEnd->add($duration);
                 return $start <= $effectiveEnd && $end > $dtstart;
             } elseif ($due) {
                 return
diff --git a/lib/DateTimeParser.php b/lib/DateTimeParser.php
index f8f22df..25360e8 100644
--- a/lib/DateTimeParser.php
+++ b/lib/DateTimeParser.php
@@ -2,6 +2,8 @@
 
 namespace Sabre\VObject;
 
+use DateTimeImmutable;
+
 /**
  * DateTimeParser
  *
@@ -15,15 +17,16 @@ namespace Sabre\VObject;
 class DateTimeParser {
 
     /**
-     * Parses an iCalendar (rfc5545) formatted datetime and returns a DateTime object
+     * Parses an iCalendar (rfc5545) formatted datetime and returns a
+     * DateTimeImmutable object
      *
      * Specifying a reference timezone is optional. It will only be used
      * if the non-UTC format is used. The argument is used as a reference, the
-     * returned DateTime object will still be in the UTC timezone.
+     * returned DateTimeImmutable object will still be in the UTC timezone.
      *
      * @param string $dt
      * @param DateTimeZone $tz
-     * @return DateTime
+     * @return DateTimeImmutable
      */
     static function parseDateTime($dt, \DateTimeZone $tz = null) {
 
@@ -37,7 +40,7 @@ class DateTimeParser {
         if ($matches[7]==='Z' || is_null($tz)) {
             $tz = new \DateTimeZone('UTC');
         }
-        $date = new \DateTime($matches[1] . '-' . $matches[2] . '-' . $matches[3] . ' ' . $matches[4] . ':' . $matches[5] .':' . $matches[6], $tz);
+        $date = new DateTimeImmutable($matches[1] . '-' . $matches[2] . '-' . $matches[3] . ' ' . $matches[4] . ':' . $matches[5] .':' . $matches[6], $tz);
 
         // Still resetting the timezone, to normalize everything to UTC
         // $date->setTimeZone(new \DateTimeZone('UTC'));
@@ -46,10 +49,10 @@ class DateTimeParser {
     }
 
     /**
-     * Parses an iCalendar (rfc5545) formatted date and returns a DateTime object
+     * Parses an iCalendar (rfc5545) formatted date and returns a DateTimeImmutable object
      *
      * @param string $date
-     * @return DateTime
+     * @return DateTimeImmutable
      */
     static function parseDate($date) {
 
@@ -60,7 +63,7 @@ class DateTimeParser {
             throw new \LogicException('The supplied iCalendar date value is incorrect: ' . $date);
         }
 
-        $date = new \DateTime($matches[1] . '-' . $matches[2] . '-' . $matches[3], new \DateTimeZone('UTC'));
+        $date = new DateTimeImmutable($matches[1] . '-' . $matches[2] . '-' . $matches[3], new \DateTimeZone('UTC'));
         return $date;
 
     }
@@ -165,7 +168,7 @@ class DateTimeParser {
      *
      * @param string $date
      * @param DateTimeZone|string $referenceTZ
-     * @return DateTime|DateInterval
+     * @return DateTimeImmutable|DateInterval
      */
     static function parse($date, $referenceTZ = null) {
 
diff --git a/lib/FreeBusyGenerator.php b/lib/FreeBusyGenerator.php
index 321d2d4..043bdf3 100644
--- a/lib/FreeBusyGenerator.php
+++ b/lib/FreeBusyGenerator.php
@@ -2,6 +2,8 @@
 
 namespace Sabre\VObject;
 
+use DateTimeInterface;
+use DateTimeImmutable;
 use Sabre\VObject\Component\VCalendar;
 use Sabre\VObject\Recur\EventIterator;
 
@@ -26,19 +28,19 @@ class FreeBusyGenerator {
      *
      * @var array
      */
-    protected $objects;
+    protected $objects = [];
 
     /**
      * Start of range
      *
-     * @var DateTime|null
+     * @var DateTimeInterface|null
      */
     protected $start;
 
     /**
      * End of range
      *
-     * @var DateTime|null
+     * @var DateTimeInterface|null
      */
     protected $end;
 
@@ -55,12 +57,12 @@ class FreeBusyGenerator {
      * Check the setTimeRange and setObjects methods for details about the
      * arguments.
      *
-     * @param DateTime $start
-     * @param DateTime $end
+     * @param DateTimeInterface $start
+     * @param DateTimeInterface $end
      * @param mixed $objects
      * @return void
      */
-    function __construct(\DateTime $start = null, \DateTime $end = null, $objects = null) {
+    function __construct(DateTimeInterface $start = null, DateTimeInterface $end = null, $objects = null) {
 
         if ($start && $end) {
             $this->setTimeRange($start, $end);
@@ -125,11 +127,11 @@ class FreeBusyGenerator {
      *
      * Any freebusy object falling outside of this time range will be ignored.
      *
-     * @param DateTime $start
-     * @param DateTime $end
+     * @param DateTimeInterface $start
+     * @param DateTimeInterface $end
      * @return void
      */
-    function setTimeRange(\DateTime $start = null, \DateTime $end = null) {
+    function setTimeRange(DateTimeInterface $start = null, DateTimeInterface $end = null) {
 
         $this->start = $start;
         $this->end = $end;
@@ -206,10 +208,10 @@ class FreeBusyGenerator {
                             } elseif (isset($component->DURATION)) {
                                 $duration = DateTimeParser::parseDuration((string)$component->DURATION);
                                 $endTime = clone $startTime;
-                                $endTime->add($duration);
+                                $endTime = $endTime->add($duration);
                             } elseif (!$component->DTSTART->hasTime()) {
                                 $endTime = clone $startTime;
-                                $endTime->modify('+1 day');
+                                $endTime = $endTime->modify('+1 day');
                             } else {
                                 // The event had no duration (0 seconds)
                                 break;
@@ -249,7 +251,7 @@ class FreeBusyGenerator {
                                 if (substr($endTime,0,1)==='P' || substr($endTime,0,2)==='-P') {
                                     $duration = DateTimeParser::parseDuration($endTime);
                                     $endTime = clone $startTime;
-                                    $endTime->add($duration);
+                                    $endTime = $endTime->add($duration);
                                 } else {
                                     $endTime = DateTimeParser::parseDateTime($endTime);
                                 }
@@ -297,13 +299,13 @@ class FreeBusyGenerator {
             $vfreebusy->add($dtend);
         }
         $dtstamp = $calendar->createProperty('DTSTAMP');
-        $dtstamp->setDateTime(new \DateTime('now', new \DateTimeZone('UTC')));
+        $dtstamp->setDateTime(new DateTimeImmutable('now', new \DateTimeZone('UTC')));
         $vfreebusy->add($dtstamp);
 
         foreach($busyTimes as $busyTime) {
 
-            $busyTime[0]->setTimeZone(new \DateTimeZone('UTC'));
-            $busyTime[1]->setTimeZone(new \DateTimeZone('UTC'));
+            $busyTime[0] = $busyTime[0]->setTimeZone(new \DateTimeZone('UTC'));
+            $busyTime[1] = $busyTime[1]->setTimeZone(new \DateTimeZone('UTC'));
 
             $prop = $calendar->createProperty(
                 'FREEBUSY',
diff --git a/lib/Property/ICalendar/DateTime.php b/lib/Property/ICalendar/DateTime.php
index 3d9ffbf..b3c4cfe 100644
--- a/lib/Property/ICalendar/DateTime.php
+++ b/lib/Property/ICalendar/DateTime.php
@@ -2,11 +2,11 @@
 
 namespace Sabre\VObject\Property\ICalendar;
 
-use
-    Sabre\VObject\Property,
-    Sabre\VObject\Parser\MimeDir,
-    Sabre\VObject\DateTimeParser,
-    Sabre\VObject\TimeZoneUtil;
+use DateTimeInterface;
+use Sabre\VObject\Property;
+use Sabre\VObject\Parser\MimeDir;
+use Sabre\VObject\DateTimeParser;
+use Sabre\VObject\TimeZoneUtil;
 
 /**
  * DateTime property
@@ -41,9 +41,9 @@ class DateTime extends Property {
      * @param array $parts
      * @return void
      */
-    public function setParts(array $parts) {
+    function setParts(array $parts) {
 
-        if (isset($parts[0]) && $parts[0] instanceof \DateTime) {
+        if (isset($parts[0]) && $parts[0] instanceof DateTimeInterface) {
             $this->setDateTimes($parts);
         } else {
             parent::setParts($parts);
@@ -58,15 +58,15 @@ class DateTime extends Property {
      *
      * Instead of strings, you may also use DateTime here.
      *
-     * @param string|array|\DateTime $value
+     * @param string|array|DateTimeInterface $value
      * @return void
      */
-    public function setValue($value) {
+    function setValue($value) {
 
-        if (is_array($value) && isset($value[0]) && $value[0] instanceof \DateTime) {
+        if (is_array($value) && isset($value[0]) && $value[0] instanceof DateTimeInterface) {
             $this->setDateTimes($value);
-        } elseif ($value instanceof \DateTime) {
-            $this->setDateTimes(array($value));
+        } elseif ($value instanceof DateTimeInterface) {
+            $this->setDateTimes([$value]);
         } else {
             parent::setValue($value);
         }
@@ -82,7 +82,7 @@ class DateTime extends Property {
      * @param string $val
      * @return void
      */
-    public function setRawMimeDirValue($val) {
+    function setRawMimeDirValue($val) {
 
         $this->setValue(explode($this->delimiter, $val));
 
@@ -93,7 +93,7 @@ class DateTime extends Property {
      *
      * @return string
      */
-    public function getRawMimeDirValue() {
+    function getRawMimeDirValue() {
 
         return implode($this->delimiter, $this->getParts());
 
@@ -104,7 +104,7 @@ class DateTime extends Property {
      *
      * @return bool
      */
-    public function hasTime() {
+    function hasTime() {
 
         return strtoupper((string)$this['VALUE']) !== 'DATE';
 
@@ -117,9 +117,9 @@ class DateTime extends Property {
      * first will be returned. To get an array with multiple values, call
      * getDateTimes.
      *
-     * @return \DateTime
+     * @return DateTimeImmutable
      */
-    public function getDateTime() {
+    function getDateTime() {
 
         $dt = $this->getDateTimes();
         if (!$dt) return null;
@@ -131,9 +131,9 @@ class DateTime extends Property {
     /**
      * Returns multiple date-time values.
      *
-     * @return \DateTime[]
+     * @return DateTimeImmutable[]
      */
-    public function getDateTimes() {
+    function getDateTimes() {
 
         // Finding the timezone.
         $tz = $this['TZID'];
@@ -142,7 +142,7 @@ class DateTime extends Property {
             $tz = TimeZoneUtil::getTimeZone((string)$tz, $this->root);
         }
 
-        $dts = array();
+        $dts = [];
         foreach($this->getParts() as $part) {
             $dts[] = DateTimeParser::parse($part, $tz);
         }
@@ -153,13 +153,13 @@ class DateTime extends Property {
     /**
      * Sets the property as a DateTime object.
      *
-     * @param \DateTime $dt
+     * @param DateTimeInterface $dt
      * @param bool isFloating If set to true, timezones will be ignored.
      * @return void
      */
-    public function setDateTime(\DateTime $dt, $isFloating = false) {
+    function setDateTime(DateTimeInterface $dt, $isFloating = false) {
 
-        $this->setDateTimes(array($dt), $isFloating);
+        $this->setDateTimes([$dt], $isFloating);
 
     }
 
@@ -169,13 +169,13 @@ class DateTime extends Property {
      * The first value will be used as a reference for the timezones, and all
      * the otehr values will be adjusted for that timezone
      *
-     * @param \DateTime[] $dt
+     * @param DateTimeInterface[] $dt
      * @param bool isFloating If set to true, timezones will be ignored.
      * @return void
      */
-    public function setDateTimes(array $dt, $isFloating = false) {
+    function setDateTimes(array $dt, $isFloating = false) {
 
-        $values = array();
+        $values = [];
 
         if($this->hasTime()) {
 
@@ -190,12 +190,12 @@ class DateTime extends Property {
                 }
                 if (is_null($tz)) {
                     $tz = $d->getTimeZone();
-                    $isUtc = in_array($tz->getName() , array('UTC', 'GMT', 'Z'));
+                    $isUtc = in_array($tz->getName() , ['UTC', 'GMT', 'Z']);
                     if (!$isUtc) {
                         $this->offsetSet('TZID', $tz->getName());
                     }
                 } else {
-                    $d->setTimeZone($tz);
+                    $d = $d->setTimeZone($tz);
                 }
 
                 if ($isUtc) {
@@ -232,7 +232,7 @@ class DateTime extends Property {
      *
      * @return string
      */
-    public function getValueType() {
+    function getValueType() {
 
         return $this->hasTime()?'DATE-TIME':'DATE';
 
@@ -245,13 +245,13 @@ class DateTime extends Property {
      *
      * @return array
      */
-    public function getJsonValue() {
+    function getJsonValue() {
 
         $dts = $this->getDateTimes();
         $hasTime = $this->hasTime();
 
         $tz = $dts[0]->getTimeZone();
-        $isUtc = in_array($tz->getName() , array('UTC', 'GMT', 'Z'));
+        $isUtc = in_array($tz->getName() , ['UTC', 'GMT', 'Z']);
 
         return array_map(
             function($dt) use ($hasTime, $isUtc) {
@@ -276,7 +276,7 @@ class DateTime extends Property {
      * @param array $value
      * @return void
      */
-    public function setJsonValue(array $value) {
+    function setJsonValue(array $value) {
 
         // dates and times in jCal have one difference to dates and times in
         // iCalendar. In jCal date-parts are separated by dashes, and
@@ -286,7 +286,7 @@ class DateTime extends Property {
             array_map(
                 function($item) {
 
-                    return strtr($item, array(':'=>'', '-'=>''));
+                    return strtr($item, [':'=>'', '-'=>'']);
 
                 },
                 $value
@@ -302,7 +302,7 @@ class DateTime extends Property {
      * @param mixed $value
      * @return void
      */
-    public function offsetSet($name, $value) {
+    function offsetSet($name, $value) {
 
         parent::offsetSet($name, $value);
         if (strtoupper($name)!=='VALUE') {
@@ -335,7 +335,7 @@ class DateTime extends Property {
      * @param int $options
      * @return array
      */
-    public function validate($options = 0) {
+    function validate($options = 0) {
 
         $messages = parent::validate($options);
         $valueType = $this->getValueType();
@@ -350,11 +350,11 @@ class DateTime extends Property {
                     break;
             }
         } catch (\LogicException $e) {
-            $messages[] = array(
+            $messages[] = [
                 'level' => 3,
                 'message' => 'The supplied value (' . $value . ') is not a correct ' . $valueType,
                 'node' => $this,
-            );
+            ];
         }
         return $messages;
 
diff --git a/lib/Property/ICalendar/Duration.php b/lib/Property/ICalendar/Duration.php
index 05f1420..a0498fe 100644
--- a/lib/Property/ICalendar/Duration.php
+++ b/lib/Property/ICalendar/Duration.php
@@ -37,7 +37,7 @@ class Duration extends Property {
      * @param string $val
      * @return void
      */
-    public function setRawMimeDirValue($val) {
+    function setRawMimeDirValue($val) {
 
         $this->setValue(explode($this->delimiter, $val));
 
@@ -48,7 +48,7 @@ class Duration extends Property {
      *
      * @return string
      */
-    public function getRawMimeDirValue() {
+    function getRawMimeDirValue() {
 
         return implode($this->delimiter, $this->getParts());
 
@@ -62,7 +62,7 @@ class Duration extends Property {
      *
      * @return string
      */
-    public function getValueType() {
+    function getValueType() {
 
         return 'DURATION';
 
@@ -75,7 +75,7 @@ class Duration extends Property {
      *
      * @return \DateInterval
      */
-    public function getDateInterval() {
+    function getDateInterval() {
 
         $parts = $this->getParts();
         $value = $parts[0];
diff --git a/lib/Property/ICalendar/Period.php b/lib/Property/ICalendar/Period.php
index 1acd6d6..c7f464b 100644
--- a/lib/Property/ICalendar/Period.php
+++ b/lib/Property/ICalendar/Period.php
@@ -37,7 +37,7 @@ class Period extends Property {
      * @param string $val
      * @return void
      */
-    public function setRawMimeDirValue($val) {
+    function setRawMimeDirValue($val) {
 
         $this->setValue(explode($this->delimiter, $val));
 
@@ -48,7 +48,7 @@ class Period extends Property {
      *
      * @return string
      */
-    public function getRawMimeDirValue() {
+    function getRawMimeDirValue() {
 
         return implode($this->delimiter, $this->getParts());
 
@@ -62,7 +62,7 @@ class Period extends Property {
      *
      * @return string
      */
-    public function getValueType() {
+    function getValueType() {
 
         return "PERIOD";
 
@@ -76,12 +76,12 @@ class Period extends Property {
      * @param array $value
      * @return void
      */
-    public function setJsonValue(array $value) {
+    function setJsonValue(array $value) {
 
         $value = array_map(
             function($item) {
 
-                return strtr(implode('/', $item), array(':' => '', '-' => ''));
+                return strtr(implode('/', $item), [':' => '', '-' => '']);
 
             },
             $value
@@ -97,9 +97,9 @@ class Period extends Property {
      *
      * @return array
      */
-    public function getJsonValue() {
+    function getJsonValue() {
 
-        $return = array();
+        $return = [];
         foreach($this->getParts() as $item) {
 
             list($start, $end) = explode('/', $item, 2);
@@ -108,16 +108,16 @@ class Period extends Property {
 
             // This is a duration value.
             if ($end[0]==='P') {
-                $return[] = array(
+                $return[] = [
                     $start->format('Y-m-d\\TH:i:s'),
                     $end
-                );
+                ];
             } else {
                 $end = DateTimeParser::parseDateTime($end);
-                $return[] = array(
+                $return[] = [
                     $start->format('Y-m-d\\TH:i:s'),
                     $end->format('Y-m-d\\TH:i:s'),
-                );
+                ];
             }
 
         }
diff --git a/lib/Property/Time.php b/lib/Property/Time.php
index a271dce..913a4e3 100644
--- a/lib/Property/Time.php
+++ b/lib/Property/Time.php
@@ -31,7 +31,7 @@ class Time extends Text {
      *
      * @return string
      */
-    public function getValueType() {
+    function getValueType() {
 
         return "TIME";
 
@@ -44,7 +44,7 @@ class Time extends Text {
      *
      * @return array
      */
-    public function getJsonValue() {
+    function getJsonValue() {
 
         $parts = DateTimeParser::parseVCardTime($this->getValue());
 
@@ -87,7 +87,7 @@ class Time extends Text {
             $timeStr.=$parts['timezone'];
         }
 
-        return array($timeStr);
+        return [$timeStr];
 
     }
 
diff --git a/lib/Property/VCard/Date.php b/lib/Property/VCard/Date.php
index cc640e6..5a82cdd 100644
--- a/lib/Property/VCard/Date.php
+++ b/lib/Property/VCard/Date.php
@@ -24,7 +24,7 @@ class Date extends DateAndOrTime {
      *
      * @return string
      */
-    public function getValueType() {
+    function getValueType() {
 
         return "DATE";
 
diff --git a/lib/Property/VCard/DateAndOrTime.php b/lib/Property/VCard/DateAndOrTime.php
index 352e80c..d3343b6 100644
--- a/lib/Property/VCard/DateAndOrTime.php
+++ b/lib/Property/VCard/DateAndOrTime.php
@@ -2,11 +2,11 @@
 
 namespace Sabre\VObject\Property\VCard;
 
-use
-    Sabre\VObject\DateTimeParser,
-    Sabre\VObject\Property\Text,
-    Sabre\VObject\Property,
-    DateTime;
+use Sabre\VObject\DateTimeParser;
+use Sabre\VObject\Property\Text;
+use Sabre\VObject\Property;
+use DateTimeInterface;
+use DateTimeImmutable;
 
 /**
  * DateAndOrTime property
@@ -34,7 +34,7 @@ class DateAndOrTime extends Property {
      *
      * @return string
      */
-    public function getValueType() {
+    function getValueType() {
 
         return "DATE-AND-OR-TIME";
 
@@ -48,7 +48,7 @@ class DateAndOrTime extends Property {
      * @param array $parts
      * @return void
      */
-    public function setParts(array $parts) {
+    function setParts(array $parts) {
 
         if (count($parts)>1) {
             throw new \InvalidArgumentException('Only one value allowed');
@@ -71,7 +71,7 @@ class DateAndOrTime extends Property {
      * @param string|array|\DateTime $value
      * @return void
      */
-    public function setValue($value) {
+    function setValue($value) {
 
         if ($value instanceof \DateTime) {
             $this->setDateTime($value);
@@ -84,18 +84,18 @@ class DateAndOrTime extends Property {
     /**
      * Sets the property as a DateTime object.
      *
-     * @param \DateTime $dt
+     * @param DateTimeInterface $dt
      * @return void
      */
-    public function setDateTime(\DateTime $dt) {
+    function setDateTime(DateTimeInterface $dt) {
 
-        $values = array();
+        $values = [];
 
         $tz = null;
         $isUtc = false;
 
         $tz = $dt->getTimeZone();
-        $isUtc = in_array($tz->getName() , array('UTC', 'GMT', 'Z'));
+        $isUtc = in_array($tz->getName() , ['UTC', 'GMT', 'Z']);
 
         if ($isUtc) {
             $value = $dt->format('Ymd\\THis\\Z');
@@ -122,12 +122,12 @@ class DateAndOrTime extends Property {
      * current values for those. So at the time of writing, if the year was
      * omitted, we would have filled in 2014.
      *
-     * @return \DateTime
+     * @return DateTimeImmutable
      */
-    public function getDateTime() {
+    function getDateTime() {
 
-        $dts = array();
-        $now = new DateTime();
+        $dts = [];
+        $now = new DateTimeImmutable();
 
         $tzFormat = $now->getTimezone()->getOffset($now)===0?'\\Z':'O';
         $nowParts = DateTimeParser::parseVCardDateTime($now->format('Ymd\\This' . $tzFormat));
@@ -144,7 +144,7 @@ class DateAndOrTime extends Property {
                 $dateParts[$k] = $nowParts[$k];
             }
         }
-        return new DateTime("$dateParts[year]-$dateParts[month]-$dateParts[date] $dateParts[hour]:$dateParts[minute]:$dateParts[second] $dateParts[timezone]");
+        return new DateTimeImmutable("$dateParts[year]-$dateParts[month]-$dateParts[date] $dateParts[hour]:$dateParts[minute]:$dateParts[second] $dateParts[timezone]");
 
     }
 
@@ -155,7 +155,7 @@ class DateAndOrTime extends Property {
      *
      * @return array
      */
-    public function getJsonValue() {
+    function getJsonValue() {
 
         $parts = DateTimeParser::parseVCardDateTime($this->getValue());
 
@@ -260,7 +260,7 @@ class DateAndOrTime extends Property {
      * @param string $val
      * @return void
      */
-    public function setRawMimeDirValue($val) {
+    function setRawMimeDirValue($val) {
 
         $this->setValue($val);
 
@@ -271,7 +271,7 @@ class DateAndOrTime extends Property {
      *
      * @return string
      */
-    public function getRawMimeDirValue() {
+    function getRawMimeDirValue() {
 
         return implode($this->delimiter, $this->getParts());
 
@@ -298,18 +298,18 @@ class DateAndOrTime extends Property {
      * @param int $options
      * @return array
      */
-    public function validate($options = 0) {
+    function validate($options = 0) {
 
         $messages = parent::validate($options);
         $value = $this->getValue();
         try {
             DateTimeParser::parseVCardDateTime($value);
         } catch (\InvalidArgumentException $e) {
-            $messages[] = array(
+            $messages[] = [
                 'level' => 3,
                 'message' => 'The supplied value (' . $value . ') is not a correct DATE-AND-OR-TIME property',
                 'node' => $this,
-            );
+            ];
         }
         return $messages;
 
diff --git a/lib/Property/VCard/DateTime.php b/lib/Property/VCard/DateTime.php
index 7ce0c91..9285497 100644
--- a/lib/Property/VCard/DateTime.php
+++ b/lib/Property/VCard/DateTime.php
@@ -24,7 +24,7 @@ class DateTime extends DateAndOrTime {
      *
      * @return string
      */
-    public function getValueType() {
+    function getValueType() {
 
         return "DATE-TIME";
 
diff --git a/lib/Property/VCard/TimeStamp.php b/lib/Property/VCard/TimeStamp.php
index a05a036..688965f 100644
--- a/lib/Property/VCard/TimeStamp.php
+++ b/lib/Property/VCard/TimeStamp.php
@@ -33,7 +33,7 @@ class TimeStamp extends Text {
      *
      * @return string
      */
-    public function getValueType() {
+    function getValueType() {
 
         return "TIMESTAMP";
 
@@ -46,7 +46,7 @@ class TimeStamp extends Text {
      *
      * @return array
      */
-    public function getJsonValue() {
+    function getJsonValue() {
 
         $parts = DateTimeParser::parseVCardDateTime($this->getValue());
 
@@ -63,7 +63,7 @@ class TimeStamp extends Text {
             $dateStr.=$parts['timezone'];
         }
 
-        return array($dateStr);
+        return [$dateStr];
 
     }
 }
diff --git a/lib/Recur/EventIterator.php b/lib/Recur/EventIterator.php
index 2ea55a4..0e60580 100644
--- a/lib/Recur/EventIterator.php
+++ b/lib/Recur/EventIterator.php
@@ -3,7 +3,8 @@
 namespace Sabre\VObject\Recur;
 
 use InvalidArgumentException;
-use DateTime;
+use DateTimeImmutable;
+use DateTimeInterface;
 use Sabre\VObject\Component;
 use Sabre\VObject\Component\VEvent;
 
@@ -64,12 +65,12 @@ class EventIterator implements \Iterator {
      * @param Component $vcal
      * @param string|null $uid
      */
-    public function __construct(Component $vcal, $uid = null) {
+    function __construct(Component $vcal, $uid = null) {
 
         $rrule = null;
         if ($vcal instanceof VEvent) {
             // Single instance mode.
-            $events = array($vcal);
+            $events = [$vcal];
         } else {
             $uid = (string)$uid;
             if (!$uid) {
@@ -78,7 +79,7 @@ class EventIterator implements \Iterator {
             if (!isset($vcal->VEVENT)) {
                 throw new InvalidArgumentException('No events found in this calendar');
             }
-            $events = array();
+            $events = [];
             foreach($vcal->VEVENT as $event) {
                 if ($event->uid->getValue() === $uid) {
                     $events[] = $event;
@@ -121,10 +122,10 @@ class EventIterator implements \Iterator {
         } else {
             // master event has no rrule. We default to something that
             // iterates once.
-            $rrule = array(
+            $rrule = [
                 'FREQ' => 'DAILY',
                 'COUNT' => 1,
-            );
+            ];
         }
         $this->startDate = $this->masterEvent->DTSTART->getDateTime();
 
@@ -147,7 +148,7 @@ class EventIterator implements \Iterator {
         } elseif (isset($this->masterEvent->DURATION)) {
             $duration = $this->masterEvent->DURATION->getDateInterval();
             $end = clone $this->startDate;
-            $end->add($duration);
+            $end = $end->add($duration);
             $this->eventDuration = $end->getTimeStamp() - $this->startDate->getTimeStamp();
         } elseif ($this->masterEvent->DTSTART->getValueType() === 'DATE') {
             $this->eventDuration = 3600 * 24;
@@ -167,10 +168,10 @@ class EventIterator implements \Iterator {
             );
         } else {
             $this->recurIterator = new RRuleIterator(
-                array(
+                [
                     'FREQ' => 'DAILY',
                     'COUNT' => 1,
-                ),
+                ],
                 $this->startDate
             );
         }
@@ -185,9 +186,9 @@ class EventIterator implements \Iterator {
     /**
      * Returns the date for the current position of the iterator.
      *
-     * @return DateTime
+     * @return DateTimeImmutable
      */
-    public function current() {
+    function current() {
 
         if ($this->currentDate) {
             return clone $this->currentDate;
@@ -199,9 +200,9 @@ class EventIterator implements \Iterator {
      * This method returns the start date for the current iteration of the
      * event.
      *
-     * @return DateTime
+     * @return DateTimeImmutable
      */
-    public function getDtStart() {
+    function getDtStart() {
 
         if ($this->currentDate) {
             return clone $this->currentDate;
@@ -213,16 +214,15 @@ class EventIterator implements \Iterator {
      * This method returns the end date for the current iteration of the
      * event.
      *
-     * @return DateTime
+     * @return DateTimeImmutable
      */
-    public function getDtEnd() {
+    function getDtEnd() {
 
         if (!$this->valid()) {
             return null;
         }
         $end = clone $this->currentDate;
-        $end->modify('+' . $this->eventDuration . ' seconds');
-        return $end;
+        return $end->modify('+' . $this->eventDuration . ' seconds');
 
     }
 
@@ -234,7 +234,7 @@ class EventIterator implements \Iterator {
      *
      * @return VEvent
      */
-    public function getEventObject() {
+    function getEventObject() {
 
         if ($this->currentOverriddenEvent) {
             return $this->currentOverriddenEvent;
@@ -273,7 +273,7 @@ class EventIterator implements \Iterator {
      *
      * @return int
      */
-    public function key() {
+    function key() {
 
         // The counter is always 1 ahead.
         return $this->counter - 1;
@@ -286,7 +286,7 @@ class EventIterator implements \Iterator {
      *
      * @return bool
      */
-    public function valid() {
+    function valid() {
 
         return !!$this->currentDate;
 
@@ -295,11 +295,11 @@ class EventIterator implements \Iterator {
     /**
      * Sets the iterator back to the starting point.
      */
-    public function rewind() {
+    function rewind() {
 
         $this->recurIterator->rewind();
         // re-creating overridden event index.
-        $index = array();
+        $index = [];
         foreach($this->overriddenEvents as $key=>$event) {
             $stamp = $event->DTSTART->getDateTime()->getTimeStamp();
             $index[$stamp] = $key;
@@ -321,7 +321,7 @@ class EventIterator implements \Iterator {
      *
      * @return void
      */
-    public function next() {
+    function next() {
 
         $this->currentOverriddenEvent = null;
         $this->counter++;
@@ -376,9 +376,9 @@ class EventIterator implements \Iterator {
     /**
      * Quickly jump to a date in the future.
      *
-     * @param DateTime $dateTime
+     * @param DateTimeInterface $dateTime
      */
-    public function fastForward(DateTime $dateTime) {
+    function fastForward(DateTimeInterface $dateTime) {
 
         while($this->valid() && $this->getDtEnd() < $dateTime ) {
             $this->next();
@@ -391,7 +391,7 @@ class EventIterator implements \Iterator {
      *
      * @return bool
      */
-    public function isInfinite() {
+    function isInfinite() {
 
         return $this->recurIterator->isInfinite();
 
@@ -423,7 +423,7 @@ class EventIterator implements \Iterator {
      *
      * @var array
      */
-    protected $overriddenEvents = array();
+    protected $overriddenEvents = [];
 
     /**
      * Overridden event index.
@@ -441,7 +441,7 @@ class EventIterator implements \Iterator {
      *
      * @var array
      */
-    protected $exceptions = array();
+    protected $exceptions = [];
 
     /**
      * Internal event counter
@@ -453,14 +453,14 @@ class EventIterator implements \Iterator {
     /**
      * The very start of the iteration process.
      *
-     * @var DateTime
+     * @var DateTimeImmutable
      */
     protected $startDate;
 
     /**
      * Where we are currently in the iteration process
      *
-     * @var DateTime
+     * @var DateTimeImmutable
      */
     protected $currentDate;
 
@@ -470,7 +470,7 @@ class EventIterator implements \Iterator {
      * Sometimes we need to temporary store the next date, because an
      * overridden event came before.
      *
-     * @var DateTime
+     * @var DateTimeImmutable
      */
     protected $nextDate;
 
diff --git a/lib/Recur/RDateIterator.php b/lib/Recur/RDateIterator.php
index 3a3fd2a..0ec1ce1 100644
--- a/lib/Recur/RDateIterator.php
+++ b/lib/Recur/RDateIterator.php
@@ -2,7 +2,7 @@
 
 namespace Sabre\VObject\Recur;
 
-use DateTime;
+use DateTimeInterface;
 use InvalidArgumentException;
 use Iterator;
 use Sabre\VObject\DateTimeParser;
@@ -27,9 +27,9 @@ class RDateIterator implements Iterator {
      * Creates the Iterator.
      *
      * @param string|array $rrule
-     * @param DateTime $start
+     * @param DateTimeInterface $start
      */
-    public function __construct($rrule, DateTime $start) {
+    function __construct($rrule, DateTimeInterface $start) {
 
         $this->startDate = $start;
         $this->parseRDate($rrule);
@@ -39,7 +39,7 @@ class RDateIterator implements Iterator {
 
     /* Implementation of the Iterator interface {{{ */
 
-    public function current() {
+    function current() {
 
         if (!$this->valid()) return null;
         return clone $this->currentDate;
@@ -51,7 +51,7 @@ class RDateIterator implements Iterator {
      *
      * @return int
      */
-    public function key() {
+    function key() {
 
         return $this->counter;
 
@@ -63,7 +63,7 @@ class RDateIterator implements Iterator {
      *
      * @return bool
      */
-    public function valid() {
+    function valid() {
 
         return ($this->counter <= count($this->dates));
 
@@ -74,7 +74,7 @@ class RDateIterator implements Iterator {
      *
      * @return void
      */
-    public function rewind() {
+    function rewind() {
 
         $this->currentDate = clone $this->startDate;
         $this->counter = 0;
@@ -86,7 +86,7 @@ class RDateIterator implements Iterator {
      *
      * @return void
      */
-    public function next() {
+    function next() {
 
         $this->counter++;
         if (!$this->valid()) return;
@@ -105,7 +105,7 @@ class RDateIterator implements Iterator {
      *
      * @return bool
      */
-    public function isInfinite() {
+    function isInfinite() {
 
         return false;
 
@@ -115,10 +115,10 @@ class RDateIterator implements Iterator {
      * This method allows you to quickly go to the next occurrence after the
      * specified date.
      *
-     * @param DateTime $dt
+     * @param DateTimeInterface $dt
      * @return void
      */
-    public function fastForward(\DateTime $dt) {
+    function fastForward(DateTimeInterface $dt) {
 
         while($this->valid() && $this->currentDate < $dt ) {
             $this->next();
@@ -131,7 +131,7 @@ class RDateIterator implements Iterator {
      *
      * All calculations are based on this initial date.
      *
-     * @var DateTime
+     * @var DateTimeInterface
      */
     protected $startDate;
 
@@ -139,7 +139,7 @@ class RDateIterator implements Iterator {
      * The date of the current iteration. You can get this by calling
      * ->current().
      *
-     * @var DateTime
+     * @var DateTimeInterface
      */
     protected $currentDate;
 
diff --git a/lib/Recur/RRuleIterator.php b/lib/Recur/RRuleIterator.php
index ba882d7..b1bb3ec 100644
--- a/lib/Recur/RRuleIterator.php
+++ b/lib/Recur/RRuleIterator.php
@@ -2,7 +2,8 @@
 
 namespace Sabre\VObject\Recur;
 
-use DateTime;
+use DateTimeInterface;
+use DateTimeImmutable;
 use InvalidArgumentException;
 use Iterator;
 use Sabre\VObject\DateTimeParser;
@@ -28,9 +29,9 @@ class RRuleIterator implements Iterator {
      * Creates the Iterator
      *
      * @param string|array $rrule
-     * @param DateTime $start
+     * @param DateTimeInterface $start
      */
-    public function __construct($rrule, DateTime $start) {
+    function __construct($rrule, DateTimeInterface $start) {
 
         $this->startDate = $start;
         $this->parseRRule($rrule);
@@ -40,7 +41,7 @@ class RRuleIterator implements Iterator {
 
     /* Implementation of the Iterator interface {{{ */
 
-    public function current() {
+    function current() {
 
         if (!$this->valid()) return null;
         return clone $this->currentDate;
@@ -52,7 +53,7 @@ class RRuleIterator implements Iterator {
      *
      * @return int
      */
-    public function key() {
+    function key() {
 
         return $this->counter;
 
@@ -65,7 +66,7 @@ class RRuleIterator implements Iterator {
      *
      * @return bool
      */
-    public function valid() {
+    function valid() {
 
         if (!is_null($this->count)) {
             return $this->counter < $this->count;
@@ -79,7 +80,7 @@ class RRuleIterator implements Iterator {
      *
      * @return void
      */
-    public function rewind() {
+    function rewind() {
 
         $this->currentDate = clone $this->startDate;
         $this->counter = 0;
@@ -91,7 +92,7 @@ class RRuleIterator implements Iterator {
      *
      * @return void
      */
-    public function next() {
+    function next() {
 
         $previousStamp = $this->currentDate->getTimeStamp();
 
@@ -131,7 +132,7 @@ class RRuleIterator implements Iterator {
      *
      * @return bool
      */
-    public function isInfinite() {
+    function isInfinite() {
 
         return !$this->count && !$this->until;
 
@@ -141,10 +142,10 @@ class RRuleIterator implements Iterator {
      * This method allows you to quickly go to the next occurrence after the
      * specified date.
      *
-     * @param DateTime $dt
+     * @param DateTimeInterface $dt
      * @return void
      */
-    public function fastForward(\DateTime $dt) {
+    function fastForward(DateTimeInterface $dt) {
 
         while($this->valid() && $this->currentDate < $dt ) {
             $this->next();
@@ -157,7 +158,7 @@ class RRuleIterator implements Iterator {
      *
      * All calculations are based on this initial date.
      *
-     * @var DateTime
+     * @var DateTimeInterface
      */
     protected $startDate;
 
@@ -165,7 +166,7 @@ class RRuleIterator implements Iterator {
      * The date of the current iteration. You can get this by calling
      * ->current().
      *
-     * @var DateTime
+     * @var DateTimeInterface
      */
     protected $currentDate;
 
@@ -197,7 +198,7 @@ class RRuleIterator implements Iterator {
     /**
      * The last instance of this recurrence, inclusively
      *
-     * @var \DateTime|null
+     * @var DateTimeInterface|null
      */
     protected $until;
 
@@ -323,7 +324,7 @@ class RRuleIterator implements Iterator {
      */
     protected function nextHourly() {
 
-        $this->currentDate->modify('+' . $this->interval . ' hours');
+        $this->currentDate = $this->currentDate->modify('+' . $this->interval . ' hours');
 
     }
 
@@ -335,7 +336,7 @@ class RRuleIterator implements Iterator {
     protected function nextDaily() {
 
         if (!$this->byHour && !$this->byDay) {
-            $this->currentDate->modify('+' . $this->interval . ' days');
+            $this->currentDate = $this->currentDate->modify('+' . $this->interval . ' days');
             return;
         }
 
@@ -355,13 +356,13 @@ class RRuleIterator implements Iterator {
             if ($this->byHour) {
                 if ($this->currentDate->format('G') == '23') {
                     // to obey the interval rule
-                    $this->currentDate->modify('+' . $this->interval-1 . ' days');
+                    $this->currentDate = $this->currentDate->modify('+' . $this->interval-1 . ' days');
                 }
 
-                $this->currentDate->modify('+1 hours');
+                $this->currentDate = $this->currentDate->modify('+1 hours');
 
             } else {
-                $this->currentDate->modify('+' . $this->interval . ' days');
+                $this->currentDate = $this->currentDate->modify('+' . $this->interval . ' days');
 
             }
 
@@ -386,7 +387,7 @@ class RRuleIterator implements Iterator {
     protected function nextWeekly() {
 
         if (!$this->byHour && !$this->byDay) {
-            $this->currentDate->modify('+' . $this->interval . ' weeks');
+            $this->currentDate = $this->currentDate->modify('+' . $this->interval . ' weeks');
             return;
         }
 
@@ -404,9 +405,9 @@ class RRuleIterator implements Iterator {
         do {
 
             if ($this->byHour) {
-                $this->currentDate->modify('+1 hours');
+                $this->currentDate = $this->currentDate->modify('+1 hours');
             } else {
-                $this->currentDate->modify('+1 days');
+                $this->currentDate = $this->currentDate->modify('+1 days');
             }
 
             // Current day of the week
@@ -417,12 +418,12 @@ class RRuleIterator implements Iterator {
 
             // We need to roll over to the next week
             if ($currentDay === $firstDay && (!$this->byHour || $currentHour == '0')) {
-                $this->currentDate->modify('+' . $this->interval-1 . ' weeks');
+                $this->currentDate = $this->currentDate->modify('+' . $this->interval-1 . ' weeks');
 
                 // We need to go to the first day of this week, but only if we
                 // are not already on this first day of this week.
                 if($this->currentDate->format('w') != $firstDay) {
-                    $this->currentDate->modify('last ' . $this->dayNames[$this->dayMap[$this->weekStart]]);
+                    $this->currentDate = $this->currentDate->modify('last ' . $this->dayNames[$this->dayMap[$this->weekStart]]);
                 }
             }
 
@@ -444,13 +445,13 @@ class RRuleIterator implements Iterator {
             // occur to the next month. We Must skip these invalid
             // entries.
             if ($currentDayOfMonth < 29) {
-                $this->currentDate->modify('+' . $this->interval . ' months');
+                $this->currentDate = $this->currentDate->modify('+' . $this->interval . ' months');
             } else {
                 $increase = 0;
                 do {
                     $increase++;
                     $tempDate = clone $this->currentDate;
-                    $tempDate->modify('+ ' . ($this->interval*$increase) . ' months');
+                    $tempDate = $tempDate->modify('+ ' . ($this->interval*$increase) . ' months');
                 } while ($tempDate->format('j') != $currentDayOfMonth);
                 $this->currentDate = $tempDate;
             }
@@ -478,9 +479,9 @@ class RRuleIterator implements Iterator {
             // This line does not currently work in hhvm. Temporary workaround
             // follows:
             // $this->currentDate->modify('first day of this month');
-            $this->currentDate = new \DateTime($this->currentDate->format('Y-m-1 H:i:s'), $this->currentDate->getTimezone());
+            $this->currentDate = new DateTimeImmutable($this->currentDate->format('Y-m-1 H:i:s'), $this->currentDate->getTimezone());
             // end of workaround
-            $this->currentDate->modify('+ ' . $this->interval . ' months');
+            $this->currentDate = $this->currentDate->modify('+ ' . $this->interval . ' months');
 
             // This goes to 0 because we need to start counting at the
             // beginning.
@@ -488,7 +489,7 @@ class RRuleIterator implements Iterator {
 
         }
 
-        $this->currentDate->setDate($this->currentDate->format('Y'), $this->currentDate->format('n'), $occurrence);
+        $this->currentDate = $this->currentDate->setDate($this->currentDate->format('Y'), $this->currentDate->format('n'), $occurrence);
 
     }
 
@@ -521,8 +522,9 @@ class RRuleIterator implements Iterator {
                     // 400. (1800, 1900, 2100). So we just rely on the datetime
                     // functions instead.
                     $nextDate = clone $this->currentDate;
-                    $nextDate->modify('+ ' . ($this->interval*$counter) . ' years');
+                    $nextDate = $nextDate->modify('+ ' . ($this->interval*$counter) . ' years');
                 } while ($nextDate->format('n')!=2);
+
                 $this->currentDate = $nextDate;
 
                 return;
@@ -530,7 +532,7 @@ class RRuleIterator implements Iterator {
             }
 
             // The easiest form
-            $this->currentDate->modify('+' . $this->interval . ' years');
+            $this->currentDate = $this->currentDate->modify('+' . $this->interval . ' years');
             return;
 
         }
@@ -574,12 +576,12 @@ class RRuleIterator implements Iterator {
                     }
                 } while (!in_array($currentMonth, $this->byMonth));
 
-                $this->currentDate->setDate($currentYear, $currentMonth, $currentDayOfMonth);
+                $this->currentDate = $this->currentDate->setDate($currentYear, $currentMonth, $currentDayOfMonth);
 
             }
 
             // If we made it here, it means we got a valid occurrence
-            $this->currentDate->setDate($currentYear, $currentMonth, $occurrence);
+            $this->currentDate = $this->currentDate->setDate($currentYear, $currentMonth, $occurrence);
             return;
 
         } else {
@@ -594,7 +596,7 @@ class RRuleIterator implements Iterator {
                     $currentMonth = 1;
                 }
             } while (!in_array($currentMonth, $this->byMonth));
-            $this->currentDate->setDate($currentYear, $currentMonth, $currentDayOfMonth);
+            $this->currentDate = $this->currentDate->setDate($currentYear, $currentMonth, $currentDayOfMonth);
 
             return;
 
@@ -626,7 +628,7 @@ class RRuleIterator implements Iterator {
                     $value = strtolower($value);
                     if (!in_array(
                         $value,
-                        array('secondly','minutely','hourly','daily','weekly','monthly','yearly')
+                        ['secondly','minutely','hourly','daily','weekly','monthly','yearly']
                     )) {
                         throw new InvalidArgumentException('Unknown value for FREQ=' . strtoupper($value));
                     }
@@ -721,7 +723,7 @@ class RRuleIterator implements Iterator {
      *
      * @var array
      */
-    protected $dayNames = array(
+    protected $dayNames = [
         0 => 'Sunday',
         1 => 'Monday',
         2 => 'Tuesday',
@@ -729,7 +731,7 @@ class RRuleIterator implements Iterator {
         4 => 'Thursday',
         5 => 'Friday',
         6 => 'Saturday',
-    );
+    ];
 
     /**
      * Returns all the occurrences for a monthly frequency with a 'byDay' or
@@ -743,7 +745,7 @@ class RRuleIterator implements Iterator {
 
         $startDate = clone $this->currentDate;
 
-        $byDayResults = array();
+        $byDayResults = [];
 
         // Our strategy is to simply go through the byDays, advance the date to
         // that point and add it to the results.
@@ -754,18 +756,18 @@ class RRuleIterator implements Iterator {
 
             // Dayname will be something like 'wednesday'. Now we need to find
             // all wednesdays in this month.
-            $dayHits = array();
+            $dayHits = [];
 
             // workaround for missing 'first day of the month' support in hhvm
             $checkDate = new \DateTime($startDate->format('Y-m-1'));
             // workaround modify always advancing the date even if the current day is a $dayName in hhvm
             if ($checkDate->format('l') !== $dayName) {
-                $checkDate->modify($dayName);
+                $checkDate = $checkDate->modify($dayName);
             }
 
             do {
                 $dayHits[] = $checkDate->format('j');
-                $checkDate->modify('next ' . $dayName);
+                $checkDate = $checkDate->modify('next ' . $dayName);
             } while ($checkDate->format('n') === $startDate->format('n'));
 
             // So now we have 'all wednesdays' for month. It is however
@@ -794,7 +796,7 @@ class RRuleIterator implements Iterator {
 
         }
 
-        $byMonthDayResults = array();
+        $byMonthDayResults = [];
         if ($this->byMonthDay) foreach($this->byMonthDay as $monthDay) {
 
             // Removing values that are out of range for this month
@@ -829,7 +831,7 @@ class RRuleIterator implements Iterator {
             return $result;
         }
 
-        $filteredResult = array();
+        $filteredResult = [];
         foreach($this->bySetPos as $setPos) {
 
             if ($setPos<0) {
@@ -850,7 +852,7 @@ class RRuleIterator implements Iterator {
      *
      * @var array
      */
-    protected $dayMap = array(
+    protected $dayMap = [
         'SU' => 0,
         'MO' => 1,
         'TU' => 2,
@@ -858,11 +860,11 @@ class RRuleIterator implements Iterator {
         'TH' => 4,
         'FR' => 5,
         'SA' => 6,
-    );
+    ];
+
+    protected function getHours() {
 
-    protected function getHours()
-    {
-        $recurrenceHours = array();
+        $recurrenceHours = [];
         foreach($this->byHour as $byHour) {
             $recurrenceHours[] = $byHour;
         }
@@ -872,7 +874,7 @@ class RRuleIterator implements Iterator {
 
     protected function getDays() {
 
-        $recurrenceDays = array();
+        $recurrenceDays = [];
         foreach($this->byDay as $byDay) {
 
             // The day may be preceeded with a positive (+n) or
@@ -887,7 +889,7 @@ class RRuleIterator implements Iterator {
 
     protected function getMonths() {
 
-        $recurrenceMonths = array();
+        $recurrenceMonths = [];
         foreach($this->byMonth as $byMonth) {
             $recurrenceMonths[] = $byMonth;
         }
diff --git a/tests/VObject/DateTimeParserTest.php b/tests/VObject/DateTimeParserTest.php
index f4ae42d..952bee4 100644
--- a/tests/VObject/DateTimeParserTest.php
+++ b/tests/VObject/DateTimeParserTest.php
@@ -2,7 +2,7 @@
 
 namespace Sabre\VObject;
 
-use DateTime;
+use DateTimeImmutable;
 use DateTimeZone;
 use DateInterval;
 
@@ -45,7 +45,7 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
 
         $dateTime = DateTimeParser::parseDateTime('20100316T141405');
 
-        $compare = new DateTime('2010-03-16 14:14:05',new DateTimeZone('UTC'));
+        $compare = new DateTimeImmutable('2010-03-16 14:14:05',new DateTimeZone('UTC'));
 
         $this->assertEquals($compare, $dateTime);
 
@@ -68,7 +68,7 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
 
         $dateTime = DateTimeParser::parseDateTime('20100316T141405Z');
 
-        $compare = new DateTime('2010-03-16 14:14:05',new DateTimeZone('UTC'));
+        $compare = new DateTimeImmutable('2010-03-16 14:14:05',new DateTimeZone('UTC'));
         $this->assertEquals($compare, $dateTime);
 
     }
@@ -80,7 +80,7 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
 
         $dateTime = DateTimeParser::parseDateTime('20101211T160000Z');
 
-        $compare = new DateTime('2010-12-11 16:00:00',new DateTimeZone('UTC'));
+        $compare = new DateTimeImmutable('2010-12-11 16:00:00',new DateTimeZone('UTC'));
         $this->assertEquals($compare, $dateTime);
 
     }
@@ -92,7 +92,7 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
 
         $dateTime = DateTimeParser::parseDateTime('20100316T141405', new DateTimeZone('Europe/Amsterdam'));
 
-        $compare = new DateTime('2010-03-16 14:14:05',new DateTimeZone('Europe/Amsterdam'));
+        $compare = new DateTimeImmutable('2010-03-16 14:14:05',new DateTimeZone('Europe/Amsterdam'));
         $this->assertEquals($compare, $dateTime);
 
     }
@@ -101,7 +101,7 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
 
         $dateTime = DateTimeParser::parseDate('20100316');
 
-        $expected = new DateTime('2010-03-16 00:00:00',new DateTimeZone('UTC'));
+        $expected = new DateTimeImmutable('2010-03-16 00:00:00',new DateTimeZone('UTC'));
 
         $this->assertEquals($expected, $dateTime);
 
@@ -117,7 +117,7 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
 
         $dateTime = DateTimeParser::parseDate('45001231');
 
-        $expected = new DateTime('4500-12-31 00:00:00',new DateTimeZone('UTC'));
+        $expected = new DateTimeImmutable('4500-12-31 00:00:00',new DateTimeZone('UTC'));
 
         $this->assertEquals($expected, $dateTime);
 
@@ -133,7 +133,7 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
 
         $dateTime = DateTimeParser::parseDateTime('45001231T235959');
 
-        $expected = new DateTime('4500-12-31 23:59:59',new DateTimeZone('UTC'));
+        $expected = new DateTimeImmutable('4500-12-31 23:59:59',new DateTimeZone('UTC'));
 
         $this->assertEquals($expected, $dateTime);
 
@@ -186,10 +186,10 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
 
     function vcardDates() {
 
-        return array(
-            array(
+        return [
+            [
                 "19961022T140000",
-                array(
+                [
                     "year" => 1996,
                     "month" => 10,
                     "date" => 22,
@@ -197,11 +197,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => 00,
                     "second" => 00,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "--1022T1400",
-                array(
+                [
                     "year" => null,
                     "month" => 10,
                     "date" => 22,
@@ -209,11 +209,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => 00,
                     "second" => null,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "---22T14",
-                array(
+                [
                     "year" => null,
                     "month" => null,
                     "date" => 22,
@@ -221,11 +221,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => null,
                     "second" => null,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "19850412",
-                array(
+                [
                     "year" => 1985,
                     "month" => 4,
                     "date" => 12,
@@ -233,11 +233,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => null,
                     "second" => null,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "1985-04",
-                array(
+                [
                     "year" => 1985,
                     "month" => 04,
                     "date" => null,
@@ -245,11 +245,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => null,
                     "second" => null,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "1985",
-                array(
+                [
                     "year" => 1985,
                     "month" => null,
                     "date" => null,
@@ -257,11 +257,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => null,
                     "second" => null,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "--0412",
-                array(
+                [
                     "year" => null,
                     "month" => 4,
                     "date" => 12,
@@ -269,11 +269,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => null,
                     "second" => null,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "---12",
-                array(
+                [
                     "year" => null,
                     "month" => null,
                     "date" => 12,
@@ -281,11 +281,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => null,
                     "second" => null,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "T102200",
-                array(
+                [
                     "year" => null,
                     "month" => null,
                     "date" => null,
@@ -293,11 +293,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => 22,
                     "second" => 0,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "T1022",
-                array(
+                [
                     "year" => null,
                     "month" => null,
                     "date" => null,
@@ -305,11 +305,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => 22,
                     "second" => null,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "T10",
-                array(
+                [
                     "year" => null,
                     "month" => null,
                     "date" => null,
@@ -317,11 +317,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => null,
                     "second" => null,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "T-2200",
-                array(
+                [
                     "year" => null,
                     "month" => null,
                     "date" => null,
@@ -329,11 +329,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => 22,
                     "second" => 00,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "T--00",
-                array(
+                [
                     "year" => null,
                     "month" => null,
                     "date" => null,
@@ -341,11 +341,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => null,
                     "second" => 00,
                     "timezone" => null
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "T102200Z",
-                array(
+                [
                     "year" => null,
                     "month" => null,
                     "date" => null,
@@ -353,11 +353,11 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => 22,
                     "second" => 00,
                     "timezone" => 'Z'
-                ),
-            ),
-            array(
+                ],
+            ],
+            [
                 "T102200-0800",
-                array(
+                [
                     "year" => null,
                     "month" => null,
                     "date" => null,
@@ -365,13 +365,13 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => 22,
                     "second" => 00,
                     "timezone" => '-0800'
-                ),
-            ),
+                ],
+            ],
 
             // extended format
-            array(
+            [
                 "2012-11-29T15:10:53Z",
-                array(
+                [
                     "year" => 2012,
                     "month" => 11,
                     "date" => 29,
@@ -379,9 +379,9 @@ class DateTimeParserTest extends \PHPUnit_Framework_TestCase {
                     "minute" => 10,
                     "second" => 53,
                     "timezone" => 'Z'
-                ),
-            ),
-        );
+                ],
+            ],
+        ];
 
     }
 
diff --git a/tests/VObject/EmClientTest.php b/tests/VObject/EmClientTest.php
index 69d410f..2c72d23 100644
--- a/tests/VObject/EmClientTest.php
+++ b/tests/VObject/EmClientTest.php
@@ -2,6 +2,8 @@
 
 namespace Sabre\VObject;
 
+use DateTimeImmutable;
+
 class EmClientTest extends \PHPUnit_Framework_TestCase {
 
     function testParseTz() {
@@ -47,7 +49,7 @@ END:VCALENDAR';
 
         $vObject = Reader::read($str);
         $dt = $vObject->VEVENT->DTSTART->getDateTime();
-        $this->assertEquals(new \DateTime('2011-10-08 19:30:00', new \DateTimeZone('America/Chicago')), $dt);
+        $this->assertEquals(new DateTimeImmutable('2011-10-08 19:30:00', new \DateTimeZone('America/Chicago')), $dt);
 
     }
 
diff --git a/tests/VObject/FreeBusyGeneratorTest.php b/tests/VObject/FreeBusyGeneratorTest.php
index e96bc23..28e5acf 100644
--- a/tests/VObject/FreeBusyGeneratorTest.php
+++ b/tests/VObject/FreeBusyGeneratorTest.php
@@ -169,12 +169,12 @@ END:VCALENDAR
 ICS;
 
 
-        return array(
+        return [
             $blob1,
             $blob2,
             $blob3,
             $blob4,
-            $blob5,
+            $blob6,
             $blob6,
             $blob7,
             $blob8,
@@ -184,7 +184,7 @@ ICS;
             $blob12,
             $blob13,
             $blob14,
-        );
+        ];
 
     }
 
@@ -198,7 +198,7 @@ ICS;
 
         $result = $gen->getResult();
 
-        $expected = array(
+        $expected = [
             '20110101T120000Z/20110101T130000Z',
             '20110101T130000Z/20110101T140000Z',
             '20110101T180000Z/20110101T190000Z',
@@ -213,7 +213,7 @@ ICS;
 
             '20110101T220000Z/20110101T230000Z',
             '20110101T230000Z/20110102T000000Z',
-        );
+        ];
 
         foreach($result->VFREEBUSY->FREEBUSY as $fb) {
 
diff --git a/tests/VObject/Recur/EventIterator/InfiniteLoopProblemTest.php b/tests/VObject/Recur/EventIterator/InfiniteLoopProblemTest.php
index c4f115b..667247d 100644
--- a/tests/VObject/Recur/EventIterator/InfiniteLoopProblemTest.php
+++ b/tests/VObject/Recur/EventIterator/InfiniteLoopProblemTest.php
@@ -3,7 +3,7 @@
 namespace Sabre\VObject\Recur\EventIterator;
 
 use
-    DateTime,
+    DateTimeImmutable,
     DateTimeZone,
     Sabre\VObject\Component\VCalendar,
     Sabre\VObject\Recur;
@@ -27,7 +27,7 @@ class EventIteratorInfiniteLoopProblemTest extends \PHPUnit_Framework_TestCase {
         $ev->DTSTART = '20090420T180000Z';
         $ev->RRULE = 'FREQ=WEEKLY;BYDAY=MO;UNTIL=20090704T205959Z;INTERVAL=1';
 
-        $this->assertFalse($ev->isInTimeRange(new DateTime('2012-01-01 12:00:00'),new DateTime('3000-01-01 00:00:00')));
+        $this->assertFalse($ev->isInTimeRange(new DateTimeImmutable('2012-01-01 12:00:00'),new DateTimeImmutable('3000-01-01 00:00:00')));
 
     }
 
@@ -53,13 +53,13 @@ class EventIteratorInfiniteLoopProblemTest extends \PHPUnit_Framework_TestCase {
         $this->vcal->add($ev);
 
         $it = new Recur\EventIterator($this->vcal,'uuid');
-        $it->fastForward(new DateTime('2012-01-29 23:00:00', new DateTimeZone('UTC')));
+        $it->fastForward(new DateTimeImmutable('2012-01-29 23:00:00', new DateTimeZone('UTC')));
 
         $collect = array();
 
         while($it->valid()) {
             $collect[] = $it->getDTSTART();
-            if ($it->getDTSTART() > new DateTime('2013-02-05 22:59:59', new DateTimeZone('UTC'))) {
+            if ($it->getDTSTART() > new DateTimeImmutable('2013-02-05 22:59:59', new DateTimeZone('UTC'))) {
                 break;
             }
             $it->next();
@@ -67,7 +67,7 @@ class EventIteratorInfiniteLoopProblemTest extends \PHPUnit_Framework_TestCase {
         }
 
         $this->assertEquals(
-            array(new DateTime('2012-02-01 15:45:00', new DateTimeZone('Europe/Berlin'))),
+            array(new DateTimeImmutable('2012-02-01 15:45:00', new DateTimeZone('Europe/Berlin'))),
             $collect
         );
 
@@ -90,7 +90,7 @@ class EventIteratorInfiniteLoopProblemTest extends \PHPUnit_Framework_TestCase {
         $this->vcal->add($ev);
 
         $it = new Recur\EventIterator($this->vcal,'uuid');
-        $it->fastForward(new DateTime('2013-01-01 23:00:00', new DateTimeZone('UTC')));
+        $it->fastForward(new DateTimeImmutable('2013-01-01 23:00:00', new DateTimeZone('UTC')));
 
         // if we got this far.. it means we are no longer infinitely looping
 
diff --git a/tests/VObject/Recur/EventIterator/Issue48Test.php b/tests/VObject/Recur/EventIterator/Issue48Test.php
index 435a10c..30e6d33 100644
--- a/tests/VObject/Recur/EventIterator/Issue48Test.php
+++ b/tests/VObject/Recur/EventIterator/Issue48Test.php
@@ -3,7 +3,7 @@
 namespace Sabre\VObject;
 
 use
-    DateTime,
+    DateTimeImmutable,
     DateTimeZone;
 
 class Issue48Test extends \PHPUnit_Framework_TestCase {
@@ -37,9 +37,9 @@ ICS;
         $tz = new DateTimeZone('Europe/Moscow');
 
         $expected = array(
-            new DateTime('2013-07-10 11:00:00', $tz),
-            new DateTime('2013-07-12 11:00:00', $tz),
-            new DateTime('2013-07-13 11:00:00', $tz),
+            new DateTimeImmutable('2013-07-10 11:00:00', $tz),
+            new DateTimeImmutable('2013-07-12 11:00:00', $tz),
+            new DateTimeImmutable('2013-07-13 11:00:00', $tz),
         );
 
         $this->assertEquals($expected, $result);
diff --git a/tests/VObject/Recur/EventIterator/Issue50Test.php b/tests/VObject/Recur/EventIterator/Issue50Test.php
index 7a81295..ab6511b 100644
--- a/tests/VObject/Recur/EventIterator/Issue50Test.php
+++ b/tests/VObject/Recur/EventIterator/Issue50Test.php
@@ -3,7 +3,7 @@
 namespace Sabre\VObject;
 
 use
-    DateTime,
+    DateTimeImmutable,
     DateTimeZone;
 
 class Issue50Test extends \PHPUnit_Framework_TestCase {
@@ -116,11 +116,11 @@ ICS;
         $tz = new DateTimeZone('Europe/Brussels');
 
         $this->assertEquals(array(
-            new DateTime('2013-07-15 09:00:00', $tz),
-            new DateTime('2013-07-16 07:00:00', $tz),
-            new DateTime('2013-07-17 07:00:00', $tz),
-            new DateTime('2013-07-18 09:00:00', $tz),
-            new DateTime('2013-07-19 07:00:00', $tz),
+            new DateTimeImmutable('2013-07-15 09:00:00', $tz),
+            new DateTimeImmutable('2013-07-16 07:00:00', $tz),
+            new DateTimeImmutable('2013-07-17 07:00:00', $tz),
+            new DateTimeImmutable('2013-07-18 09:00:00', $tz),
+            new DateTimeImmutable('2013-07-19 07:00:00', $tz),
         ), $result);
 
     }
diff --git a/tests/VObject/Recur/EventIterator/MainTest.php b/tests/VObject/Recur/EventIterator/MainTest.php
index 064210c..464e967 100644
--- a/tests/VObject/Recur/EventIterator/MainTest.php
+++ b/tests/VObject/Recur/EventIterator/MainTest.php
@@ -2,7 +2,7 @@
 
 namespace Sabre\VObject\EventIterator;
 
-use DateTime;
+use DateTimeImmutable;
 use DateTimeZone;
 use Sabre\VObject\Recur\EventIterator;
 use Sabre\VObject\Component\VCalendar;
@@ -16,7 +16,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=DAILY;BYHOUR=10;BYMINUTE=5;BYSECOND=16;BYWEEKNO=32;BYYEARDAY=100,200';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-07'));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-07'));
 
         $ev->add($dtStart);
 
@@ -39,7 +39,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->RRULE = 'FREQ=SMONTHLY;INTERVAL=3;UNTIL=20111025T000000Z';
         $ev->UID = 'foo';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-07', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
         $vcal->add($ev);
@@ -79,7 +79,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=HOURLY;INTERVAL=3;UNTIL=20111025T000000Z';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-07 12:00:00', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-07 12:00:00', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
         $vcal->add($ev);
@@ -102,18 +102,18 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-10-07 12:00:00', $tz),
-                new DateTime('2011-10-07 15:00:00', $tz),
-                new DateTime('2011-10-07 18:00:00', $tz),
-                new DateTime('2011-10-07 21:00:00', $tz),
-                new DateTime('2011-10-08 00:00:00', $tz),
-                new DateTime('2011-10-08 03:00:00', $tz),
-                new DateTime('2011-10-08 06:00:00', $tz),
-                new DateTime('2011-10-08 09:00:00', $tz),
-                new DateTime('2011-10-08 12:00:00', $tz),
-                new DateTime('2011-10-08 15:00:00', $tz),
-                new DateTime('2011-10-08 18:00:00', $tz),
-                new DateTime('2011-10-08 21:00:00', $tz),
+                new DateTimeImmutable('2011-10-07 12:00:00', $tz),
+                new DateTimeImmutable('2011-10-07 15:00:00', $tz),
+                new DateTimeImmutable('2011-10-07 18:00:00', $tz),
+                new DateTimeImmutable('2011-10-07 21:00:00', $tz),
+                new DateTimeImmutable('2011-10-08 00:00:00', $tz),
+                new DateTimeImmutable('2011-10-08 03:00:00', $tz),
+                new DateTimeImmutable('2011-10-08 06:00:00', $tz),
+                new DateTimeImmutable('2011-10-08 09:00:00', $tz),
+                new DateTimeImmutable('2011-10-08 12:00:00', $tz),
+                new DateTimeImmutable('2011-10-08 15:00:00', $tz),
+                new DateTimeImmutable('2011-10-08 18:00:00', $tz),
+                new DateTimeImmutable('2011-10-08 21:00:00', $tz),
             ),
             $result
         );
@@ -131,7 +131,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=DAILY;INTERVAL=3;UNTIL=20111025T000000Z';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-07', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -155,13 +155,13 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-10-07', $tz),
-                new DateTime('2011-10-10', $tz),
-                new DateTime('2011-10-13', $tz),
-                new DateTime('2011-10-16', $tz),
-                new DateTime('2011-10-19', $tz),
-                new DateTime('2011-10-22', $tz),
-                new DateTime('2011-10-25', $tz),
+                new DateTimeImmutable('2011-10-07', $tz),
+                new DateTimeImmutable('2011-10-10', $tz),
+                new DateTimeImmutable('2011-10-13', $tz),
+                new DateTimeImmutable('2011-10-16', $tz),
+                new DateTimeImmutable('2011-10-19', $tz),
+                new DateTimeImmutable('2011-10-22', $tz),
+                new DateTimeImmutable('2011-10-25', $tz),
             ),
             $result
         );
@@ -178,7 +178,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $ev->UID = 'bla';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-07', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -202,7 +202,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-10-07', $tz),
+                new DateTimeImmutable('2011-10-07', $tz),
             ),
             $result
         );
@@ -220,7 +220,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=DAILY;BYDAY=SA,SU;BYHOUR=6,7';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-08 06:00:00', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-08 06:00:00', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -244,18 +244,18 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new datetime('2011-10-08 06:00:00', $tz),
-                new datetime('2011-10-08 07:00:00', $tz),
-                new datetime('2011-10-09 06:00:00', $tz),
-                new datetime('2011-10-09 07:00:00', $tz),
-                new datetime('2011-10-15 06:00:00', $tz),
-                new datetime('2011-10-15 07:00:00', $tz),
-                new datetime('2011-10-16 06:00:00', $tz),
-                new datetime('2011-10-16 07:00:00', $tz),
-                new datetime('2011-10-22 06:00:00', $tz),
-                new datetime('2011-10-22 07:00:00', $tz),
-                new datetime('2011-10-23 06:00:00', $tz),
-                new datetime('2011-10-23 07:00:00', $tz),
+                new DateTimeImmutable('2011-10-08 06:00:00', $tz),
+                new DateTimeImmutable('2011-10-08 07:00:00', $tz),
+                new DateTimeImmutable('2011-10-09 06:00:00', $tz),
+                new DateTimeImmutable('2011-10-09 07:00:00', $tz),
+                new DateTimeImmutable('2011-10-15 06:00:00', $tz),
+                new DateTimeImmutable('2011-10-15 07:00:00', $tz),
+                new DateTimeImmutable('2011-10-16 06:00:00', $tz),
+                new DateTimeImmutable('2011-10-16 07:00:00', $tz),
+                new DateTimeImmutable('2011-10-22 06:00:00', $tz),
+                new DateTimeImmutable('2011-10-22 07:00:00', $tz),
+                new DateTimeImmutable('2011-10-23 06:00:00', $tz),
+                new DateTimeImmutable('2011-10-23 07:00:00', $tz),
             ),
             $result
         );
@@ -273,7 +273,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=DAILY;INTERVAL=2;BYHOUR=10,11,12,13,14,15';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2012-10-11 12:00:00', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2012-10-11 12:00:00', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -297,18 +297,18 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new datetime('2012-10-11 12:00:00', $tz),
-                new datetime('2012-10-11 13:00:00', $tz),
-                new datetime('2012-10-11 14:00:00', $tz),
-                new datetime('2012-10-11 15:00:00', $tz),
-                new datetime('2012-10-13 10:00:00', $tz),
-                new datetime('2012-10-13 11:00:00', $tz),
-                new datetime('2012-10-13 12:00:00', $tz),
-                new datetime('2012-10-13 13:00:00', $tz),
-                new datetime('2012-10-13 14:00:00', $tz),
-                new datetime('2012-10-13 15:00:00', $tz),
-                new datetime('2012-10-15 10:00:00', $tz),
-                new datetime('2012-10-15 11:00:00', $tz),
+                new DateTimeImmutable('2012-10-11 12:00:00', $tz),
+                new DateTimeImmutable('2012-10-11 13:00:00', $tz),
+                new DateTimeImmutable('2012-10-11 14:00:00', $tz),
+                new DateTimeImmutable('2012-10-11 15:00:00', $tz),
+                new DateTimeImmutable('2012-10-13 10:00:00', $tz),
+                new DateTimeImmutable('2012-10-13 11:00:00', $tz),
+                new DateTimeImmutable('2012-10-13 12:00:00', $tz),
+                new DateTimeImmutable('2012-10-13 13:00:00', $tz),
+                new DateTimeImmutable('2012-10-13 14:00:00', $tz),
+                new DateTimeImmutable('2012-10-13 15:00:00', $tz),
+                new DateTimeImmutable('2012-10-15 10:00:00', $tz),
+                new DateTimeImmutable('2012-10-15 11:00:00', $tz),
             ),
             $result
         );
@@ -326,7 +326,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=DAILY;INTERVAL=2;BYDAY=TU,WE,FR';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-07', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -350,18 +350,18 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-10-07', $tz),
-                new DateTime('2011-10-11', $tz),
-                new DateTime('2011-10-19', $tz),
-                new DateTime('2011-10-21', $tz),
-                new DateTime('2011-10-25', $tz),
-                new DateTime('2011-11-02', $tz),
-                new DateTime('2011-11-04', $tz),
-                new DateTime('2011-11-08', $tz),
-                new DateTime('2011-11-16', $tz),
-                new DateTime('2011-11-18', $tz),
-                new DateTime('2011-11-22', $tz),
-                new DateTime('2011-11-30', $tz),
+                new DateTimeImmutable('2011-10-07', $tz),
+                new DateTimeImmutable('2011-10-11', $tz),
+                new DateTimeImmutable('2011-10-19', $tz),
+                new DateTimeImmutable('2011-10-21', $tz),
+                new DateTimeImmutable('2011-10-25', $tz),
+                new DateTimeImmutable('2011-11-02', $tz),
+                new DateTimeImmutable('2011-11-04', $tz),
+                new DateTimeImmutable('2011-11-08', $tz),
+                new DateTimeImmutable('2011-11-16', $tz),
+                new DateTimeImmutable('2011-11-18', $tz),
+                new DateTimeImmutable('2011-11-22', $tz),
+                new DateTimeImmutable('2011-11-30', $tz),
             ),
             $result
         );
@@ -379,7 +379,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=WEEKLY;INTERVAL=2;COUNT=10';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-07', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -403,16 +403,16 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-10-07', $tz),
-                new DateTime('2011-10-21', $tz),
-                new DateTime('2011-11-04', $tz),
-                new DateTime('2011-11-18', $tz),
-                new DateTime('2011-12-02', $tz),
-                new DateTime('2011-12-16', $tz),
-                new DateTime('2011-12-30', $tz),
-                new DateTime('2012-01-13', $tz),
-                new DateTime('2012-01-27', $tz),
-                new DateTime('2012-02-10', $tz),
+                new DateTimeImmutable('2011-10-07', $tz),
+                new DateTimeImmutable('2011-10-21', $tz),
+                new DateTimeImmutable('2011-11-04', $tz),
+                new DateTimeImmutable('2011-11-18', $tz),
+                new DateTimeImmutable('2011-12-02', $tz),
+                new DateTimeImmutable('2011-12-16', $tz),
+                new DateTimeImmutable('2011-12-30', $tz),
+                new DateTimeImmutable('2012-01-13', $tz),
+                new DateTimeImmutable('2012-01-27', $tz),
+                new DateTimeImmutable('2012-02-10', $tz),
             ),
             $result
         );
@@ -430,7 +430,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,WE,FR;WKST=MO;BYHOUR=8,9,10';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-07 08:00:00', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-07 08:00:00', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -454,21 +454,21 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-10-07 08:00:00', $tz),
-                new DateTime('2011-10-07 09:00:00', $tz),
-                new DateTime('2011-10-07 10:00:00', $tz),
-                new DateTime('2011-10-18 08:00:00', $tz),
-                new DateTime('2011-10-18 09:00:00', $tz),
-                new DateTime('2011-10-18 10:00:00', $tz),
-                new DateTime('2011-10-19 08:00:00', $tz),
-                new DateTime('2011-10-19 09:00:00', $tz),
-                new DateTime('2011-10-19 10:00:00', $tz),
-                new DateTime('2011-10-21 08:00:00', $tz),
-                new DateTime('2011-10-21 09:00:00', $tz),
-                new DateTime('2011-10-21 10:00:00', $tz),
-                new DateTime('2011-11-01 08:00:00', $tz),
-                new DateTime('2011-11-01 09:00:00', $tz),
-                new DateTime('2011-11-01 10:00:00', $tz),
+                new DateTimeImmutable('2011-10-07 08:00:00', $tz),
+                new DateTimeImmutable('2011-10-07 09:00:00', $tz),
+                new DateTimeImmutable('2011-10-07 10:00:00', $tz),
+                new DateTimeImmutable('2011-10-18 08:00:00', $tz),
+                new DateTimeImmutable('2011-10-18 09:00:00', $tz),
+                new DateTimeImmutable('2011-10-18 10:00:00', $tz),
+                new DateTimeImmutable('2011-10-19 08:00:00', $tz),
+                new DateTimeImmutable('2011-10-19 09:00:00', $tz),
+                new DateTimeImmutable('2011-10-19 10:00:00', $tz),
+                new DateTimeImmutable('2011-10-21 08:00:00', $tz),
+                new DateTimeImmutable('2011-10-21 09:00:00', $tz),
+                new DateTimeImmutable('2011-10-21 10:00:00', $tz),
+                new DateTimeImmutable('2011-11-01 08:00:00', $tz),
+                new DateTimeImmutable('2011-11-01 09:00:00', $tz),
+                new DateTimeImmutable('2011-11-01 10:00:00', $tz),
             ),
             $result
         );
@@ -486,7 +486,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,WE,FR;WKST=SU';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-07 18:00:00', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-07 18:00:00', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -510,18 +510,18 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-10-07 18:00:00', $tz),
-                new DateTime('2011-10-18 18:00:00', $tz),
-                new DateTime('2011-10-19 18:00:00', $tz),
-                new DateTime('2011-10-21 18:00:00', $tz),
-                new DateTime('2011-11-01 18:00:00', $tz),
-                new DateTime('2011-11-02 18:00:00', $tz),
-                new DateTime('2011-11-04 18:00:00', $tz),
-                new DateTime('2011-11-15 18:00:00', $tz),
-                new DateTime('2011-11-16 18:00:00', $tz),
-                new DateTime('2011-11-18 18:00:00', $tz),
-                new DateTime('2011-11-29 18:00:00', $tz),
-                new DateTime('2011-11-30 18:00:00', $tz),
+                new DateTimeImmutable('2011-10-07 18:00:00', $tz),
+                new DateTimeImmutable('2011-10-18 18:00:00', $tz),
+                new DateTimeImmutable('2011-10-19 18:00:00', $tz),
+                new DateTimeImmutable('2011-10-21 18:00:00', $tz),
+                new DateTimeImmutable('2011-11-01 18:00:00', $tz),
+                new DateTimeImmutable('2011-11-02 18:00:00', $tz),
+                new DateTimeImmutable('2011-11-04 18:00:00', $tz),
+                new DateTimeImmutable('2011-11-15 18:00:00', $tz),
+                new DateTimeImmutable('2011-11-16 18:00:00', $tz),
+                new DateTimeImmutable('2011-11-18 18:00:00', $tz),
+                new DateTimeImmutable('2011-11-29 18:00:00', $tz),
+                new DateTimeImmutable('2011-11-30 18:00:00', $tz),
             ),
             $result
         );
@@ -539,7 +539,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,WE,FR;WKST=SU';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-07', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -563,18 +563,18 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-10-07', $tz),
-                new DateTime('2011-10-18', $tz),
-                new DateTime('2011-10-19', $tz),
-                new DateTime('2011-10-21', $tz),
-                new DateTime('2011-11-01', $tz),
-                new DateTime('2011-11-02', $tz),
-                new DateTime('2011-11-04', $tz),
-                new DateTime('2011-11-15', $tz),
-                new DateTime('2011-11-16', $tz),
-                new DateTime('2011-11-18', $tz),
-                new DateTime('2011-11-29', $tz),
-                new DateTime('2011-11-30', $tz),
+                new DateTimeImmutable('2011-10-07', $tz),
+                new DateTimeImmutable('2011-10-18', $tz),
+                new DateTimeImmutable('2011-10-19', $tz),
+                new DateTimeImmutable('2011-10-21', $tz),
+                new DateTimeImmutable('2011-11-01', $tz),
+                new DateTimeImmutable('2011-11-02', $tz),
+                new DateTimeImmutable('2011-11-04', $tz),
+                new DateTimeImmutable('2011-11-15', $tz),
+                new DateTimeImmutable('2011-11-16', $tz),
+                new DateTimeImmutable('2011-11-18', $tz),
+                new DateTimeImmutable('2011-11-29', $tz),
+                new DateTimeImmutable('2011-11-30', $tz),
             ),
             $result
         );
@@ -592,7 +592,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=3;COUNT=5';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-12-05', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-12-05', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -615,11 +615,11 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-12-05', $tz),
-                new DateTime('2012-03-05', $tz),
-                new DateTime('2012-06-05', $tz),
-                new DateTime('2012-09-05', $tz),
-                new DateTime('2012-12-05', $tz),
+                new DateTimeImmutable('2011-12-05', $tz),
+                new DateTimeImmutable('2012-03-05', $tz),
+                new DateTimeImmutable('2012-06-05', $tz),
+                new DateTimeImmutable('2012-09-05', $tz),
+                new DateTimeImmutable('2012-12-05', $tz),
             ),
             $result
         );
@@ -638,7 +638,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=2;COUNT=12';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-12-31', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-12-31', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -661,18 +661,18 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-12-31', $tz),
-                new DateTime('2012-08-31', $tz),
-                new DateTime('2012-10-31', $tz),
-                new DateTime('2012-12-31', $tz),
-                new DateTime('2013-08-31', $tz),
-                new DateTime('2013-10-31', $tz),
-                new DateTime('2013-12-31', $tz),
-                new DateTime('2014-08-31', $tz),
-                new DateTime('2014-10-31', $tz),
-                new DateTime('2014-12-31', $tz),
-                new DateTime('2015-08-31', $tz),
-                new DateTime('2015-10-31', $tz),
+                new DateTimeImmutable('2011-12-31', $tz),
+                new DateTimeImmutable('2012-08-31', $tz),
+                new DateTimeImmutable('2012-10-31', $tz),
+                new DateTimeImmutable('2012-12-31', $tz),
+                new DateTimeImmutable('2013-08-31', $tz),
+                new DateTimeImmutable('2013-10-31', $tz),
+                new DateTimeImmutable('2013-12-31', $tz),
+                new DateTimeImmutable('2014-08-31', $tz),
+                new DateTimeImmutable('2014-10-31', $tz),
+                new DateTimeImmutable('2014-12-31', $tz),
+                new DateTimeImmutable('2015-08-31', $tz),
+                new DateTimeImmutable('2015-10-31', $tz),
             ),
             $result
         );
@@ -691,7 +691,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=5;COUNT=9;BYMONTHDAY=1,31,-7';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-01-01', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-01-01', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -714,15 +714,15 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-01-01', $tz),
-                new DateTime('2011-01-25', $tz),
-                new DateTime('2011-01-31', $tz),
-                new DateTime('2011-06-01', $tz),
-                new DateTime('2011-06-24', $tz),
-                new DateTime('2011-11-01', $tz),
-                new DateTime('2011-11-24', $tz),
-                new DateTime('2012-04-01', $tz),
-                new DateTime('2012-04-24', $tz),
+                new DateTimeImmutable('2011-01-01', $tz),
+                new DateTimeImmutable('2011-01-25', $tz),
+                new DateTimeImmutable('2011-01-31', $tz),
+                new DateTimeImmutable('2011-06-01', $tz),
+                new DateTimeImmutable('2011-06-24', $tz),
+                new DateTimeImmutable('2011-11-01', $tz),
+                new DateTimeImmutable('2011-11-24', $tz),
+                new DateTimeImmutable('2012-04-01', $tz),
+                new DateTimeImmutable('2012-04-24', $tz),
             ),
             $result
         );
@@ -744,7 +744,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=2;COUNT=16;BYDAY=MO,-2TU,+1WE,3TH';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-01-03', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-01-03', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -767,22 +767,22 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-01-03', $tz),
-                new DateTime('2011-01-05', $tz),
-                new DateTime('2011-01-10', $tz),
-                new DateTime('2011-01-17', $tz),
-                new DateTime('2011-01-18', $tz),
-                new DateTime('2011-01-20', $tz),
-                new DateTime('2011-01-24', $tz),
-                new DateTime('2011-01-31', $tz),
-                new DateTime('2011-03-02', $tz),
-                new DateTime('2011-03-07', $tz),
-                new DateTime('2011-03-14', $tz),
-                new DateTime('2011-03-17', $tz),
-                new DateTime('2011-03-21', $tz),
-                new DateTime('2011-03-22', $tz),
-                new DateTime('2011-03-28', $tz),
-                new DateTime('2011-05-02', $tz),
+                new DateTimeImmutable('2011-01-03', $tz),
+                new DateTimeImmutable('2011-01-05', $tz),
+                new DateTimeImmutable('2011-01-10', $tz),
+                new DateTimeImmutable('2011-01-17', $tz),
+                new DateTimeImmutable('2011-01-18', $tz),
+                new DateTimeImmutable('2011-01-20', $tz),
+                new DateTimeImmutable('2011-01-24', $tz),
+                new DateTimeImmutable('2011-01-31', $tz),
+                new DateTimeImmutable('2011-03-02', $tz),
+                new DateTimeImmutable('2011-03-07', $tz),
+                new DateTimeImmutable('2011-03-14', $tz),
+                new DateTimeImmutable('2011-03-17', $tz),
+                new DateTimeImmutable('2011-03-21', $tz),
+                new DateTimeImmutable('2011-03-22', $tz),
+                new DateTimeImmutable('2011-03-28', $tz),
+                new DateTimeImmutable('2011-05-02', $tz),
             ),
             $result
         );
@@ -800,7 +800,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=MONTHLY;COUNT=10;BYDAY=MO;BYMONTHDAY=1';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-08-01', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-08-01', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -823,16 +823,16 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-08-01', $tz),
-                new DateTime('2012-10-01', $tz),
-                new DateTime('2013-04-01', $tz),
-                new DateTime('2013-07-01', $tz),
-                new DateTime('2014-09-01', $tz),
-                new DateTime('2014-12-01', $tz),
-                new DateTime('2015-06-01', $tz),
-                new DateTime('2016-02-01', $tz),
-                new DateTime('2016-08-01', $tz),
-                new DateTime('2017-05-01', $tz),
+                new DateTimeImmutable('2011-08-01', $tz),
+                new DateTimeImmutable('2012-10-01', $tz),
+                new DateTimeImmutable('2013-04-01', $tz),
+                new DateTimeImmutable('2013-07-01', $tz),
+                new DateTimeImmutable('2014-09-01', $tz),
+                new DateTimeImmutable('2014-12-01', $tz),
+                new DateTimeImmutable('2015-06-01', $tz),
+                new DateTimeImmutable('2016-02-01', $tz),
+                new DateTimeImmutable('2016-08-01', $tz),
+                new DateTimeImmutable('2017-05-01', $tz),
             ),
             $result
         );
@@ -850,7 +850,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=MONTHLY;COUNT=10;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=1,-1';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-01-03', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-01-03', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -873,16 +873,16 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-01-03', $tz),
-                new DateTime('2011-01-31', $tz),
-                new DateTime('2011-02-01', $tz),
-                new DateTime('2011-02-28', $tz),
-                new DateTime('2011-03-01', $tz),
-                new DateTime('2011-03-31', $tz),
-                new DateTime('2011-04-01', $tz),
-                new DateTime('2011-04-29', $tz),
-                new DateTime('2011-05-02', $tz),
-                new DateTime('2011-05-31', $tz),
+                new DateTimeImmutable('2011-01-03', $tz),
+                new DateTimeImmutable('2011-01-31', $tz),
+                new DateTimeImmutable('2011-02-01', $tz),
+                new DateTimeImmutable('2011-02-28', $tz),
+                new DateTimeImmutable('2011-03-01', $tz),
+                new DateTimeImmutable('2011-03-31', $tz),
+                new DateTimeImmutable('2011-04-01', $tz),
+                new DateTimeImmutable('2011-04-29', $tz),
+                new DateTimeImmutable('2011-05-02', $tz),
+                new DateTimeImmutable('2011-05-31', $tz),
             ),
             $result
         );
@@ -900,7 +900,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=YEARLY;COUNT=10;INTERVAL=3';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-01-01', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-01-01', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -923,16 +923,16 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-01-01', $tz),
-                new DateTime('2014-01-01', $tz),
-                new DateTime('2017-01-01', $tz),
-                new DateTime('2020-01-01', $tz),
-                new DateTime('2023-01-01', $tz),
-                new DateTime('2026-01-01', $tz),
-                new DateTime('2029-01-01', $tz),
-                new DateTime('2032-01-01', $tz),
-                new DateTime('2035-01-01', $tz),
-                new DateTime('2038-01-01', $tz),
+                new DateTimeImmutable('2011-01-01', $tz),
+                new DateTimeImmutable('2014-01-01', $tz),
+                new DateTimeImmutable('2017-01-01', $tz),
+                new DateTimeImmutable('2020-01-01', $tz),
+                new DateTimeImmutable('2023-01-01', $tz),
+                new DateTimeImmutable('2026-01-01', $tz),
+                new DateTimeImmutable('2029-01-01', $tz),
+                new DateTimeImmutable('2032-01-01', $tz),
+                new DateTimeImmutable('2035-01-01', $tz),
+                new DateTimeImmutable('2038-01-01', $tz),
             ),
             $result
         );
@@ -950,7 +950,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=YEARLY;COUNT=3';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2012-02-29', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2012-02-29', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -973,9 +973,9 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2012-02-29', $tz),
-                new DateTime('2016-02-29', $tz),
-                new DateTime('2020-02-29', $tz),
+                new DateTimeImmutable('2012-02-29', $tz),
+                new DateTimeImmutable('2016-02-29', $tz),
+                new DateTimeImmutable('2020-02-29', $tz),
             ),
             $result
         );
@@ -993,7 +993,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=YEARLY;COUNT=8;INTERVAL=4;BYMONTH=4,10';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-04-07', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-04-07', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -1016,14 +1016,14 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-04-07', $tz),
-                new DateTime('2011-10-07', $tz),
-                new DateTime('2015-04-07', $tz),
-                new DateTime('2015-10-07', $tz),
-                new DateTime('2019-04-07', $tz),
-                new DateTime('2019-10-07', $tz),
-                new DateTime('2023-04-07', $tz),
-                new DateTime('2023-10-07', $tz),
+                new DateTimeImmutable('2011-04-07', $tz),
+                new DateTimeImmutable('2011-10-07', $tz),
+                new DateTimeImmutable('2015-04-07', $tz),
+                new DateTimeImmutable('2015-10-07', $tz),
+                new DateTimeImmutable('2019-04-07', $tz),
+                new DateTimeImmutable('2019-10-07', $tz),
+                new DateTimeImmutable('2023-04-07', $tz),
+                new DateTimeImmutable('2023-10-07', $tz),
             ),
             $result
         );
@@ -1041,7 +1041,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=YEARLY;COUNT=8;INTERVAL=5;BYMONTH=4,10;BYDAY=1MO,-1SU';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-04-04', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-04-04', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -1064,14 +1064,14 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-04-04', $tz),
-                new DateTime('2011-04-24', $tz),
-                new DateTime('2011-10-03', $tz),
-                new DateTime('2011-10-30', $tz),
-                new DateTime('2016-04-04', $tz),
-                new DateTime('2016-04-24', $tz),
-                new DateTime('2016-10-03', $tz),
-                new DateTime('2016-10-30', $tz),
+                new DateTimeImmutable('2011-04-04', $tz),
+                new DateTimeImmutable('2011-04-24', $tz),
+                new DateTimeImmutable('2011-10-03', $tz),
+                new DateTimeImmutable('2011-10-30', $tz),
+                new DateTimeImmutable('2016-04-04', $tz),
+                new DateTimeImmutable('2016-04-24', $tz),
+                new DateTimeImmutable('2016-10-03', $tz),
+                new DateTimeImmutable('2016-10-30', $tz),
             ),
             $result
         );
@@ -1089,7 +1089,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $ev->UID = 'bla';
         $ev->RRULE = 'FREQ=YEARLY;COUNT=8;INTERVAL=5;BYMONTH=4,10;BYDAY=1MO,-1SU';
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-04-04', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-04-04', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -1099,7 +1099,7 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         // The idea is that we're fast-forwarding too far in the future, so
         // there will be no results left.
-        $it->fastForward(new DateTime('2020-05-05', new DateTimeZone('UTC')));
+        $it->fastForward(new DateTimeImmutable('2020-05-05', new DateTimeZone('UTC')));
 
         $max = 20;
         $result = array();
@@ -1131,12 +1131,12 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         $dtStart = $vcal->createProperty('DTSTART');
 
         $tz = new DateTimeZone('Canada/Eastern');
-        $dtStart->setDateTime(new DateTime('2011-01-01 13:50:20', $tz));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-01-01 13:50:20', $tz));
 
         $exDate1 = $vcal->createProperty('EXDATE');
-        $exDate1->setDateTimes(array(new DateTime('2012-01-01 13:50:20', $tz), new DateTime('2014-01-01 13:50:20', $tz)));
+        $exDate1->setDateTimes(array(new DateTimeImmutable('2012-01-01 13:50:20', $tz), new DateTimeImmutable('2014-01-01 13:50:20', $tz)));
         $exDate2 = $vcal->createProperty('EXDATE');
-        $exDate2->setDateTimes(array(new DateTime('2016-01-01 13:50:20', $tz)));
+        $exDate2->setDateTimes(array(new DateTimeImmutable('2016-01-01 13:50:20', $tz)));
 
         $ev->add($dtStart);
         $ev->add($exDate1);
@@ -1159,13 +1159,13 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-01-01 13:50:20', $tz),
-                new DateTime('2013-01-01 13:50:20', $tz),
-                new DateTime('2015-01-01 13:50:20', $tz),
-                new DateTime('2017-01-01 13:50:20', $tz),
-                new DateTime('2018-01-01 13:50:20', $tz),
-                new DateTime('2019-01-01 13:50:20', $tz),
-                new DateTime('2020-01-01 13:50:20', $tz),
+                new DateTimeImmutable('2011-01-01 13:50:20', $tz),
+                new DateTimeImmutable('2013-01-01 13:50:20', $tz),
+                new DateTimeImmutable('2015-01-01 13:50:20', $tz),
+                new DateTimeImmutable('2017-01-01 13:50:20', $tz),
+                new DateTimeImmutable('2018-01-01 13:50:20', $tz),
+                new DateTimeImmutable('2019-01-01 13:50:20', $tz),
+                new DateTimeImmutable('2020-01-01 13:50:20', $tz),
             ),
             $result
         );
@@ -1219,16 +1219,16 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $tz = new DateTimeZone('UTC');
         $this->assertEquals(array(
-            new DateTime('2012-01-07 12:00:00',$tz),
-            new DateTime('2012-01-08 12:00:00',$tz),
-            new DateTime('2012-01-09 12:00:00',$tz),
-            new DateTime('2012-01-10 14:00:00',$tz),
-            new DateTime('2012-01-11 12:00:00',$tz),
-            new DateTime('2012-01-12 12:00:00',$tz),
-            new DateTime('2012-01-14 12:00:00',$tz),
-            new DateTime('2012-01-15 12:00:00',$tz),
-            new DateTime('2012-01-15 14:00:00',$tz),
-            new DateTime('2012-01-16 12:00:00',$tz),
+            new DateTimeImmutable('2012-01-07 12:00:00',$tz),
+            new DateTimeImmutable('2012-01-08 12:00:00',$tz),
+            new DateTimeImmutable('2012-01-09 12:00:00',$tz),
+            new DateTimeImmutable('2012-01-10 14:00:00',$tz),
+            new DateTimeImmutable('2012-01-11 12:00:00',$tz),
+            new DateTimeImmutable('2012-01-12 12:00:00',$tz),
+            new DateTimeImmutable('2012-01-14 12:00:00',$tz),
+            new DateTimeImmutable('2012-01-15 12:00:00',$tz),
+            new DateTimeImmutable('2012-01-15 14:00:00',$tz),
+            new DateTimeImmutable('2012-01-16 12:00:00',$tz),
         ), $dates);
 
         $this->assertEquals(array(
@@ -1284,9 +1284,9 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $tz = new DateTimeZone('UTC');
         $this->assertEquals(array(
-            new DateTime('2012-01-12 12:00:00',$tz),
-            new DateTime('2012-01-13 12:00:00',$tz),
-            new DateTime('2012-01-26 12:00:00',$tz),
+            new DateTimeImmutable('2012-01-12 12:00:00',$tz),
+            new DateTimeImmutable('2012-01-13 12:00:00',$tz),
+            new DateTimeImmutable('2012-01-26 12:00:00',$tz),
 
         ), $dates);
 
@@ -1330,12 +1330,12 @@ class MainTest extends \PHPUnit_Framework_TestCase {
         // The reported problem was specifically related to the VCALENDAR
         // expansion. In this parcitular case, we had to forward to the 28th of
         // january.
-        $it->fastForward(new DateTime('2012-01-28 23:00:00'));
+        $it->fastForward(new DateTimeImmutable('2012-01-28 23:00:00'));
 
         // We stop the loop when it hits the 6th of februari. Normally this
         // iterator would hit 24, 25 (overriden from 31) and 7 feb but because
         // we 'filter' from the 28th till the 6th, we should get 0 results.
-        while($it->valid() && $it->getDTSTart() < new DateTime('2012-02-06 23:00:00')) {
+        while($it->valid() && $it->getDTSTart() < new DateTimeImmutable('2012-02-06 23:00:00')) {
 
             $dates[] = $it->getDTStart();
             $summaries[] = (string)$it->getEventObject()->SUMMARY;
@@ -1358,11 +1358,11 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $ev->UID = 'bla';
         $ev->RDATE = array(
-            new DateTime('2014-08-07', new DateTimeZone('UTC')),
-            new DateTime('2014-08-08', new DateTimeZone('UTC')),
+            new DateTimeImmutable('2014-08-07', new DateTimeZone('UTC')),
+            new DateTimeImmutable('2014-08-08', new DateTimeZone('UTC')),
         );
         $dtStart = $vcal->createProperty('DTSTART');
-        $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')));
+        $dtStart->setDateTime(new DateTimeImmutable('2011-10-07', new DateTimeZone('UTC')));
 
         $ev->add($dtStart);
 
@@ -1386,9 +1386,9 @@ class MainTest extends \PHPUnit_Framework_TestCase {
 
         $this->assertEquals(
             array(
-                new DateTime('2011-10-07', $tz),
-                new DateTime('2014-08-07', $tz),
-                new DateTime('2014-08-08', $tz),
+                new DateTimeImmutable('2011-10-07', $tz),
+                new DateTimeImmutable('2014-08-07', $tz),
+                new DateTimeImmutable('2014-08-08', $tz),
             ),
             $result
         );
diff --git a/tests/VObject/Recur/RDateIteratorTest.php b/tests/VObject/Recur/RDateIteratorTest.php
index 5663c9a..640cb1e 100644
--- a/tests/VObject/Recur/RDateIteratorTest.php
+++ b/tests/VObject/Recur/RDateIteratorTest.php
@@ -2,7 +2,7 @@
 
 namespace Sabre\VObject\Recur;
 
-use DateTime;
+use DateTimeImmutable;
 use DateTimeZone;
 
 class RDateIteratorTest extends \PHPUnit_Framework_TestCase {
@@ -10,12 +10,12 @@ class RDateIteratorTest extends \PHPUnit_Framework_TestCase {
     function testSimple() {
 
         $utc = new DateTimeZone('UTC');
-        $it = new RDateIterator('20140901T000000Z,20141001T000000Z', new DateTime('2014-08-01 00:00:00', $utc));
+        $it = new RDateIterator('20140901T000000Z,20141001T000000Z', new DateTimeImmutable('2014-08-01 00:00:00', $utc));
 
         $expected = array(
-            new DateTime('2014-08-01 00:00:00', $utc),
-            new DateTime('2014-09-01 00:00:00', $utc),
-            new DateTime('2014-10-01 00:00:00', $utc),
+            new DateTimeImmutable('2014-08-01 00:00:00', $utc),
+            new DateTimeImmutable('2014-09-01 00:00:00', $utc),
+            new DateTimeImmutable('2014-10-01 00:00:00', $utc),
         );
 
         $this->assertEquals(
@@ -30,9 +30,9 @@ class RDateIteratorTest extends \PHPUnit_Framework_TestCase {
     function testFastForward() {
 
         $utc = new DateTimeZone('UTC');
-        $it = new RDateIterator('20140901T000000Z,20141001T000000Z', new DateTime('2014-08-01 00:00:00', $utc));
+        $it = new RDateIterator('20140901T000000Z,20141001T000000Z', new DateTimeImmutable('2014-08-01 00:00:00', $utc));
 
-        $it->fastForward(new DateTime('2014-08-15 00:00:00'));
+        $it->fastForward(new DateTimeImmutable('2014-08-15 00:00:00'));
 
         $result = array();
         while($it->valid()) {
@@ -41,8 +41,8 @@ class RDateIteratorTest extends \PHPUnit_Framework_TestCase {
         }
 
         $expected = array(
-            new DateTime('2014-09-01 00:00:00', $utc),
-            new DateTime('2014-10-01 00:00:00', $utc),
+            new DateTimeImmutable('2014-09-01 00:00:00', $utc),
+            new DateTimeImmutable('2014-10-01 00:00:00', $utc),
         );
 
         $this->assertEquals(

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git



More information about the Pkg-owncloud-commits mailing list