sabbelasichon / typo3-rector

Rector for TYPO3
MIT License
226 stars 63 forks source link

Deprecation: #101163 - Abstract class Enumeration #3964

Open simonschaufi opened 9 months ago

simonschaufi commented 9 months ago

Deprecation: #101163 - Abstract class Enumeration

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.0/Deprecation-101163-Enumeration.html


title: "Deprecation: #101163 - Abstract class Enumeration"

See 101163

Description

The abstract class \TYPO3\CMS\Core\Type\Enumeration is deprecated in favor of PHP built-in backed [enums]().

Impact

All classes extending \TYPO3\CMS\Core\Type\Enumeration will trigger a deprecation level log entry.

Affected installations

Classes extending \TYPO3\CMS\Core\Type\Enumeration need to be converted into PHP built-in backed enums.

Migration

Class definition:

class State extends \TYPO3\CMS\Core\Type\Enumeration
{
    public const STATE_DEFAULT = 'somestate';
    public const STATE_DISABLED = 'disabled';
}

should be converted into:

enum State: string
{
    case STATE_DEFAULT = 'somestate';
    case STATE_DISABLED = 'disabled';
}

Existing method calls must be adapted.

See also feature-101396-1689843367.

Backend, FullyScanned, ext:core
sabbelasichon commented 7 months ago

https://github.com/TYPO3-CMS/core/blob/main/Classes/Type/Enumeration.php