From ea8e796b42d542bd90e76f5b2a41c2c86a008256 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 20 Oct 2015 13:09:02 +0200 Subject: [PATCH] $groups is never empty --- src/Finder/Finder.php | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) 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; }