Breaking: #101309 - Introduce type declarations in DriverInterface

See forge#101309

Description

Return and param type declarations have been introduced for all methods stubs of \TYPO3\CMS\Core\Resource\Driver\DriverInterface.

Also, method \TYPO3\CMS\Core\Resource\Driver\AbstractDriver::sanitizeFileName() has been removed.

Impact

In consequence, all implementations of \TYPO3\CMS\Core\Resource\Driver\DriverInterface need to reflect those changes and add the same return and param type declarations.

In case, any of the Core implementations are extended, overridden methods might need to be adjusted. The Core classes, implementing \TYPO3\CMS\Core\Resource\DriverInterface, are:

  • \TYPO3\CMS\Core\Resource\Driver\AbstractDriver
  • \TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver
  • \TYPO3\CMS\Core\Resource\Driver\LocalDriver

Concerning removed method \TYPO3\CMS\Core\Resource\Driver\AbstractDriver::sanitizeFileName():

Said method didn't sanitize at all, it didn't respect the given $charset param and simply returned the input string. Abstract classes MAY fulfill the interface contract but if they do so, they MUST do it right. There is no benefit in fulfilling it just signature wise, it MUST fulfill it functional wise and in this case it didn't. That's why LocalDriver reimplements sanitizeFileName() completely.

As a consequence of this removal, all classes that extend either \TYPO3\CMS\Core\Resource\Driver\AbstractDriver or \TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver, need to implement method sanitizeFileName().

Affected installations

All installations that implement \TYPO3\CMS\Core\Resource\DriverInterface or that extend either \TYPO3\CMS\Core\Resource\Driver\AbstractDriver or \TYPO3\CMS\Core\Resource\Driver\AbstractHierarchicalFilesystemDriver.

Migration

As for the type declarations: Add the same param and return type declarations the interface does.

As for the removed method \TYPO3\CMS\Core\Resource\Driver\AbstractDriver::sanitizeFileName():

Implement the method according to your driver capabilities.