Skip to content

Commit c1c6596

Browse files
committed
Tweaks
1 parent f87c9e6 commit c1c6596

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

components/finder.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,17 @@ it is called with the file as a :class:`Symfony\\Component\\Finder\\SplFileInfo`
329329
instance. 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

338344
Sorting Results
339345
---------------

0 commit comments

Comments
 (0)