Breaking: #102632 - Use strict types in Extbase

See forge#102632, forge#102878, forge#102879, forge#102885, forge#102954, forge#102956, forge#102966, forge#102969

Description

All properties, except the $view property, in \TYPO3\CMS\Extbase\Mvc\Controller\ActionController are now strictly typed. In addition, all function arguments and function return types are now strictly typed.

Also, the properties in the \TYPO3\CMS\Extbase\Annotation\Annotation namespace now have native PHP types for their properties.

In summary, the following classes have received strict types:

  • \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Annotation\IgnoreValidation
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Annotation\ORM\Cascade
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Annotation\Required\Validate
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Domain\Model\AbstractFileFolder
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Domain\Model\Category
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Domain\Model\FileReference
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Domain\Model\File
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Persistence\ObjectStorage
  • \TYPO3\CMS\Extbase\TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface

Impact

Classes extending the changed classes must now ensure that overwritten properties and methods are all are strictly typed.

Affected installations

Custom classes extending the changed classes.

Migration

Ensure classes that extend the changed classes use strict types for overwritten properties, function arguments and return types.

Extensions supporting multiple TYPO3 versions (for example, v12 and v13) must not overwrite properties of the changed classes. Instead, it is recommended to set values of overwritten properties in the constructor of the extending class.

Before

<?php

namespace MyVendor\MyExtension\Controller;

use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class MyController extends ActionController
{
    public string $errorMethodName = 'myAction';
}
Copied!

After

<?php

namespace MyVendor\MyExtension\Controller;

use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class MyController extends ActionController
{
    public function __construct()
    {
        $this->errorMethodName = 'myAction';
    }
}
Copied!