Review main Merged Breaking

74389[!!!][FEATURE] Add PSR-14 ModifyVersionDifferencesEvent

Oli Bartsch CR +2 V +2 Hard +217 −54 updated 04/25/22, 21:25

Commit message

This introduces a new PSR-14 event, enabling
extension authors to modify the differences of
versioned records, used for the difference view
in the workspaces module.

This replaces the previously available hook
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['modifyDifferenceArray']
which is therefore now removed.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Stefan Bürk +1
    • Nikita Hovratov +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Stefan Bürk +1
    • Nikita Hovratov +1
    • core-ci +1 CI

Issues 1

Files 7

Review log 2431

Show 56 earlier messages
  1. Oli Bartsch uploaded patch set 1 04/25/22, 14:56

  2. Oliver Klee commented on patch set 1 04/25/22, 15:06

    ModifyVersionDifferencesEvent.php:29

    Please let's annotate the arrays with type annotations (and possibly array shapes) so the reader/extension author and static type analysis like PHPStan know what's inside the arrays and what to provide. (As an extension author, I have no idea how to use this interface by reading the code , which is my usual way to learn about it.)
  3. core-ci voted on patch set 1 V -1 04/25/22, 15:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26403

  4. crell commented on patch set 1 04/25/22, 15:21

    ModifyVersionDifferencesEvent.php:31

    If there's both a getter and setter for a plain array, and the property is already typed for an array, I don't see any value to having getters/setters for it. Just make it a public property.

    ModifyVersionDifferencesEvent.php:43

    If there's both a getter and setter for a plain array, and the property is already typed for an array, I don't see any value to having getters/setters for it. Just make it a public property.

    ModifyVersionDifferencesEvent.php:58

    These are all readonly properties, so making them private and going through a method offers no benefit. They're safe to make public readonly in PHP 8.1.
  5. Oli Bartsch uploaded patch set 2 04/25/22, 16:30

  6. Oli Bartsch commented on patch set 2 04/25/22, 16:31

    ModifyVersionDifferencesEvent.php:29 Reply

    Done

    ModifyVersionDifferencesEvent.php:31 Reply

    This is not an array.

    ModifyVersionDifferencesEvent.php:43 Reply

    This is currently the way, PSR-14 Events in Core work. AFAIK there is not a single Event, which allows to modify the class property directly. This would also make any internal changes later difficult. Therefore, and for consistency with the existing events, I would like to keep it this way.

    ModifyVersionDifferencesEvent.php:58 Reply

    Same as in the other comment. Events in Core do not allow to access properties directly but always use getters/setters. This allows internal changes later on, without being breaking. This is one of the benefits in comparison to the previous hooks.
  1. core-ci voted on patch set 2 V +1 04/25/22, 16:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26407

  2. Stefan Bürk commented on patch set 2 04/25/22, 16:40

    ModifyVersionDifferencesEvent.php:43 Reply

    AFAIK also easier to deprecate eventually in the future then a readonly CPP.
  3. Stefan Bürk voted on patch set 2 V +1 CR +1 04/25/22, 16:46

  4. crell commented on patch set 2 CR -1 04/25/22, 16:51

    ModifyVersionDifferencesEvent.php:37

    (I thought I posted this before but I cannot find it now for some reason.) Events should have no service dependencies. They're pure data objects. If a listener wants to use DiffUtility, that's its dependency, not the event's. The event should have no service dependencies at all.
  5. Oliver Klee commented on patch set 2 04/25/22, 17:08

    Thanks!
  6. Stefan Bürk voted on patch set 2 V 0 CR 0 04/25/22, 17:26

  7. Oli Bartsch uploaded patch set 3 04/25/22, 17:29

  8. core-ci voted on patch set 3 V +1 04/25/22, 17:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26408

  9. Nikita Hovratov commented on patch set 3 04/25/22, 17:55

    Feature-97450-PSR-14EventForModifyingVersionDifferences.rst:46

    on their own
  10. Stefan Bürk commented on patch set 4 04/25/22, 18:16

    Published edit on patch set 3.
  11. core-ci voted on patch set 4 V -1 04/25/22, 18:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26409

  12. core-ci voted on patch set 4 V +1 04/25/22, 18:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26409

  13. crell commented on patch set 4 04/25/22, 18:38

    Breaking-97450-RemovedHookForModifyingVersionDifferences.rst:33

    This is referencing the wrong feature file. Copypasta?
  14. Oli Bartsch uploaded patch set 5 04/25/22, 18:48

  15. Oli Bartsch commented on patch set 5 04/25/22, 18:50

    Breaking-97450-RemovedHookForModifyingVersionDifferences.rst:33 Reply

    Done

    Feature-97450-PSR-14EventForModifyingVersionDifferences.rst:46 Reply

    Done

    ModifyVersionDifferencesEvent.php:37 Reply

    Ack
  16. core-ci voted on patch set 5 V +1 04/25/22, 19:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26410

  17. Stefan Bürk voted on patch set 5 V +1 CR +1 04/25/22, 19:14

  18. crell voted on patch set 5 CR +1 04/25/22, 20:24

  19. Oli Bartsch updated the commit message in patch set 6 04/25/22, 20:38

  20. Stefan Bürk voted on patch set 6 V +1 CR +1 04/25/22, 20:39

  21. core-ci voted on patch set 6 V +1 04/25/22, 20:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26427

  22. Nikita Hovratov voted on patch set 6 V +1 CR +1 04/25/22, 21:06

  23. Oli Bartsch voted on patch set 6 V +2 CR +2 04/25/22, 21:14

  24. Oli Bartsch merged patch set 7 04/25/22, 21:14

  25. Oliver Klee wrote 04/25/22, 21:25

    Removed cc Oliver Klee.