Deprecation: #95222 - Extbase ViewInterface
See forge#95222
Description
To further streamline Fluid view related class inheritance and dependencies,
the interface \TYPO3\
has been marked
as deprecated and will be removed in TYPO3 v12.
Impact
This deprecation has little impact on TYPO3 v11: The interface is kept and still
carried around in the Core, no PHP E_
error is triggered.
The interface itself deviates from the casual view related classes only by requiring
an implementation of method initialize
which was never actively used,
calling that method will vanish in TYPO3 v12. The second deviation is method
set
, and class Controller
has been marked as deprecated, too.
Affected Installations
The extension scanner will find usages of Extbase View
as a strong match.
Migration
Some instances may rely on extensions that type hint View
,
especially in the Extbase action controller method initialize
. The default
implementation of that method in \TYPO3\
is
empty. To simplify compatibility for extensions supporting both TYPO3 v11 and TYPO3 v12,
that empty method will be removed in TYPO3 v12, but will still be called if it exists in classes
extending Action
.
Extension authors should thus avoid calling parent::
in their
implementation of initialize
to prepare towards TYPO3 v12. Additionally, extension
authors should adapt the method signature to avoid a PHP contravariance violation:
// Old:
protected function initializeView(ViewInterface $view)
// New:
protected function initializeView($view)
Apart from that, usages of TYPO3\
should be changed
to the more specific \TYPO3\
- usually in non-Extbase
related classes, or to the less specific \TYPO3Fluid\
.
If using a custom view implementing View
,
keep in mind that auto configuration based on the interface will be dropped in TYPO3 v12, you
may have to configure the service in Services.
manually.