Review main Abandoned

91123[BUGFIX] Allow XCLASSing of redirects Demand objects

Jan Stockfisch CR -2 V 0 Easy +5 −3 updated 10/20/25, 15:20

Commit message

The static factory Demand::from* methods now use proper GU::makeInstance
 calls instead of new-keywords, allowing for XCLASSing

Review

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

Issues 1

Files 1

Review log 1214

  1. Jan Stockfisch uploaded patch set 1 10/17/25, 12:20

  2. Jan Stockfisch marked it work in progress 10/17/25, 12:28

  3. Jan Stockfisch marked it ready for review 10/17/25, 12:31

  4. core-ci voted on patch set 1 V -1 10/17/25, 12:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86892

  5. Jan Stockfisch uploaded patch set 2 V -1 10/17/25, 12:38

  6. core-ci voted on patch set 2 V +1 10/17/25, 12:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86896

  7. Sven Liebert commented on patch set 2 10/17/25, 15:12

    I think thats not a BUGFIX. It's a FEATURE to allow XClassing of the demand object.
  8. Stefan Bürk commented on patch set 2 CR -1 10/17/25, 17:27

    -1 for now (which may promoted to a -2). We won't do that for a couple of reasons. First, having the `factory` method (static) on the object is not good and should be a dedicated `factory` (based on a factory interface) in the first place. Second, the demand object is `@internal` for good, based on the not-so nice current design with the factory. Third, that would make the `constructor` API and conflicting with "XCLASS" non-being breaking - except it is a explict API, something this change would make it and **should** not do that. Fourth, `GU::makeInstance()` uses new keyword under the hood and passes the passed arguments as constructor arguments in the exact same order, not really usefull even with a "xlass" in place. Emphasizing a proper (`decoratable`) dedicated factory. Fith, we would need a `DemandInterface` first and use that, making the "Default" demand final (or to be used in a decorated manner itself). Sixth, discarding GU as option and the aforementioned `points` this would be a main only change anyway. Currently, even withouth making the above mentioned points, the `ModifyRedirectManagementControllerViewDataEvent` can be used to replace the `Demand` with a custom xclassed object in case someone wants to deal with allowed breaking changes in patchlevel changes. Using the event is even more practical, as the event also have the `ServerRequest` which would not be available in the constructor of the xlassed object and no additional processing can be done anyway. Talking about all that, we could work this towards the feature introducing a demand interface and a dedicated service which all together is kind of breaking until 14.0 (and replace it in the event object with the interface) and the reason why I keep the -1 instead of a -2 for now if someone is up to rework the change towards that approach. Btw this works like intended and not having it xclassable by GU::makeInstance() is not a bug, it's simple the wrong way to do so. Let us prepare that correctly or use the `legit` workaround with the event - the reason we made the event back than as a workaround.
  9. Oli Bartsch commented on patch set 2 CR -2 10/18/25, 08:49

    Please let's discuss the use cases here and add PSR-14 Events at the appropriate places. XClasses should be avoided whenever possible. They are one of the worst "API" we have.
  10. Jan Stockfisch commented on patch set 2 10/20/25, 07:45

    IMO it is absolutely not a feature to follow TYPO3s philosophy of "not using new but GU:makeInstance" and therefore always is a bug. If it is necessary to us the new-keyword I would expect a comment with the reason. @internal About the use-case: I am not using XCLASS or rather _need_ it here for something but just saw that the new-keyword is used.

    Reply Unresolved

    The usecase is to follow the philosophy of TYPO3 to not use the `new`-keyword. I used the XCLASS API as an existing API for the title of the patch

    Reply

    Some of these points are definitely valid and should be resolved, but not in this issue. Please create a separate followup issue with these changes. This issue is about "not using the `new`-keyword but `GU::makeInstance`" and is intended to be a simple to review & merge patch. PS: The `ModifyRedirectManagementControllerViewDataEvent` is only used in the `ManagementController`, meaning you will have a different behavior with the CLI commands.

    Reply

    IMO it is absolutely not a feature to follow TYPO3s philosophy of "not using new but GU:makeInstance" and therefore always is a bug. If it is necessary to use the new-keyword I would expect a comment with the reason.
  11. Jan Stockfisch commented on patch set 2 10/20/25, 07:46

    Reply

    Ignore this comment. Haven't used this tool in a few years.
  12. Stefan Bürk voted on patch set 2 CR -2 10/20/25, 13:08

  13. Stefan Bürk commented on patch set 2 10/20/25, 13:17

    Reply Unresolved

    GU::makeInstance() will not happen. I outlined possible ways to do it properly and avoid the old-to-prevent XCLASS API. You are right regarding CLI, did not had that on the screen, basically the same thing counts there just not having the proper context from the input and dedicated factory pattern is required. -2 now, going to have a look and making something for 14.0 in the proper way, but I guess that would mean to finish https://review.typo3.org/c/Packages/TYPO3.CMS/+/77372 to have that in the "API" then.

    Reply Unresolved

    > IMO it is absolutely not a feature to follow TYPO3s philosophy of "not using new but GU:makeInstance" and therefore always is a bug. Nope, that is not always a bug.
  14. Jan Stockfisch abandoned the change 10/20/25, 15:20