/
githubmirror
/
symfony
Обзор
Документация
Войти
/
githubmirror
/
symfony
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
8.2
src/Symfony/Component/Clock/Resources/now.php
28 строк
685 B
Nicolas Grekas
[Clock] Add `DatePoint`: an immutable DateTime implementation with stricter error handling and return types
26 сен 2023, 19:07
26 сен 2023, 19:07
2f384d1
Код
Авторство
О чём код?
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Clock; if (!\function_exists(now::class)) { /** * @throws \DateMalformedStringException When the modifier is invalid */ function now(string $modifier = 'now'): DatePoint { if ('now' !== $modifier) { return new DatePoint($modifier); } $now = Clock::get()->now(); return $now instanceof DatePoint ? $now : DatePoint::createFromInterface($now); } }