From 260505129e4b176966fa17915c09e58186470516 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 6 Jan 2012 20:35:29 +0100 Subject: [PATCH] added missing phpdoc --- lib/Twig/Extension/Core.php | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 1e18be3..f78be90 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -329,6 +329,20 @@ function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $ return twig_date_converter($date, $timezone)->format($format); } +/** + * Converts an input to a DateTime instance. + * + *
+ *    {% if date(user.created_at) < date('+2days') %}
+ *      {# do something #}
+ *    {% endif %}
+ * 
+ * + * @param DateTime|string $date A date + * @param DateTimeZone|string $timezone A timezone + * + * @return DateTime A DateTime instance + */ function twig_date_converter($date = null, $timezone = null) { if ($date instanceof DateTime) { -- 1.7.2.5