From df9281fbd2f6b664a2bd2d8d846d824875776cd9 Mon Sep 17 00:00:00 2001 From: hmoreau Date: Tue, 9 Aug 2022 10:49:26 +0200 Subject: [PATCH] [Finder] Add case insensitive sort --- components/finder.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/finder.rst b/components/finder.rst index 55f010d61b6..9bfbdfa1afe 100644 --- a/components/finder.rst +++ b/components/finder.rst @@ -339,13 +339,14 @@ Sorting Results Sort the results by name, extension, size or type (directories first, then files):: $finder->sortByName(); + $finder->sortByCaseInsensitiveName(); $finder->sortByExtension(); $finder->sortBySize(); $finder->sortByType(); .. versionadded:: 6.2 - The ``sortByExtension()`` and ``sortBySize()`` methods were introduced in Symfony 6.2. + The ``sortByCaseInsensitiveName()``, ``sortByExtension()`` and ``sortBySize()`` methods were introduced in Symfony 6.2. .. tip:: @@ -353,6 +354,9 @@ Sort the results by name, extension, size or type (directories first, then files function (e.g. ``file1.txt``, ``file10.txt``, ``file2.txt``). Pass ``true`` as its argument to use PHP's `natural sort order`_ algorithm instead (e.g. ``file1.txt``, ``file2.txt``, ``file10.txt``). + + The ``sortByCaseInsensitiveName()`` method uses the case insensitive :phpfunction:`strcasecmp` PHP function. + Pass ``true`` as its argument to use PHP's case insensitive `natural sort order`_ algorithm instead (the :phpfunction:`strnatcasecmp` PHP function) Sort the files and directories by the last accessed, changed or modified time::