File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -329,11 +329,17 @@ it is called with the file as a :class:`Symfony\\Component\\Finder\\SplFileInfo`
329329instance. The file is excluded from the result set if the Closure returns
330330``false ``.
331331
332+ The ``filter() `` method includes a second optional argument to prune directories.
333+ If set to ``true ``, this method completely skips the excluded directories instead
334+ of traversing the entire file/directory structure and excluding them later. When
335+ using a closure, return ``false `` for the directories which you want to prune.
336+
337+ Pruning directories early can improve performance significantly depending on the
338+ file/directory hierarchy complexity and the number of excluded directories.
339+
332340.. versionadded :: 6.4
333341
334- Since Symfony 6.4, a filter can prune directories early, pass ``true `` as the second
335- parameter for the ``filter() `` method and when the Closure returns ``false `` the deeper
336- levels will not be traversed.
342+ The feature to prune directories was introduced in Symfony 6.4.
337343
338344Sorting Results
339345---------------
You can’t perform that action at this time.
0 commit comments