Review main Merged

79568[FEATURE] Deprecate and replace DuplicationBehavior class with enum

Thomas Hohn CR +2 V +2 Hard +367 −120 updated 10/27/23, 08:15

Commit message

Deprecate DuplicationBehavior class and add a new native backed enum
TYPO3\CMS\Core\Resource\Enum\DuplicationBehavior as a replacement.

Review

  • Code review CR +2 Done
    • Nikita Hovratov +2
    • Andreas Kienast +1
  • Verified V +2 Done
    • Nikita Hovratov +2
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 2

Files 18

Review log 87112

Show 6787 earlier messages
  1. Thomas Hohn uploaded patch set 1 06/30/23, 08:58

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

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

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

  5. Thomas Hohn uploaded patch set 3 V -1 06/30/23, 10:18

  6. core-ci voted on patch set 3 V +1 06/30/23, 10:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43149

  7. Thomas Hohn uploaded patch set 4 V +1 06/30/23, 12:47

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

  9. Oliver Klee commented on patch set 4 06/30/23, 14:10

    DuplicationBehavior.php:3

    Please let's make all new classes/enums strict when we create them.
  10. Thomas Hohn uploaded patch set 5 V +1 06/30/23, 14:17

  11. Thomas Hohn commented on patch set 5 06/30/23, 14:17

    DuplicationBehavior.php:3 Reply

    Done
  12. core-ci voted on patch set 5 V +1 06/30/23, 14:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43156

  13. Benni Mack rebased onto patch set 6 V +1 07/06/23, 10:41

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

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

  16. Oliver Klee commented on patch set 6 07/15/23, 11:35

    Could you please rebase to solve the merge conflicts?
  17. Thomas Hohn uploaded patch set 7 V +1 07/15/23, 15:02

  18. Thomas Hohn commented on patch set 7 07/15/23, 15:03

    Reply

    Done
  19. core-ci voted on patch set 7 V +1 07/15/23, 15:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44174

  20. Oliver Klee voted on patch set 7 V +1 07/15/23, 15:12

  21. Oliver Klee commented on patch set 7 V 0 07/15/23, 15:13

    FileInterface.php:127

    We should remove the outdated `@param` annotation for all affected usages of the `$conflictmode` argument.
  22. Thomas Hohn commented on patch set 7 07/15/23, 19:46

    FileInterface.php:127 Reply

    So you want to remove all places where the @param string $conflictMode is present?
  23. Oliver Klee commented on patch set 7 07/15/23, 21:36

    FileInterface.php:127 Reply

    Exactly. :-) (Currently, the PHPDoc `@param` annotation and the native type declaration are out of sync. So we either need to adapt the PHPDoc annotations or remove them. As the PHPDoc annotations do not add anything over the native type declaration, I'd opt for removing them.)
  24. Thomas Hohn commented on patch set 7 07/16/23, 14:40

    FileInterface.php:127 Reply

    Had a second look - I think we should clean it up with TYPO3 v14.0 - it seems that I forgot to change it for this class. Instead we could tighten the signatures as an additional pre
  25. Oliver Klee commented on patch set 7 07/16/23, 14:46

    FileInterface.php:127 Reply

    Sounds good to me.
  26. Alexander Schnitzler commented on patch set 7 07/19/23, 05:37

    ResourceStorage.php:1234

    Why is the fallback `CANCEL` here when the default of the method param is `RENAME`? Same for all the other methods.
  27. Thomas Hohn commented on patch set 7 07/19/23, 06:22

    ResourceStorage.php:1234 Reply

    Might have been an mis-interpretation of what the previous cast method would have returned for a non-existing illegal value
  28. Alexander Schnitzler uploaded patch set 8 V +1 07/20/23, 14:09

  29. Alexander Schnitzler commented on patch set 8 07/20/23, 14:11

    ResourceStorage.php:1234 Reply

    No no, you are right here.
  30. core-ci voted on patch set 8 V +1 07/20/23, 14:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44348

  31. Thomas Hohn uploaded patch set 9 V +1 07/25/23, 19:13

  32. core-ci voted on patch set 9 V +1 07/25/23, 19:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44553

  33. Thomas Hohn commented on patch set 9 08/01/23, 11:57

    FileInterface.php:127 Reply

    Do we still want to do this? I saw a PR from you with AbstractFile that had some issues
  34. Oliver Klee commented on patch set 9 08/01/23, 12:08

    FileInterface.php:127 Reply

    That probably was Alex' change that had to be reverted: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80233 I'd assume that Alex (or someone else) will first fix the problems in separate changes and then re-create the change for adding type declarations to AbstractFile. I think that having Alex' change first and then this one here would be way that is less stressful. So maybe let's mark this change here as WIP and revisit and rebase it once Alex' change is merged.
  35. Oliver Klee commented on patch set 9 08/01/23, 12:24

    FileInterface.php:127 Reply

    What do you think, Thomas?
  36. Thomas Hohn commented on patch set 9 08/01/23, 12:29

    FileInterface.php:127 Reply

    Let's see what comes first. The is still this issue and another enumeration issue open before the Class Enumeration can be marked as deprecated. If https://review.typo3.org/c/Packages/TYPO3.CMS/+/79571 is merged fast - Id opt for getting this issue fixed ASAP so we can finish the enumeration class stuff
  37. Alexander Schnitzler commented on patch set 9 08/01/23, 13:47

    FileInterface.php:127 Reply

    I have a new patch online but as WIP because I was told we should remain calm to not endanger the coding night. If this will be merged before mine, no problem. I know how to rebase. :) So, don't hold this back for me.
  38. Thomas Hohn commented on patch set 9 08/15/23, 04:55

    FileInterface.php:127 Reply

    Done
  39. Thomas Hohn uploaded patch set 10 V +1 09/22/23, 05:00

  40. core-ci voted on patch set 10 V -1 09/22/23, 05:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47045

  41. Thomas Hohn uploaded patch set 11 V -1 09/22/23, 05:47

  42. core-ci voted on patch set 11 V +1 09/22/23, 05:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47047

  43. Simon Schaufelberger commented on patch set 11 09/22/23, 08:13

    AbstractFile.php:492

    I prefer the same deprecation message format like: xxx has been deprecated in TYPO3 v13.0 and will be removed in v14.0

    ClassNameMatcher.php:2354

    huh, what happened with the IconState? Why did you replace that?
  44. Nikita Hovratov commented on patch set 11 09/22/23, 08:57

    AbstractFile.php:492 Reply

    The information since which version the deprecation started is redunant. Usually we just state when the method / behavior will stop working.
  45. Thomas Hohn commented on patch set 11 09/22/23, 08:59

    AbstractFile.php:492 Reply

    I have no problem with that - just found this example stating the opposite: 'ExtensionManagementUtility::addPageTSConfig() has been deprecated in TYPO3 v13.0 and will be removed in v14.0. Use Configuration/page.tsconfig files in extensions instead.',
  46. Nikita Hovratov commented on patch set 11 09/22/23, 09:11

    AbstractFile.php:492 Reply

    It's not consistent across the Core, yes. I just remember that we changed a bunch of deprecation messages in the past. Nothing that is set in stone, but keeping the messages short without redundant information is the preferred way. Remember: These will be found in the **deprecation** log. So stating this method or behavior is deprecated is already obvious.
  47. Nikita Hovratov commented on patch set 11 CR -1 09/22/23, 09:13

    working on it.
  48. Thomas Hohn commented on patch set 11 09/22/23, 09:15

    AbstractFile.php:492 Reply

    So change it to: Using the non-native enumeration TYPO3\CMS\Core\Resource\DuplicationBehavior will not work in TYPO3 v14.0 anymore. Use native TYPO3\CMS\Core\Resource\Enum\DuplicationBehavior instead. Or ?

    ClassNameMatcher.php:2354 Reply

    I should not resolve merge conflicts early in the morning ;-)
  49. Nikita Hovratov uploaded patch set 12 CR -1 V +1 09/22/23, 09:56

  50. Nikita Hovratov commented on patch set 12 09/22/23, 10:00

    AbstractFile.php:492 Reply

    Done

    ClassNameMatcher.php:2354 Reply

    Done
  51. core-ci voted on patch set 12 V -1 09/22/23, 10:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47072

  52. Nikita Hovratov commented on patch set 12 CR -1 09/22/23, 10:13

    I'm really unsure here about the deprecation paired with changed parameter types. It will be very annoying for developers first to change everything to string|DuplicationBehavior in v13 and then immediately in v14 again to DuplicationBehavior. As we already know, that this signature change will happend, maybe we should postpone it to v14. This way, this patch shouldn't be breaking at all. Small exception: FileInterface->rename. We already changed the signature to string, but only on main! So we could revert it and postpone it until v14. I really think this is way better than having breaking changes for the same classes to times in a row.
  53. Thomas Hohn uploaded patch set 13 CR -1 V -1 09/22/23, 10:15

  54. Nikita Hovratov uploaded patch set 14 09/22/23, 10:17

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

  56. Nikita Hovratov commented on patch set 14 09/22/23, 10:24

    Sorry, I've overridden your patch Thomas.
  57. Nikita Hovratov commented on patch set 14 CR -1 09/22/23, 10:25

    Read comment above.
  58. core-ci voted on patch set 14 V +1 09/22/23, 10:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47076

  59. Thomas Hohn commented on patch set 14 09/22/23, 10:36

    Reply

    Just remind me why it's too late to have it with TYPO3 13 - without the deprecation?
  60. Thomas Hohn commented on patch set 14 10/12/23, 05:00

    Reply

    So you would make "another" patch with purpose is only to mark the class DuplicationBehavior as deprecated in TYPO3 13 and the remove it in TYPO3 14 together with the new signatures?
  61. Alexander Schnitzler commented on patch set 14 10/12/23, 06:04

    Reply

    Hi Nikita, it's almost three weeks now that you uploaded a patch set and stated you are unsure about something but didn't act. Do you expect Thomas to resolve your doubts? Please understand that those actions lead to frustration. By the size of this patch set I can very well guess how much time went into it and Thomas is been put on hold here by your -1, yet you don't express specific changes you want to see. You explained a way with a couple of maybe and should but it's not completely clear what exactly you want to do. Unless you want to remove your -1 I think it makes sense for you to upload a new patch set and bring this further so this patch can receive a +1 or +2 from you. But Please don't block (-1 and no action) this any further.
  62. Nikita Hovratov commented on patch set 14 10/12/23, 07:57

    Reply

    Hey, I was just waiting for approval of my proposal. I was writing with Thomas on Slack, so it seems here that I ignored him (sorry, should have communicated here as well) We need a pre-patch, which reverts the signature change of `FileInterface->rename`. This way, all method signatures of AbstractFile (rename, copyTo, etc.) won't be breaking in v13, while the deprecation is still logged. In v14 we change the signature to `DuplicationBehavior`.
  63. Alexander Schnitzler commented on patch set 14 10/12/23, 07:58

    Reply

    Thanks for the clarification. From just reading here it looked different. :)
  64. Thomas Hohn commented on patch set 14 10/12/23, 07:59

    Reply

    Hi - will have a look at it :)
  65. Nikita Hovratov commented on patch set 14 10/12/23, 08:13

  66. Nikita Hovratov uploaded patch set 15 CR -1 V +1 10/12/23, 09:36

  67. core-ci voted on patch set 15 V +1 10/12/23, 09:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47706

  68. Benni Mack commented on patch set 15 10/12/23, 11:24

    FileListController.php:673

    This method should return the Enum, in addition, I believe we could move this option directly to the Enum having a User object as argument.
  69. Thomas Hohn uploaded patch set 16 V +1 10/12/23, 13:49

  70. Thomas Hohn commented on patch set 15 10/12/23, 13:50

    Reply

    Done

    FileListController.php:673 Reply

    Will have a look into that
  71. Thomas Hohn commented on patch set 16 10/12/23, 13:50

    Reply

    Done
  72. Thomas Hohn commented on patch set 16 10/12/23, 13:57

    FileListController.php:673 Reply

    What would you do about the logging? Have a DuplicationBehavior::NOTCONFIGURED and handle that here?
  73. core-ci voted on patch set 16 V -1 10/12/23, 13:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47722

  74. Thomas Hohn uploaded patch set 17 V -1 10/12/23, 15:56

  75. core-ci voted on patch set 17 V +1 10/12/23, 16:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47726

  76. Thomas Hohn commented on patch set 17 10/12/23, 16:24

    FileListController.php:673 Reply

    Done
  77. Nikita Hovratov commented on patch set 17 10/13/23, 08:54

    Folder.php:285

    Please keep the doctype annoation `string|DuplicationBehavior`. This is useful for users and static code analysis.

    Folder.php:289

    1. Type Annotation for DuplicationBehavior should be removed here as well. 2. Let's remove the `string` annotations for localFilePath and fileName. This is a breaking change.
  78. Nikita Hovratov uploaded patch set 18 V +1 10/13/23, 08:54

  79. core-ci voted on patch set 18 V +1 10/13/23, 09:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47735

  80. Thomas Hohn uploaded patch set 19 V +1 10/13/23, 10:33

  81. Thomas Hohn commented on patch set 19 10/13/23, 10:37

    Folder.php:285 Reply

    Done

    Folder.php:289 Reply

    Done
  82. core-ci voted on patch set 19 V +1 10/13/23, 10:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47736

  83. Nikita Hovratov uploaded patch set 20 V +1 10/13/23, 13:49

  84. core-ci voted on patch set 20 V +1 10/13/23, 13:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47741

  85. Nikita Hovratov commented on patch set 20 V +1 CR +1 10/13/23, 13:58

    This looks good now :)
  86. Christian Kuhn voted on patch set 20 CR +1 10/15/23, 13:52

  87. Stefan Bürk commented on patch set 20 10/15/23, 14:11

    Feature-101151-DuplicationBehavior.rst:24

    Should we not make that a bullet list ? (Missing `*` for each line ...
  1. Thomas Hohn uploaded patch set 21 CR +1 V +1 10/15/23, 16:54

  2. Thomas Hohn commented on patch set 21 10/15/23, 16:54

    Feature-101151-DuplicationBehavior.rst:24 Reply

    Done
  3. core-ci voted on patch set 21 V +1 10/15/23, 17:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47784

  4. Nikita Hovratov voted on patch set 21 V +1 CR +1 10/16/23, 07:36

  5. Chris Müller commented on patch set 21 10/16/23, 08:23

    Deprecation-101151-DuplicationBehaviorClass.rst:37

    Shouldn't this be \TYPO3\CMS\Core\Resource\Enum\DuplicationBehavior?
  6. Nikita Hovratov uploaded patch set 22 CR +1 V +1 10/16/23, 08:51

  7. Nikita Hovratov commented on patch set 22 10/16/23, 08:52

    Deprecation-101151-DuplicationBehaviorClass.rst:37 Reply

    Yes, thanks. The other namespace was also wrong. Fixed now.
  8. core-ci voted on patch set 22 V +1 10/16/23, 08:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47807

  9. Nikita Hovratov voted on patch set 22 V +1 CR +1 10/18/23, 07:13

  10. Thomas Hohn uploaded patch set 23 CR +1 V +1 10/23/23, 08:41

  11. core-ci voted on patch set 23 V -1 10/23/23, 08:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48073

  12. Thomas Hohn uploaded patch set 24 V -1 10/23/23, 09:07

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

  14. Nikita Hovratov voted on patch set 24 V +1 CR +1 10/23/23, 10:55

  15. Andreas Kienast commented on patch set 24 10/26/23, 13:01

    AbstractFile.php:483

    I'd rather use `DuplicationBehavior::class` instead.

    DuplicationBehavior.php:56

    `self::CANCEL`

    DuplicationBehavior.php:64

    `self::tryFrom()`

    DuplicationBehavior.php:76

    `self::CANCEL`

    Folder.php:295

    I'd rather use `DuplicationBehavior::class` instead.

    ResourceStorage.php:1241

    I'd rather use `DuplicationBehavior::class` instead.
  16. Nikita Hovratov uploaded patch set 25 CR +1 V +1 10/26/23, 13:17

  17. Nikita Hovratov commented on patch set 25 10/26/23, 13:17

    DuplicationBehavior.php:56 Reply

    Done

    DuplicationBehavior.php:64 Reply

    Done

    DuplicationBehavior.php:76 Reply

    Done
  18. Nikita Hovratov commented on patch set 25 10/26/23, 13:21

    AbstractFile.php:483 Reply

    Let's keep it as is please, there is no benefit in changing it to DuplicationBehavior::class. It won't change ever and will be removed in v13 regardless.
  19. Nikita Hovratov commented on patch set 25 10/26/23, 13:21

    AbstractFile.php:483 Reply

    v14*
  20. core-ci voted on patch set 25 V +1 10/26/23, 13:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48236

  21. Thomas Hohn commented on patch set 25 10/27/23, 04:18

    AbstractFile.php:483 Reply

    Done
  22. Thomas Hohn commented on patch set 25 10/27/23, 04:18

    Folder.php:295 Reply

    Done

    ResourceStorage.php:1241 Reply

    Done
  23. Andreas Kienast voted on patch set 25 V +1 CR +1 10/27/23, 08:01

  24. Nikita Hovratov voted on patch set 25 V +2 CR +2 10/27/23, 08:14

  25. Nikita Hovratov merged patch set 26 10/27/23, 08:15