Breaking: #101175 - Convert VersionState to native backed enum¶
See forge#101175
Description¶
The class \TYPO3\CMS\Core\Versioning\VersionState
is now
converted to a native PHP backed enum.
Impact¶
Since \TYPO3\CMS\Core\Versioning\VersionState
is no longer
a class, the existing class constants are no longer available, but are
enum instances instead.
In addition it's not possible to instantiate it anymore or call
the equals
method.
Affected installations¶
TYPO3 code using the following code:
Using the following class constants:
\TYPO3\CMS\Core\Versioning\VersionState::DEFAULT_STATE
\TYPO3\CMS\Core\Versioning\VersionState::NEW_PLACEHOLDER
\TYPO3\CMS\Core\Versioning\VersionState::DELETE_PLACEHOLDER
\TYPO3\CMS\Core\Versioning\VersionState::MOVE_POINTER
Class instantiation:
new \TYPO3\CMS\Core\Versioning\(VersionState::*->value)
where * denotes one of the enum values.
Method invocation:
\TYPO3\CMS\Core\Versioning\VersionState::cast()
\TYPO3\CMS\Core\Versioning\VersionState::cast()->equals()
Migration¶
Use the new syntax for getting the values:
\TYPO3\CMS\Core\Versioning\VersionState::DEFAULT_STATE->value
\TYPO3\CMS\Core\Versioning\VersionState::NEW_PLACEHOLDER->value
\TYPO3\CMS\Core\Versioning\VersionState::DELETE_PLACEHOLDER->value
\TYPO3\CMS\Core\Versioning\VersionState::MOVE_POINTER->value
Class instantiation should be replaced by:
\TYPO3\CMS\Core\Versioning\VersionState::tryFrom($row['t3ver_state'])
Method invocation of cast()
/equals()
should be replaced by:
\TYPO3\CMS\Core\Versioning\VersionState::tryFrom(...)
\TYPO3\CMS\Core\Versioning\VersionState::tryFrom(...) === VersionState::MOVE_POINTER