Breaking: #101131 - Convert LoginType to native backed enum¶
See forge#101131
Description¶
The class \TYPO3\CMS\Core\Authentication\LoginType
is now
converted to a native backed enum.
Impact¶
Since \TYPO3\CMS\Core\Authentication\LoginType
is no longer
a class, the existing class constants are no longer available.
Affected installations¶
Custom authenticators using the following class constants:
\TYPO3\CMS\Core\Authentication\LoginType::LOGIN
\TYPO3\CMS\Core\Authentication\LoginType::LOGOUT
Migration¶
Use the new syntax:
\TYPO3\CMS\Core\Authentication\LoginType::LOGIN->value
\TYPO3\CMS\Core\Authentication\LoginType::LOGOUT->value
Alternatively, use the enum method tryFrom
to convert a
value to an enum. For direct comparison of two enums, the null coalescing
operator shall be used to ensure that the parameter is a string:
<?php
use TYPO3\CMS\Core\Authentication\LoginType;
if (LoginType::tryFrom($value ?? '') === LoginType::LOGIN) {
// Do login stuff
}
if (LoginType::tryFrom($value ?? '') === LoginType::LOGOUT) {
// Do logout stuff
}