Review main Merged Breaking

82305[!!!][FEATURE] Add PSR-14 Events for modifying cObj stdWrap

Oli Bartsch CR +2 V +2 Hard +496 −198 updated 01/16/24, 15:56

Commit message

This replaces the previously available hook
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap']
which is therefore now removed.

Instead of one hook class, containing different methods,
required by the deprecated `ContentObjectStdWrapHookInterface`
does this patch add four dedicated PSR-14 Events, which
can be used individually.

Additionally, using the parent `EnhanceStdWrapEvent` it's
still possible to register listeners, which are called
on each occurrence.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Stefan Bürk +1
    • Benni Mack +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Stefan Bürk +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 18

Review log 3343

Show 1218 earlier messages
  1. Oli Bartsch uploaded patch set 1 01/03/24, 16:36

  2. core-ci voted on patch set 1 V -1 01/03/24, 16:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51081

  3. Oli Bartsch uploaded patch set 2 V -1 01/03/24, 16:44

  4. core-ci voted on patch set 2 V +1 01/03/24, 16:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51083

  5. Simon Schaufelberger commented on patch set 2 01/04/24, 01:04

    Feature-102745-ImproveContentObjectStdWrapHooksRegistration.rst:15

    functionality

    Feature-102745-ImproveContentObjectStdWrapHooksRegistration.rst:23

    I would love to have a code snippet here.
  6. Simon Schaufelberger commented on patch set 2 01/04/24, 01:06

    a general question: we also use php attributes in other places for registering stuff. would it make sense to use them here as well?
  7. Oli Bartsch uploaded patch set 3 V +1 01/04/24, 07:34

  8. Oli Bartsch commented on patch set 3 01/04/24, 07:37

    Reply

    Implementing the interface is required anyways. This information allows to auto register the services. There is no need to force developers in adding additional PHP Attributes to those services. Especially because no specific configuration can be applied to them.

    Feature-102745-ImproveContentObjectStdWrapHooksRegistration.rst:15 Reply

    Done

    Feature-102745-ImproveContentObjectStdWrapHooksRegistration.rst:23 Reply

    Done
  9. core-ci voted on patch set 3 V +1 01/04/24, 07:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51096

  10. Simon Schaufelberger voted on patch set 3 CR +1 V +1 01/04/24, 12:33

  11. Christian Kuhn commented on patch set 3 CR -1 01/08/24, 11:06

    I don't think we should do it this way: The wording 'hook' is imho wrong in the first place already and should get rid of it. Isn't a casual transfer towards single events possible without further hassle here?
  12. Oli Bartsch commented on patch set 3 CR -1 01/08/24, 11:13

    Reply

  13. Oli Bartsch uploaded patch set 4 CR +1 V +1 01/12/24, 14:11

  14. Oli Bartsch uploaded patch set 5 01/12/24, 14:15

  15. core-ci voted on patch set 5 V -1 01/12/24, 14:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51509

  16. core-ci voted on patch set 4 V -1 01/12/24, 14:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51508

  17. Oli Bartsch uploaded patch set 6 V -1 01/12/24, 20:32

  18. core-ci voted on patch set 6 V +1 01/12/24, 20:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51516

  1. Oli Bartsch commented on patch set 6 01/12/24, 20:47

    Reply

    Done
  2. Benni Mack commented on patch set 6 CR +1 01/12/24, 20:48

    Reply

    Done
  3. Benni Mack commented on patch set 7 CR +1 V +1 01/12/24, 20:50

    Published edit on patch set 6.
  4. core-ci voted on patch set 7 V +1 01/12/24, 20:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51517

  5. Benni Mack voted on patch set 7 CR +1 V +1 01/12/24, 21:04

  6. Stefan Bürk commented on patch set 7 01/12/24, 22:45

    EnhanceStdWrapEvent.php:32

    Can we make the class `abstract` ? Okay, could not see that this class and a child is dispatched - but this may slip in in the future and leads to issues I guess. We had that one time where lolli played around with a nested event chain (both dispatched). Therefore, I would suggest to add `abstract` here so it can never created and used to be dispatched. I highly encourage to make that clear. (And a additional point why we are making event DTO's final normally). At least add a big fat comment to it that it should never directly be dispatched.
  7. Stefan Bürk commented on patch set 7 CR +1 V +1 01/12/24, 23:29

    EnhanceStdWrapEvent.php:32 Reply

    As discussed in slack. Not really happy, but let us wait until it go wrong.
  8. Oli Bartsch uploaded patch set 8 CR +1 V +1 01/12/24, 23:32

  9. Oli Bartsch commented on patch set 8 01/12/24, 23:34

    EnhanceStdWrapEvent.php:32 Reply

    Declared the class abstract, since we did this for other parent Event classes, e.g. `AbstractSectionMarkupGeneratedEvent`, in the past already.
  10. Oli Bartsch uploaded patch set 9 01/12/24, 23:37

  11. core-ci voted on patch set 8 V +1 01/12/24, 23:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51527

  12. Stefan Bürk voted on patch set 9 CR +1 V +1 01/12/24, 23:39

  13. Stefan Bürk commented on patch set 9 01/12/24, 23:40

    EnhanceStdWrapEvent.php:32 Reply

    Thank you. 😊
  14. core-ci voted on patch set 9 V +1 01/12/24, 23:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51528

  15. Benni Mack voted on patch set 9 CR +1 V +1 01/14/24, 00:18

  16. Nikita Hovratov uploaded patch set 10 CR +1 V +1 01/14/24, 02:05

  17. core-ci voted on patch set 10 V +1 01/14/24, 02:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51542

  18. Nikita Hovratov commented on patch set 10 CR -1 01/14/24, 02:19

    EnhanceStdWrapEvent.php:38

    Not sure to restrict this to null|string here. Oftentimes `$content` can also have other types, which can come from various sources. The method `stdWrapValue` for example has the doctype `string|int|bool|null`. Probably we should align to this? If we don't do this, odd side effects could occur due to type conversion. See the Test SlugSiteRequestTest, where the values changed to string due to implicit php type conversion, because ContentObjectRenderer has no strict mode enabled. This will fail hard, if we ever switch to strict mode there.
  19. Oli Bartsch commented on patch set 10 01/14/24, 09:57

    EnhanceStdWrapEvent.php:38 Reply

    Unsure. This patch is already breaking. I think we should take such opportunities to make the code base - especially such central features - more strict. `stdWrapValue` still returns `string|int|bool|null` based on the corresponding default value. `stdWrap` is annotated with `string`. Having `?string` is actually only necessary to support the `isNull` function.
  20. Nikita Hovratov commented on patch set 10 CR 0 01/14/24, 16:44

    EnhanceStdWrapEvent.php:38 Reply

    Okay, I certainly agree this should be more strict. Still don't like this implicit type conversion, hm. Hope this goes well.
  21. Simon Schaufelberger voted on patch set 10 CR +1 01/14/24, 17:10

  22. Stefan Bürk voted on patch set 10 CR +1 V +1 01/16/24, 09:01

  23. Benni Mack voted on patch set 10 CR +1 V +1 01/16/24, 11:09

  24. Oli Bartsch voted on patch set 10 CR +2 V +2 01/16/24, 15:56

  25. Oli Bartsch merged patch set 11 01/16/24, 15:56