8000 bug #15803 [Finder] Exclude files based on path before applying the s… · symfony/symfony@306d88a · GitHub
[go: up one dir, main page]

Skip to content

Commit 306d88a

Browse files
committed
bug #15803 [Finder] Exclude files based on path before applying the sorting (stof)
This PR was merged into the 2.3 branch. Discussion ---------- [Finder] Exclude files based on path before applying the sorting | Q | A | ------------- | --- | Bug fix? | yes (perf) | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Sorting can be slow, so it is best to applied it after all filtering rules are applied instead of using a bigger list and filtering again after that. This impacts only people using both the sorting and the name filtering (with ``->names()`` or ``notNames()``) Commits ------- e5bf0ab Exclude files based on path before applying the sorting
2 parents 47b17eb + e5bf0ab commit 306d88a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Symfony/Component/Finder/Adapter/PhpAdapter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ public function searchInDirectory($dir)
6868
$iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
6969
}
7070

71+
if ($this->paths || $this->notPaths) {
72+
$iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
73+
}
74+
7175
if ($this->sort) {
7276
$iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
7377
$iterator = $iteratorAggregate->getIterator();
7478
}
7579

76-
if ($this->paths || $this->notPaths) {
77-
$iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
78-
}
79-
8080
return $iterator;
8181
}
8282

0 commit comments

Comments
 (0)
0