Sfoglia il codice sorgente

[Finder] Avoid unnecessary use of the @ operator

Jordi Boggiano 13 anni fa
parent
commit
f3408ccf2c

+ 4 - 1
src/Symfony/Component/Finder/Comparator/DateComparator.php

@@ -32,7 +32,10 @@ class DateComparator extends Comparator
             throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
         }
 
-        if (false === $target = @strtotime($matches[2])) {
+        try {
+            $date = new \DateTime($matches[2]);
+            $target = $date->format('U');
+        } catch (\Exception $e) {
             throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
         }