Breaking: #97210 - Types added to method signatures or class properties

See forge#97210

Description

The following PHP classes have had parameter and return types added to some or all of their method signatures. The types are consistent with existing docblock-documented type expectations and existing behavior.

  • \TYPO3\CMS\Adminpanel\ModuleApi\ModuleDataStorageCollection
  • \TYPO3\CMS\Backend\Tree\SortedTreeNodeCollection
  • \TYPO3\CMS\Backend\Tree\TreeNodeCollection
  • \TYPO3\CMS\Core\Collection\AbstractRecordCollection
  • \TYPO3\CMS\Core\LinkHandling\FileLinkHandler
  • \TYPO3\CMS\Core\Log\LogRecord
  • \TYPO3\CMS\Core\Messaging\FlashMessageQueue
  • \TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider
  • \TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection
  • \TYPO3\CMS\Core\Resource\MetaDataAspect
  • \TYPO3\CMS\Core\Resource\Search\Result\EmptyFileSearchResult
  • \TYPO3\CMS\Core\Routing\SiteRouteResult
  • \TYPO3\CMS\Core\Utility\ArrayUtility
  • \TYPO3\CMS\Core\Utility\ClassNamingUtility
  • \TYPO3\CMS\Core\Utility\CsvUtility
  • \TYPO3\CMS\Core\Utility\CommandUtility
  • \TYPO3\CMS\Core\Utility\DebugUtility
  • \TYPO3\CMS\Core\Utility\DiffUtility
  • \TYPO3\CMS\Core\Utility\ExtensionManagementUtility
  • \TYPO3\CMS\Core\Utility\GeneralUtility
  • \TYPO3\CMS\Core\Utility\MailUtility
  • \TYPO3\CMS\Core\Utility\MathUtility
  • \TYPO3\CMS\Core\Utility\PathUtility
  • \TYPO3\CMS\Core\Utility\RootlineUtility
  • \TYPO3\CMS\Core\Utility\StringUtility
  • \TYPO3\CMS\Core\Utility\VersionNumberUtility
  • \TYPO3\CMS\Extbase\Mvc\Controller\Arguments
  • \TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage
  • \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy
  • \TYPO3\CMS\Extbase\Persistence\ObjectStorage
  • \TYPO3\CMS\Extbase\Persistence\QueryResult

The following PHP classes have added public class property types:

  • \TYPO3\CMS\Core\Utility\DiffUtility

Impact

Calling any of these methods with incompatible types now throws a \TypeError, especially if the calling code is within declare(strict_types=1); context. Before the result of such method calls was undefined or inconsistent.

Affected Installations

Code routines that are passing an invalid type will need to ensure they pass a correct type.

If a code file is running with declare(strict_types=1);, that includes, for instance, passing a numeric string to a method that expects an int or float. Those will need to be properly cast before being passed.

The extension scanner will not find affected extensions.

Migration

Any code that is already passing the expected type to these methods will be unaffected. Code that is passing an incorrect type will need to pass the correct type, possibly including an explicit cast.