1--TEST-- 2Tests for inherited DateTimeImmutable::createFromMutable 3--INI-- 4date.timezone=Europe/London 5--FILE-- 6<?php 7class MyDateTimeImmutable extends DateTimeImmutable {} 8 9$current = "2014-03-02 16:24:08"; 10 11$i = MyDateTimeImmutable::createFromMutable( date_create( $current ) ); 12var_dump( $i ); 13 14try { 15 MyDateTimeImmutable::createFromMutable( date_create_immutable( $current ) ); 16} catch (TypeError $e) { 17 echo $e->getMessage(), "\n"; 18} 19?> 20--EXPECTF-- 21object(MyDateTimeImmutable)#%d (3) { 22 ["date"]=> 23 string(26) "2014-03-02 16:24:08.000000" 24 ["timezone_type"]=> 25 int(3) 26 ["timezone"]=> 27 string(13) "Europe/London" 28} 29DateTimeImmutable::createFromMutable(): Argument #1 ($object) must be of type DateTime, DateTimeImmutable given 30