private static function clone(\DateInterval $interval)
    {
        $specification = $interval->format('P%yY%mM%dDT%hH%iM%sS');
        
        $clone = new \DateInterval($specification);
        
        $clone->days   = $interval->days;
        $clone->invert = $interval->invert;
        
        return $clone;
    }
private static function clone(\DateInterval $interval)
    {
        $specification = $interval->format('P%yY%mM%dDT%hH%iM%sS');
        
        $clone = new \DateInterval($specification);
        
        $clone->days   = $interval->days;
        $clone->invert = $interval->invert;
        
        return $clone;
    }
private static function clone ( \ DateInterval $ interval ) { $ specification = $ interval -> format ( 'P%yY%mM%dDT%hH%iM%sS' ) ; $ clone = new \ DateInterval ( $ specification ) ; $ clone -> days = $ interval -> days ; $ clone -> invert = $ interval -> invert ; return $ clone ; }
Clone does not work for DateInterval object for some reason, it leads to an error.

"The DateInterval object has not been correctly initialized by its constructor"

This method works around this by creating an equivalent instance manually.

@param \DateInterval $interval

@return \DateInterval
Clone does not work for DateInterval object for some reason it leads to an error .