Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions components/finder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,17 @@ instance. The file is excluded from the result set if the Closure returns
Sorting Results
---------------

Sort the results by name or by type (directories first, then files)::
Sort the results by name, extension, size or type (directories first, then files)::

$finder->sortByName();

$finder->sortByExtension();
$finder->sortBySize();
$finder->sortByType();

.. versionadded:: 6.2

The ``sortByExtension()`` and ``sortBySize()`` methods were introduced in Symfony 6.2.

.. tip::

By default, the ``sortByName()`` method uses the :phpfunction:`strcmp` PHP
Expand Down