Deprecation: #107225 - Boolean sort direction in FileList->start()
See forge#107225
Description
The fourth parameter of the method
\TYPO3\ has been renamed from
$sort to
$sort and now accepts both boolean values
(for backward compatibility) and
Sort enum values.
Passing a boolean value for the sort direction (fourth parameter of
File) has been deprecated in favor of the new
\TYPO3\ enum, providing better type
safety and clarity. The parameter name has also changed from
$sort to
$sort to more accurately describe its
purpose.
Impact
Calling
File with a boolean value as the fourth parameter
triggers a deprecation warning. The functionality will continue to work for
now but will be removed in TYPO3 v15.0.
Affected installations
All installations using
File directly with a boolean value
for the sort direction parameter are affected. This mainly applies to custom
file browser implementations or extensions that instantiate and configure the
File class directly, even though it is
marked as @internal.
Migration
Replace boolean values with the corresponding
Sort enum values:
use TYPO3\CMS\Filelist\Type\SortDirection;
// Before (deprecated)
$fileList->start($folder, $currentPage, $sortField, false, $mode);
$fileList->start($folder, $currentPage, $sortField, true, $mode);
// After
$fileList->start(
$folder,
$currentPage,
$sortField,
SortDirection::ASCENDING,
$mode
);
$fileList->start(
$folder,
$currentPage,
$sortField,
SortDirection::DESCENDING,
$mode
);
The migration maintains the same functionality:
true(descending) →SortDirection:: DESCENDING false(ascending) →SortDirection:: ASCENDING