Review main Merged Breaking

79516[!!!][TASK] Convert VersionState to backed enum

Thomas Hohn CR +2 V +2 Hard +355 −145 updated 07/05/23, 14:55

Commit message

This change converts class VersionState to a native backed enum.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Hader +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Hader +1

Issues 1

Files 39

Show 19 more files

Review log 3345

Show 1520 earlier messages
  1. Thomas Hohn uploaded patch set 1 06/27/23, 09:10

  2. core-ci voted on patch set 1 V -1 06/27/23, 09:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43014

  3. Thomas Hohn uploaded patch set 2 V -1 06/27/23, 09:27

  4. Mathias Brodala commented on patch set 2 06/27/23, 09:31

    EditDocumentController.php:2217

    Why like this here? It should work fine regularly like the LocalizationController shows.

    PageTreeRepository.php:280

    See above.

    BackendUtility.php:1139

    Looks like this could be skipped since it merely converts "null" to "0", not making a difference in this switch.
  5. core-ci voted on patch set 2 V +1 06/27/23, 09:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43016

  6. Thomas Hohn commented on patch set 2 06/27/23, 09:43

    BackendUtility.php:1139 Reply

    The signature for tryFrom is either int or int|string so I wanted to ensure that there is no type errors
  7. Mathias Brodala commented on patch set 2 06/27/23, 09:46

    BackendUtility.php:1139 Reply

    Sure, but then you'd use this: VersionState::tryFrom($row['t3ver_state'] ?? 0) -> use column value or "0" if missing/null
  8. Thomas Hohn commented on patch set 2 06/27/23, 09:48

    BackendUtility.php:1139 Reply

    I was blind - sorry 😊
  9. Benni Mack commented on patch set 2 06/27/23, 11:06

    GridDataService.php:184

    I would also go with comparing 2 enums instead of the int compare
  10. Thomas Hohn uploaded patch set 3 V +1 06/28/23, 05:04

  11. Thomas Hohn commented on patch set 2 06/28/23, 05:05

    EditDocumentController.php:2217 Reply

    Done

    PageTreeRepository.php:280 Reply

    Done

    BackendUtility.php:1139 Reply

    Done

    GridDataService.php:184 Reply

    Done
  12. core-ci voted on patch set 3 V +1 06/28/23, 05:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43055

  13. Oliver Hader commented on patch set 3 06/28/23, 06:10

    RecordProvider.php:590

    `?? 0`

    DatabaseEditRow.php:52

    `?? 0`

    DatabaseRecordList.php:2075

    `?? 0`

    LanguageColumn.php:143

    `!== VersionState::DELETE_PLACEHOLDER`

    DataHandler.php:8077

    What about changing to `VersionState::tryFrom($row['t3ver_state'] ?? 0) !== VersionState::MOVE_POINTER`?

    VersionState.php:21

    For backward compatibility it even would be possible to keep the methods `equals` and `cast` and throw corresponding deprecation messages - not a requirement, just something to think about.

    RemoteServer.php:130

    `===`
  14. Thomas Hohn commented on patch set 3 06/28/23, 06:59

    LanguageColumn.php:143 Reply

    Nice catch 😊

    DataHandler.php:8077 Reply

    Must have slipped through :-)
  15. Thomas Hohn commented on patch set 3 06/28/23, 07:00

    RecordProvider.php:590 Reply

    There is a check in L587 that could be removed in favour of the ?? 0
  16. Thomas Hohn uploaded patch set 4 V +1 06/28/23, 07:24

  17. Thomas Hohn commented on patch set 4 06/28/23, 07:25

    RecordProvider.php:590 Reply

    Done

    DatabaseEditRow.php:52 Reply

    Done

    DatabaseRecordList.php:2075 Reply

    Done

    LanguageColumn.php:143 Reply

    Done

    DataHandler.php:8077 Reply

    Done

    RemoteServer.php:130 Reply

    Done
  18. core-ci voted on patch set 4 V +1 06/28/23, 07:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43062

  19. Thomas Hohn uploaded patch set 5 V +1 06/28/23, 08:46

  20. core-ci voted on patch set 5 V -1 06/28/23, 08:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43065

  1. Thomas Hohn uploaded patch set 6 V -1 06/28/23, 08:57

  2. core-ci voted on patch set 6 V +1 06/28/23, 09:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43066

  3. Thomas Hohn commented on patch set 6 06/28/23, 09:25

    VersionState.php:21 Reply

    Done
  4. Benni Mack commented on patch set 6 07/04/23, 10:25

    minor feedback, but really good improvement! This will also speed up TYPO3 massively due to the fact that Enums are singletons

    DataHandler.php:3843

    let's use Enum comparison here as well

    PageRepository.php:1623

    let's use enum check as well here

    PageRepository.php:1638

    ?? VersionState::DEFAULT_STATE is not needed here. We use tryFrom()

    PageRepository.php:1670

    we can remove the type annotation here

    MethodCallMatcher.php:5801

    method is called "equals" not "equal"

    DataHandlerHook.php:223

    we don't need the fallback to the DefaultState here

    GridDataService.php:591

    let's use tryFrom($stateId) and we compare the enums in the switch case directly
  5. Thomas Hohn uploaded patch set 7 V +1 07/04/23, 11:06

  6. Thomas Hohn commented on patch set 7 07/04/23, 11:07

    DataHandler.php:3843 Reply

    Done

    PageRepository.php:1623 Reply

    Done

    PageRepository.php:1638 Reply

    Done

    PageRepository.php:1670 Reply

    Done

    MethodCallMatcher.php:5801 Reply

    Done

    DataHandlerHook.php:223 Reply

    Done

    GridDataService.php:591 Reply

    Done
  7. core-ci voted on patch set 7 V +1 07/04/23, 11:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43371

  8. Benni Mack uploaded patch set 8 V +1 07/04/23, 21:03

  9. Benni Mack voted on patch set 8 V +1 CR +1 07/04/23, 21:03

  10. core-ci voted on patch set 8 V +1 07/04/23, 21:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43442

  11. Benni Mack commented on patch set 8 CR -1 07/05/23, 07:20

    needs further work on the actual new Enum
  12. Benni Mack uploaded patch set 9 CR -1 V +1 07/05/23, 07:26

  13. core-ci voted on patch set 9 V -1 07/05/23, 07:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43462

  14. Benni Mack commented on patch set 10 V -1 07/05/23, 09:06

    Published edit on patch set 9.
  15. core-ci voted on patch set 10 V -1 07/05/23, 09:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43477

  16. Benni Mack uploaded patch set 11 V -1 07/05/23, 10:47

  17. core-ci voted on patch set 11 V +1 07/05/23, 10:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43487

  18. Oliver Hader commented on patch set 11 07/05/23, 13:45

    on it...
  19. Benni Mack voted on patch set 11 V +1 CR +1 07/05/23, 13:46

  20. Oliver Hader uploaded patch set 12 CR +1 V +1 07/05/23, 14:34

  21. Oliver Hader uploaded patch set 13 07/05/23, 14:37

  22. Oliver Hader voted on patch set 13 V +1 CR +1 07/05/23, 14:38

  23. Benni Mack voted on patch set 13 V +2 CR +2 07/05/23, 14:49

  24. Benni Mack merged patch set 14 07/05/23, 14:49

  25. core-ci voted on patch set 12 V +1 07/05/23, 14:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43534