소스 검색

[Finder] Avoid unnecessary use of the @ operator

Jordi Boggiano 13 년 전
부모
커밋
f3408ccf2c
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      src/Symfony/Component/Finder/Comparator/DateComparator.php

+ 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]));
         }