Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9649800

Browse files
Expanded the explanation a bit
1 parent 0d38d1b commit 9649800

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

components/finder.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,13 @@ Sort the result by name or by type (directories first, then files)::
170170

171171
.. tip::
172172

173-
To sort by name using `natural sort order`_ algorithm,
174-
pass ``true`` as the first argument of ``sortByName()`` method.
173+
By default, the ``sortByName()`` method uses the :phpfunction:`strcmp` PHP
174+
function (e.g. ``file1.txt``, ``file10.txt``, ``file2.txt``). Pass ``true``
175+
as its argument to use PHP's `natural sort order`_ algorithm instead (e.g.
176+
``file1.txt``, ``file2.txt``, ``file10.txt``).
177+
178+
.. versionadded:: 4.2
179+
The option to use the natural sort order was introduced in Symfony 4.2.
175180

176181
You can also define your own sorting algorithm with ``sort()`` method::
177182

0 commit comments

Comments
 (0)