/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/date/tests/DateTimeImmutable_createFromMutable-002.phpt
29 строк
770 B
Derick Rethans
Implement More Appropriate Date/Time Exceptions RFC
08 фев 2023, 13:27
08 фев 2023, 13:27
b7860cd
Код
Авторство
О чём код?
--TEST-- Tests for inherited DateTimeImmutable::createFromMutable --INI-- date.timezone=Europe/London --FILE-- <?php class MyDateTimeImmutable extends DateTimeImmutable {} $current = "2014-03-02 16:24:08"; $i = MyDateTimeImmutable::createFromMutable( date_create( $current ) ); var_dump( $i ); try { MyDateTimeImmutable::createFromMutable( date_create_immutable( $current ) ); } catch (TypeError $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECTF-- object(MyDateTimeImmutable)#%d (3) { ["date"]=> string(26) "2014-03-02 16:24:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/London" } TypeError: DateTimeImmutable::createFromMutable(): Argument #1 ($object) must be of type DateTime, DateTimeImmutable given