Review main Abandoned

90716[TASK] Remove @internal from RedirectResponse

Torben Hansen CR 0 V -1 Easy +1 −5 updated 02/07/26, 09:28

Commit message

The `RedirectResponse` class was introduced in 2017 and
has been marked as `@internal` ever since. Over the years,
it has become a de facto standard in TYPO3 core and is also
widely used in third-party extensions across the TYPO3
ecosystem.

Keeping the `@internal` annotation is misleading, as it
suggests the class is not intended for public use, despite
its established role in TYPO3 core and extensions.

This change removes the `@internal` annotation from
`RedirectResponse` to provide clarity for extension
developers.

Review

  • Code review CR 0
  • Verified V -1
    • Oli Bartsch -1
    • core-ci +1 CI

Issues 1

Files 1

Review log 67

  1. Torben Hansen uploaded patch set 1 09/18/25, 12:36

  2. core-ci voted on patch set 1 V +1 09/18/25, 12:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85118

  3. Oli Bartsch commented on patch set 1 V -1 09/18/25, 14:14

    I'm against making this public as this class is bad practice. PSR-7 responses should be created via PSR-17 ResponseFactories. We should adjust core usages instead to properly create redirect response like: ``` $this->responseFactory->createResponse(303)->withHeader('location', $url); ```
  4. Torben Hansen commented on patch set 1 09/18/25, 16:24

    Reply

    I'm also fine with deprecating `RedirectResponse` and creating something "easy" users can use instead (e.g. `$this->responseFactory->createRedirectResponse($url)`). This however would require to extend `ResponseFactoryInterface` which is breaking. What do you think?
  5. Oli Bartsch commented on patch set 1 09/19/25, 11:39

    Reply

    We can not extend the interface because it's a `Psr\Http\Message\ResponseFactoryInterface`. However what we could do is some kind of wrapper class which internally calls the responseFactory.
  6. Torben Hansen commented on patch set 1 09/30/25, 06:55

    Reply Unresolved

    I see that this rabbit hole goes much deeper than I thought. You originally suggested, users should use the PSR-17 Interface to create responses. This is maybe ok for simple use cases, but comes quickly to its useability-limits, when a developer need to return HTML or JSON, since everything has to be done manually (headers, stream) which currently is handled in our current custom (`@internal`) response classes. So we could provide a helper for developers, which takes care of the parts our internal classes currently provide. Here, I currently see the following possibilities: * New service with helper methods * New helper class with static methods I'm not really sure, which approach is best, but if we go for the service, which has to be injected via DI, we (and extension developers) need to inject the new service everyehere responses are needed. This results in more code and dependencies and developers "lose" an easy way to create responses as the do currently (e.g. one line `new HtmlResponse('html code', 200)` vs. at least two lines for service injection + helper method `$helper->htmlResponse('html code', 200)`). This is less comfortable than e.g. creating responses in Laravel or Symfony, so maybe we are better with a helper class with static methods. In addition to this, we have `TYPO3\CMS\Extbase\Http\ForwardResponse`, which extends `TYPO3\CMS\Core\Http\Response` and is instantiated by just creating a new instance of the object. This class is used in Extbase and can not easily be replaced with a function in a helper class, since the `ForwardResponse` contains several attributes and functions used in extbase. If we go the way to provide a helper class and deprecate all `(*)Response` classes, we can use PSR-17 factories everywhere to create responses. The change is however pretty huge, has wide impact on the extension ecosystem and the benefit of the change may be hard to explain to extension developers. Is this something "worth" working on currently?
  7. Torben Hansen abandoned the change 02/07/26, 09:28

    We keep it as it is