Review main Merged Breaking

74925[!!!][FEATURE] Provide dedicated enum for contextual feedback

Andreas Kienast CR +2 V +2 Expert +1166 −784 updated 07/14/22, 16:53

Commit message

To clean up cluttered severity definitions for flash messages and
reports, a new `ContextualFeedback` enum is introduced.

The enum is backed, means it holds actual values, which match the
previously known integer values for severities. An internal
`transform()` method may be used to maintain backward compatibility
where needed and to trigger deprecation notices.

Review

  • Code review CR +2 Done
    • Andreas Kienast +2
    • Oliver Klee +1
    • Markus Klein +1
    • Frank Nägler +1
  • Verified V +2 Done
    • Andreas Kienast +2
    • Frank Nägler +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 133

Show 113 more files

Review log 98124

Show 7899 earlier messages
  1. Andreas Kienast uploaded patch set 1 06/17/22, 11:35

  2. core-ci voted on patch set 1 V -1 06/17/22, 11:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28136

  3. Andreas Kienast uploaded patch set 2 06/17/22, 12:16

  4. Benni Mack commented on patch set 2 06/17/22, 12:22

    we can move the new Enum to EXT:core/Classes/Type
  5. core-ci voted on patch set 2 V -1 06/17/22, 12:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28140

  6. Andreas Kienast uploaded patch set 3 06/17/22, 12:29

  7. core-ci voted on patch set 3 V -1 06/17/22, 12:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28141

  8. Andreas Kienast uploaded patch set 4 06/17/22, 13:15

  9. Andreas Kienast uploaded patch set 5 06/17/22, 13:17

  10. core-ci voted on patch set 4 V -1 06/17/22, 13:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28147

  11. core-ci voted on patch set 5 V -1 06/17/22, 13:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28148

  12. Andreas Kienast uploaded patch set 6 06/17/22, 13:39

  13. Andreas Kienast uploaded patch set 7 06/17/22, 13:45

  14. core-ci voted on patch set 6 V -1 06/17/22, 13:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28153

  15. core-ci voted on patch set 7 V +1 06/17/22, 13:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28154

  16. Andreas Kienast uploaded patch set 8 06/17/22, 20:01

  17. core-ci voted on patch set 8 V +1 06/17/22, 20:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28164

  18. Oliver Klee commented on patch set 8 06/17/22, 21:21

    Severity.php:28

    Let's help PHPStan a bit here by adding a more specific return type annotation. /** * @return non-empty string */

    Severity.php:39

    /** * @return non-empty string */
  19. Andreas Kienast uploaded patch set 9 06/18/22, 11:19

  20. core-ci voted on patch set 9 V +1 06/18/22, 11:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28174

  21. Oliver Klee commented on patch set 9 06/18/22, 11:30

    Severity.php:28 Reply

    Done

    Severity.php:39 Reply

    Done
  22. Stefan Bürk commented on patch set 9 06/18/22, 17:41

    ModuleTemplate.php:241

    Also the "transform" method throwing the deprecation notices, I think we should directly mark the "int" support for the method argument here directly as deprecated, adding a ``` * @deprecated int type for $severity deprecated in v12, will change to Severity only in v13. ``` or something like that - or at least add a corresponding @todo line to the method docblock comment. Same for eventually similar places ....
  23. Andreas Kienast commented on patch set 9 06/18/22, 20:54

    ModuleTemplate.php:241 Reply

    I'll add a @todo in the docblock and a @deprecated in the is_int() checks.
  24. Andreas Kienast uploaded patch set 10 06/18/22, 21:01

  25. core-ci voted on patch set 10 V +1 06/18/22, 21:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28190

  26. Andreas Kienast uploaded patch set 11 06/19/22, 11:49

  27. core-ci voted on patch set 11 V +1 06/19/22, 11:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28221

  28. Jörg Bösche voted on patch set 11 CR +1 06/23/22, 13:45

  29. Oliver Klee commented on patch set 11 06/23/22, 13:59

    ModuleTemplate.php:241 Reply

    Done
  30. Andreas Kienast uploaded patch set 12 07/05/22, 13:40

  31. core-ci voted on patch set 12 V +1 07/05/22, 13:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28674

  32. Benni Mack voted on patch set 12 CR +1 07/05/22, 20:29

  33. Oliver Klee commented on patch set 12 07/08/22, 09:26

    Should we also deprecate the TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus class and its usages?
  34. Markus Klein commented on patch set 12 07/08/22, 09:36

    Not sure what that means.
  35. Markus Klein commented on patch set 12 07/08/22, 09:42

    ClassConstantMatcher.php:478

    shouldn't we catch AbstractMessage::* too?
  36. Andreas Kienast commented on patch set 12 CR -1 07/08/22, 09:55

    Reply

    Should be "backed", muscle memory...

    ClassConstantMatcher.php:478 Reply

    Ack
  37. Andreas Kienast uploaded patch set 13 07/08/22, 10:05

  38. core-ci voted on patch set 13 V +1 07/08/22, 10:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28751

  39. Andreas Kienast commented on patch set 13 07/08/22, 10:22

    Reply

    I guess I'd like to tackle those enums in a separate patch.
  40. Oliver Klee commented on patch set 13 CR +1 07/08/22, 10:29

    Reply

    Ack.
  41. Oliver Klee commented on patch set 13 07/08/22, 10:29

    Reply

    Done
  42. crell commented on patch set 13 07/08/22, 13:26

    I like this! A few comment notes, nothing major. My one question is whether "Severity" is too generic a name. The constants it has are very similar to those used for logging, but are still different. I have to ask, should the enum have a scope prefix, like FlashSeverity or something like that?

    AbstractMessage.php:75

    The updated comment here is slightly misleading. The return value must be one of the backing values of Severity, not a Severity case per se. For long-term planning, it may make sense to have it switch to actually returning the Enum in the future so we can get rid of getSeverityEnum() (after making one an alias of the other for a while). I'm not sure if that's worth mentioning in a comment or not.

    Severity.php:26

    I think these could use a comment to explain where/why these integer values are used. Even if it's just for BC, that's worth noting.
  43. Andreas Kienast commented on patch set 13 07/08/22, 19:30

    Reply

    I also thought a while about this. "Flash" binds this to flash messages, where it's not only used but also for notifications and reports. One of two hard things in IT is naming things, next to caching and off-by-one errors :P.

    AbstractMessage.php:75 Reply

    The whole "must be one of ..." doesn't make sense, it's a getter. Will update the comment accordingly. I also thought about returning the enum here, but I have no idea how to do this in an as less breaking way as possible. AFAICS getSeverity() is used for internal reasons only, so the method may become @internal in future.

    Severity.php:26 Reply

    Ack
  44. Andreas Kienast commented on patch set 13 07/08/22, 19:34

    Reply

    I think I'll go with "ContextualFeedback".
  45. Andreas Kienast uploaded patch set 14 07/08/22, 19:42

  46. Stefan Bürk commented on patch set 14 07/08/22, 19:47

    Reply

    Caching is simple, proper invalidation and rebuild is the hard thing. But yeah, naming things is the harded thing eversince ....
  47. core-ci voted on patch set 14 V +1 07/08/22, 19:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28773

  48. Oliver Klee voted on patch set 14 CR +1 07/08/22, 20:11

  49. crell commented on patch set 14 07/08/22, 22:08

    Reply

    `ContextualFeedback` implies it is itself feedback, not a feedback severity. `MessageSeverity`, maybe? (As opposed to LogSeverity or something?) (I hate to bikeshed, but we should get this right.)

    AbstractMessage.php:75 Reply

    If we're certain it's internal, we could just do it and be done with it. Though, if the new value is called something other than Severity that we plan to keep around, use that instead, perhaps? getMessageSeverity()? Then the old getSeverity() can be marked deprecated and/or removed, with no need to switch back later.
  50. Andreas Kienast commented on patch set 14 07/09/22, 05:11

    Reply

    Ack

    AbstractMessage.php:75 Reply

    I can check with Simon Gilli next week if any extension relies on getSeverity() to find a proper strategy here.
  51. Andreas Kienast uploaded patch set 15 07/09/22, 05:11

  52. core-ci voted on patch set 15 V +1 07/09/22, 05:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28796

  53. Oliver Klee voted on patch set 15 CR +1 07/09/22, 08:34

  54. Nikita Hovratov voted on patch set 15 CR +1 07/09/22, 15:49

  55. Oliver Klee commented on patch set 15 CR 0 07/09/22, 15:56

    AbstractMessage.php:72

    AbstractMessage.php:85

    @param int value-of<ContextualFeedbackSeverity>|ContextualFeedbackSeverity $severity
  56. Nikita Hovratov commented on patch set 15 07/09/22, 16:07

    AbstractMessage.php:72 Reply

    wow, this is possible?!
  57. Andreas Kienast commented on patch set 15 07/09/22, 16:51

    AbstractMessage.php:72 Reply

    _mind blown_
  58. Andreas Kienast uploaded patch set 16 07/09/22, 16:51

  59. Andreas Kienast uploaded patch set 17 07/09/22, 16:52

  60. Oliver Klee commented on patch set 17 CR +1 07/09/22, 17:18

    AbstractMessage.php:72 Reply

    I hadn't known until today either (until I looked it up). :-)
  61. core-ci voted on patch set 16 V -1 07/09/22, 17:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28822

  62. core-ci voted on patch set 17 V -1 07/09/22, 17:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28823

  63. Oliver Klee commented on patch set 17 07/09/22, 17:58

    AbstractMessage.php:85 Reply

    Done
  64. Oliver Klee commented on patch set 17 CR 0 07/09/22, 17:59

    We probably need to adapt something to get the tests working again.
  65. Andreas Kienast commented on patch set 17 07/09/22, 18:03

    Reply

    I don't fully understand why it breaks now. Either I did a mistake when adapting the return types or this triggers some Extbase foo now.
  66. Oliver Klee commented on patch set 17 07/09/22, 19:03

    On it, I have an idea. (Why might need to resort to @phpstan-return etc. in one or two places.)
  67. Oliver Klee commented on patch set 17 07/09/22, 19:28

    Okay, this is strange. THe failing unit tests do not fail for me locally: ./Build/Scripts/runTests.sh -s unit typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchema/MethodParameterTest.php
  68. Oliver Klee commented on patch set 17 07/09/22, 19:34

    (And also, I have no problem running all unit tests.)
  69. Oliver Klee commented on patch set 17 07/09/22, 19:38

    Scratch that. Now I can reproduce the problem on my machine, too.
  70. Oliver Klee commented on patch set 17 07/09/22, 19:53

    I have entered https://forge.typo3.org/issues/97884 for throwing a proper exception in cases like this.
  71. Oliver Klee uploaded patch set 18 07/09/22, 19:57

  72. Oliver Klee voted on patch set 18 CR +1 07/09/22, 19:57

  73. Oliver Klee commented on patch set 18 07/09/22, 19:57

    Reply

    Done
  74. core-ci voted on patch set 18 V -1 07/09/22, 20:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28827

  75. Oliver Klee commented on patch set 18 07/09/22, 20:42

    I honestly have no idea what to do about the annotations check in the CI build. (Everything else seems to be fine.)
  76. Andreas Kienast commented on patch set 18 07/09/22, 20:46

    Reply

    The annotation checker doesn't know about @phpstan-*
  77. Andreas Kienast commented on patch set 18 07/09/22, 20:49

    Reply

    Got it fixed, will push asap
  78. Andreas Kienast uploaded patch set 19 07/09/22, 20:49

  79. Oliver Klee uploaded patch set 20 07/09/22, 20:51

  80. Oliver Klee voted on patch set 20 CR +1 07/09/22, 20:51

  81. Oliver Klee commented on patch set 20 07/09/22, 20:52

    Reply

    Done
  82. core-ci voted on patch set 19 V +1 07/09/22, 21:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28831

  83. core-ci voted on patch set 20 V +1 07/09/22, 21:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28832

  84. Markus Klein voted on patch set 20 CR +1 07/10/22, 18:42

  85. crell commented on patch set 20 07/11/22, 15:10

    I'm not wild about the over-verbose name, but won't block on it. Just noting the method names still need to be sorted out before merging.

    AbstractMessage.php:80

    Flagging this method as still needing an improved name, as noted.
  86. Andreas Kienast commented on patch set 20 07/11/22, 20:15

    AbstractMessage.php:80 Reply

    Suggestions are welcome, IMO the method does exactly what its name says.
  87. Oliver Klee commented on patch set 20 07/11/22, 21:15

    AbstractMessage.php:80 Reply

    I’d be fine with either of these names: - getSeverityEnum - getSeverityAsEnum - getAsEnum - toEnum Larry, Andreas, which which of these names could you live?
  88. Oliver Klee commented on patch set 20 07/11/22, 21:48

    Reply

    Which name do you consider over-verbose? And do you have suggestions for improvement?
  89. Andreas Kienast commented on patch set 20 07/12/22, 05:59

    Reply

    I blatantly stole this description from bootstrap and I find it very fitting.

    AbstractMessage.php:80 Reply

    I'm fine with getSeverityEnum(), as I came up with in the first place. `toEnum()` implies that the whole AbstractMessage is converted into an enum which is totally wrong, IMO.
  90. Andreas Kienast commented on patch set 20 CR -2 07/12/22, 12:12

    For the sake of making everybody unhappy, I'll make this patch breaking and ditch getSeverityEnum() now...
  91. Andreas Kienast uploaded patch set 21 07/12/22, 12:52

  92. Andreas Kienast voted on patch set 21 CR 0 07/12/22, 12:52

  93. Andreas Kienast commented on patch set 21 07/12/22, 12:53

    Reply

    Done

    AbstractMessage.php:75 Reply

    Done
  94. Oliver Klee commented on patch set 21 07/12/22, 12:55

    InstallerController.php:1390

    This line seems to have gotten lost in the change: !empty($localConfigurationPathValuePairs)) {
  95. Andreas Kienast commented on patch set 21 07/12/22, 12:57

    InstallerController.php:1390 Reply

    That's intended. `$result->getSeverityEnum() === ContextualFeedbackSeverity::OK` was the common condition with the expression above and then $localConfigurationPathValuePairs is not empty anymore.
  96. core-ci voted on patch set 21 V +1 07/12/22, 13:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28971

  97. Oliver Klee commented on patch set 21 07/12/22, 13:31

    InstallerController.php:1390 Reply

    Ack
  98. Oliver Klee voted on patch set 21 CR +1 07/12/22, 13:32

  99. crell commented on patch set 21 07/12/22, 14:28

    AbstractMessage.php:80 Reply

    It's the "Enum" suffix that I don't think is meaningful. It adds nothing of value, especially if we assume that it's going to fully replace the current getSeverity. getFeedBackSeverity or something like that would flow better, and mean we don't need to bother with transitioning back to getSeverity later.
  1. crell commented on patch set 21 CR +1 07/12/22, 14:31

    Or just that works for me too. :-) Thanks!
  2. Andreas Kienast uploaded patch set 22 07/13/22, 19:51

  3. core-ci voted on patch set 22 V +1 07/13/22, 19:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29098

  4. Andreas Kienast uploaded patch set 23 07/13/22, 20:02

  5. core-ci voted on patch set 23 V +1 07/13/22, 20:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29099

  6. Oliver Klee voted on patch set 23 CR +1 07/13/22, 20:13

  7. crell voted on patch set 23 CR +1 07/13/22, 20:17

  8. Andreas Kienast commented on patch set 23 CR -1 07/14/22, 04:21

    need to check extension scanner stuff
  9. Andreas Kienast uploaded patch set 24 07/14/22, 05:53

  10. core-ci voted on patch set 24 V +1 07/14/22, 06:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29111

  11. Andreas Kienast uploaded patch set 25 07/14/22, 06:26

  12. core-ci voted on patch set 25 V +1 07/14/22, 06:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29114

  13. Andreas Kienast uploaded patch set 26 07/14/22, 07:56

  14. core-ci voted on patch set 26 V +1 07/14/22, 08:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29123

  15. Frank Nägler voted on patch set 26 CR +1 07/14/22, 08:28

  16. Frank Nägler voted on patch set 26 V +1 07/14/22, 08:39

  17. Markus Klein voted on patch set 26 CR +1 07/14/22, 08:52

  18. Oliver Klee voted on patch set 26 CR +1 07/14/22, 08:59

  19. Oliver Klee commented on patch set 26 CR 0 07/14/22, 09:00

    FlashMessage.php:40

    We don’t need the int here: The value-of thing already is said integer.
  20. Andreas Kienast commented on patch set 26 07/14/22, 10:04

    FlashMessage.php:40 Reply

    PhpStorm says otherwise and annotated the is_int() check.
  21. Oliver Klee commented on patch set 26 CR +1 07/14/22, 10:11

    FlashMessage.php:40 Reply

    Ah, that's probably because PhpStorm doesn't recognize the value-of syntax (yet). I'm fine with either version.
  22. Benni Mack voted on patch set 26 V +1 07/14/22, 16:33

  23. Andreas Kienast voted on patch set 26 V +2 CR +2 07/14/22, 16:43

  24. Andreas Kienast merged patch set 27 07/14/22, 16:43

  25. Oliver Klee commented on patch set 27 07/14/22, 16:53

    Wohoo, it's finally merged!

    FlashMessage.php:40 Reply

    Done