Breaking: #101133 - Icon->state changed type
See forge#101133
Description
The protected property \TYPO3\
holds now a native
enum \TYPO3\
instead of an instance of
\TYPO3\
.
Impact
Custom extensions calling \TYPO3\
will
receive an enum now, which will most probably lead to PHP errors in the runtime.
Custom extensions calling \TYPO3\
with an
instance of \TYPO3\
will receive a PHP
TypeError.
Affected installations
Custom extensions calling \TYPO3\
or
\TYPO3\
.
Migration
Adapt your code to handle the native enum \TYPO3\
.
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Type\Icon\IconState;
use TYPO3\CMS\Core\Utility\GeneralUtility;
// Before
$icon = GeneralUtility::makeInstance(Icon::class);
$icon->setState(IconState::cast(IconState::STATE_DEFAULT));
$state = $icon->getState();
$stateValue = (string)$state;
// After
$icon = GeneralUtility::makeInstance(Icon::class);
$icon->setState(IconState::STATE_DEFAULT);
$state = $icon->getState();
$stateValue = $state->value;