Deprecation: #95222 - Extbase ViewInterface

See forge#95222

Description

To further streamline Fluid view-related class inheritance and dependencies, the interface \TYPO3\CMS\Extbase\Mvc\View\ViewInterface has been marked as deprecated and will be removed in TYPO3 v12.

Impact

This deprecation has minimal impact on TYPO3 v11:

  • The interface remains available in the Core without triggering a E_USER_DEPRECATED warning.
  • ViewInterface primarily differs from other view-related classes by requiring an implementation of initializeView(), a method that was never actively used within TYPO3's Core. This method should not be confused with initializeView() in Extbase controllers, which is frequently implemented by developers and serves a different purpose. The removal of initializeView() only affects view-related logic and does not impact controller initialization.
  • Another deviation is the method setControllerContext(), which is also deprecated because ControllerContext itself is marked as deprecated.

Affected Installations

The extension scanner will detect usages of Extbase ViewInterface as a strong match.

Migration

Adjusting initializeView() method signature in controllers

Some extensions may rely on ViewInterface type hints, particularly in the initializeView() method of Extbase action controllers. The default implementation of initializeView() in ActionController is empty.

In TYPO3 v12:

  • This empty method will be removed from ActionController.
  • However, if an initializeView() method exists in a subclass of ActionController, it will still be called.
  • Extension authors should not call parent::initializeView($view), as this parent method will no longer exist.
  • The method signature should be updated to prevent PHP contravariance violations:

Old:

protected function initializeView(ViewInterface $view)
Copied!

New:

protected function initializeView($view)
Copied!

Replacing ViewInterface

Instead of using \TYPO3\CMS\Extbase\Mvc\View\ViewInterface, extension authors should switch to:

  • \TYPO3\CMS\Fluid\View\StandaloneView — typically in non-Extbase-related classes.
  • \TYPO3Fluid\Fluid\View\ViewInterface — for a more generic replacement.

Handling Custom Views

If an extension defines a custom view implementing ViewInterface, note that auto-configuration based on this interface will be removed in TYPO3 v12. As a result, manual service configuration in Services.yaml may be necessary.