Browse Source

work with Traversable

stealth35 14 năm trước cách đây
mục cha
commit
566320d1a9
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      src/Symfony/Bundle/FrameworkBundle/Util/Filesystem.php

+ 5 - 1
src/Symfony/Bundle/FrameworkBundle/Util/Filesystem.php

@@ -91,9 +91,13 @@ class Filesystem
      */
     public function remove($files)
     {
-        if (!is_array($files)) {
+        if (!is_array($files) && !$files instanceof \Traversable) {
             $files = array($files);
         }
+        
+        if($files instanceof \Traversable) {
+            $files = iterator_to_array($files);
+        }
 
         $files = array_reverse($files);
         foreach ($files as $file) {