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`
329
329
instance. The file is excluded from the result set if the Closure returns
330
330
``false ``.
331
331
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
+
332
340
.. versionadded :: 6.4
333
341
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.
337
343
338
344
Sorting Results
339
345
---------------
You can’t perform that action at this time.
0 commit comments