diff --git a/src/Finder/Finder.php b/src/Finder/Finder.php index b94a672..968ebc9 100644 --- a/src/Finder/Finder.php +++ b/src/Finder/Finder.php @@ -248,24 +248,22 @@ private function buildIterator($path) $iterator->setMaxDepth($this->maxDepth); } - if ($this->groups) { - $groups = $this->groups; - $iterator = new CallbackFilterIterator($iterator, function ($foo, $bar, CallbackFilterIterator $file) use ($groups) { - do { - $file = $file->getInnerIterator(); - } while (!$file instanceof RecursiveDirectoryIterator); - - foreach ($groups as $filters) { - foreach ($filters as $filter) { - if (!call_user_func($filter, $file)) { - continue 2; - } + $groups = $this->groups; + $iterator = new CallbackFilterIterator($iterator, function ($foo, $bar, CallbackFilterIterator $file) use ($groups) { + do { + $file = $file->getInnerIterator(); + } while (!$file instanceof RecursiveDirectoryIterator); + + foreach ($groups as $filters) { + foreach ($filters as $filter) { + if (!call_user_func($filter, $file)) { + continue 2; } - return TRUE; } - return FALSE; - }); - } + return TRUE; + } + return FALSE; + }); return $iterator; }