Review main Merged Breaking

79470[!!!][FEATURE] Deprecate and replace IconState class with enum

Thomas Hohn CR +2 V +2 Hard +329 −23 updated 07/25/23, 18:09

Commit message

Deprecate IconState class and add a new native backed enum
TYPO3\CMS\Core\Imaging\IconState as a replacement.

In addition, change the 4th parameter of
TYPO3\CMS\Core\Imaging\IconFactory->getIcon to allow both the old
IconState class and the new native enum.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Nikita Hovratov +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Nikita Hovratov +1
    • core-ci +1 CI

Issues 1

Files 15

Review log 3752

Show 1627 earlier messages
  1. Thomas Hohn uploaded patch set 1 06/21/23, 05:02

  2. Thomas Hohn uploaded patch set 2 06/21/23, 05:13

  3. core-ci voted on patch set 1 V -1 06/21/23, 05:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42859

  4. core-ci voted on patch set 2 V -1 06/21/23, 05:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42861

  5. Thomas Hohn uploaded patch set 3 V -1 06/21/23, 06:26

  6. core-ci voted on patch set 3 V -1 06/21/23, 06:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42862

  7. Thomas Hohn uploaded patch set 4 V -1 06/21/23, 06:41

  8. core-ci voted on patch set 4 V +1 06/21/23, 06:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42863

  9. Mathias Brodala commented on patch set 4 06/21/23, 07:16

    Breaking-101133-ConverIconStateToNativeEnum.rst:21

    It's true that these are not class constants anymore but one can (and must) still reference them. Actually the impact is that the IconState cannot be used like a class anymore, so e.g. no "new IconState(IconState::*)"

    Breaking-101133-ConverIconStateToNativeEnum.rst:31

    Here we should add the implied "IconState::" prefix to have this found in searches.
  10. Thomas Hohn uploaded patch set 5 V +1 06/21/23, 07:29

  11. Thomas Hohn commented on patch set 4 06/21/23, 07:30

    Breaking-101133-ConverIconStateToNativeEnum.rst:21 Reply

    Will adapt

    Breaking-101133-ConverIconStateToNativeEnum.rst:31 Reply

    Hi - will adapt
  12. Thomas Hohn uploaded patch set 6 06/21/23, 07:34

  13. Mathias Brodala commented on patch set 6 06/21/23, 07:35

    Breaking-101133-ConverIconStateToNativeEnum.rst:21 Reply

    Done

    Breaking-101133-ConverIconStateToNativeEnum.rst:31 Reply

    Done
  14. core-ci voted on patch set 5 V +1 06/21/23, 07:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42864

  15. core-ci voted on patch set 6 V +1 06/21/23, 07:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42865

  16. Nikita Hovratov commented on patch set 6 CR -1 06/23/23, 12:41

    IconFactory.php:85

    Not sure about just breaking a (often useed) public method without a grace period. I would rather keep the old Enumeration class and introduce the enum (in a new namespace) in parallel. This would only require to change the typehint to `IconState|Enum\IconState $state` and then check in the code, which one was provided. We did a similar thing for AbstractMessage in v12: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74925
  17. Thomas Hohn uploaded patch set 7 CR -1 V +1 06/24/23, 09:35

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

  19. Thomas Hohn uploaded patch set 8 V -1 06/24/23, 20:05

  20. core-ci voted on patch set 8 V +1 06/24/23, 20:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42947

  21. Thomas Hohn uploaded patch set 9 V +1 06/25/23, 17:41

  22. Thomas Hohn commented on patch set 8 06/25/23, 17:42

    IconFactory.php:85 Reply

    Done
  23. core-ci voted on patch set 9 V +1 06/25/23, 17:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42953

  24. Nikita Hovratov uploaded patch set 10 V +1 06/27/23, 13:30

  25. core-ci voted on patch set 10 V -1 06/27/23, 13:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43032

  26. Nikita Hovratov uploaded patch set 11 V -1 06/27/23, 14:17

  27. core-ci voted on patch set 11 V +1 06/27/23, 14:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43038

  1. Nikita Hovratov uploaded patch set 12 V +1 06/27/23, 14:28

  2. core-ci voted on patch set 12 V +1 06/27/23, 14:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43039

  3. Nikita Hovratov commented on patch set 12 06/27/23, 14:42

    Hey Thomas, I hope it is ok that I hijacked your patch. Important changes are the addition of `trigger_error` in IconFactory->getIcon(), so the deprecation gets logged, the UnitDeprecated test, to ensure the deprecated way of calling the method still works and the change to FEATURE, as this is not only an internal change, but new public API. I won't vote for this now, as I changed too much code myself.
  4. Thomas Hohn commented on patch set 12 06/27/23, 20:19

    Reply

    Hi NP
  5. Benni Mack rebased onto patch set 13 V +1 07/06/23, 10:31

  6. core-ci voted on patch set 13 V +1 07/06/23, 10:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43691

  7. Oliver Klee voted on patch set 13 V +1 07/06/23, 11:25

  8. Benni Mack commented on patch set 13 CR -1 07/06/23, 14:31

    Can you please move the new Enum from Classes/Type/Enum/IconState.php to Classes/Type/IconState.php ? I think "Type" makes it clear where this belongs. Otherwise we can also move it to Classes/Imaging. Will have to think about it for a bit...
  9. Thomas Hohn commented on patch set 13 07/06/23, 15:27

    Reply

    The later might give more sense - give me a ping once you've decided 😊
  10. Oliver Klee commented on patch set 13 07/15/23, 13:15

    Any news on this?
  11. Thomas Hohn commented on patch set 13 07/15/23, 15:03

    Reply

    Not to my knowledge ;-)
  12. Alexander Schnitzler commented on patch set 13 07/21/23, 13:00

    Reply

    I second that. I wouldn't put more enums in the Type namespace just because our pre php8.1 enum polyfill lay there. TYPO3\CMS\Core\Imaging is a good namespace for the new enum.
  13. Benni Mack commented on patch set 13 07/21/23, 13:32

    Reply

    sounds good.
  14. Thomas Hohn uploaded patch set 14 CR -1 V +1 07/24/23, 09:54

  15. core-ci voted on patch set 14 V +1 07/24/23, 10:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44466

  16. Thomas Hohn commented on patch set 14 07/24/23, 10:12

    Reply

    Fixed as proposed.

    Reply

    Done
  17. Alexander Schnitzler commented on patch set 14 07/24/23, 17:19

    IconController.php:72

    Just one thing to consider here. The previous enum implementation threw an exception if for invalid values. So just using try here would be closer to the former implementation. But I don't see a benefit in throwing an exception if we can gracefully fail with null here. Therefore no -1 from my side.
  18. Thomas Hohn commented on patch set 14 07/24/23, 17:41

    IconController.php:72 Reply

    Ack
  19. Oliver Klee voted on patch set 14 V +1 07/24/23, 17:50

  20. Nikita Hovratov rebased onto patch set 15 V +1 07/25/23, 16:22

  21. Nikita Hovratov voted on patch set 15 V +1 CR +1 07/25/23, 16:23

  22. core-ci voted on patch set 15 V +1 07/25/23, 16:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44547

  23. Oliver Klee voted on patch set 15 V +1 07/25/23, 16:48

  24. Benni Mack voted on patch set 15 V +2 CR +2 07/25/23, 18:09

  25. Benni Mack merged patch set 16 07/25/23, 18:09