Review main Merged

69545[FEATURE] Extbase Request implements ServerRequestInterface

Christian Kuhn CR +2 V +2 Expert +1200 −410 updated 10/01/21, 08:32

Commit message

The patch changes the extbase Mvc/Request to implement
PSR-7 ServerRequestInterface: The former extbase request
details like 'controllerAction' are changed to an
PSR-7 attribute and the Request class is now a
decorator - it receives the original PSR-7 request
as constructor argument, then implements both the
extbase RequestInterface plus PSR-7 ServerRequestInterface.

This way, the Request object itself does not hold
state (except the original request), but channels
all get* and with* calls to the PSR-7 request object.
This avoids creating a new standalone object and moving
all data from the PSR-7 object into the new object.

The patch is relatively conservative. The extbase
related set* methods are kept even though they're
all @internal and violate immutability, and various
method signatures are not adapted towards strict
typing, yet. The reason for that are various
chain- and loop dependencies especially in fluid view
that should be solved with single patches before extbase
Request can be streamlined further. Current usages also
rely on fallback layers within __construct(), which can
be solved when consuming places are adapted - The patch
would have become much bigger if that would be mixed in.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • core-ci +1 CI

Issues 1

Files 8

Review log 1728

Show 23 earlier messages
  1. Christian Kuhn uploaded patch set 1 06/23/21, 16:20

  2. core-ci voted on patch set 1 V -1 06/23/21, 16:23 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12696

  3. Christian Kuhn uploaded patch set 2 06/23/21, 17:00

  1. core-ci voted on patch set 2 V -1 06/23/21, 19:05 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12698

  2. Christian Kuhn uploaded patch set 3 06/24/21, 14:50

  3. core-ci voted on patch set 3 V -1 06/24/21, 14:59 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12710

  4. Christian Kuhn uploaded patch set 4 06/24/21, 17:41

  5. core-ci voted on patch set 4 V -1 06/24/21, 17:53 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12719

  6. core-ci commented on patch set 4 06/24/21, 18:23 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12719

  7. Christian Kuhn uploaded patch set 5 06/25/21, 11:47

  8. core-ci voted on patch set 5 V -1 06/25/21, 11:49 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12731

  9. Christian Kuhn uploaded patch set 6 06/25/21, 11:58

  10. core-ci voted on patch set 6 V +1 06/25/21, 12:10 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12732

  11. Christian Kuhn uploaded patch set 7 06/28/21, 14:33

  12. core-ci voted on patch set 7 V +1 06/28/21, 14:44 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12774

  13. Christian Kuhn uploaded patch set 8 06/29/21, 08:50

  14. core-ci voted on patch set 8 V +1 06/29/21, 09:02 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12789

  15. Oli Bartsch commented on patch set 8 06/29/21, 10:30

    ExtbaseRequestParameters.php:1

    Should we add strict types? Also a lot of methods do not declare proper return types etc.

    ExtbaseRequestParameters.php:491

    This method is unused and also does not seem to make sense here.

    ExtbaseRequestParameters.php:504

    This method is unused as it's now implemented twice, here and in the Mvc/Request.

    ExtbaseRequestParameters.php:521

    This method is unused as it's now implemented twice, here and in the Mvc/Request.

    Request.php:36

    Something missing here?

    Request.php:51

    Is there a reason to not create a "real" object using the factory here?

    Request.php:58

    Is there a reason to not create a "real" object using the factory here?

    RequestTest.php:40

    Why do we remove this test? Exception is still thrown.

    RequestTest.php:75

    Why do we remove this test? Does this functionality not longer exist?
  16. Christian Kuhn commented on patch set 8 06/29/21, 11:03

    ExtbaseRequestParameters.php:1 Reply

    yes. but not now. Breaks to much, would make the patch far too huge.

    ExtbaseRequestParameters.php:491 Reply

    true - forgot about this one. thx.

    ExtbaseRequestParameters.php:504 Reply

    true. can be dropped here.

    ExtbaseRequestParameters.php:521 Reply

    true. can be dropped here.

    Request.php:36 Reply

    haha. nice.

    Request.php:51 Reply

    I'd say that's a fallback that will vanish (soon) anyways, it's pretty much core-internal when there is no TYPO3_REQUEST at all (just install tool). Imho ok'ish enough to work with an empty object for now.

    Request.php:58 Reply

    I'd say that's a fallback that will vanish (soon) anyways, it's pretty much core-internal when there is no TYPO3_REQUEST at all (just install tool). Imho ok'ish enough to work with an empty object for now.

    RequestTest.php:40 Reply

    On ExtbaseRequestParameters: public function setArgument(string $argumentName, $value): self so int is not allowed anymore and the empty string scenario is tested belowe.

    RequestTest.php:75 Reply

    it's ugly and does not make much sense. setArgument() is tested without mock with various other scenarios already.
  17. Christian Kuhn uploaded patch set 9 06/29/21, 11:03

  18. core-ci voted on patch set 9 V -1 06/29/21, 11:05 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12796

  19. Christian Kuhn uploaded patch set 10 06/29/21, 11:18

  20. core-ci voted on patch set 10 V +1 06/29/21, 11:26 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12797

  21. Oli Bartsch commented on patch set 10 06/29/21, 11:32

    Request.php:51 Reply

    Got the "will vanish soon" part, therefore it's not that important to me in this case. Generally, I still think a factory should be preferred over new() - as soon as such exist. Especially because we could simply use the static ServerRequestFactory::fromGlobals() here.

    RequestTest.php:75 Reply

    Actually this does not test setArgument(), but setArguments(). However, I'm fine with removing it for now as this does not really test setArguments() functionality, but only ensures setArgument() is called internally.
  22. Oli Bartsch voted on patch set 10 V +1 CR +1 06/29/21, 13:34

  23. Benni Mack voted on patch set 10 V +2 CR +2 06/30/21, 13:28

  24. Benni Mack merged patch set 11 06/30/21, 13:28

  25. Benjamin Franzke commented on patch set 11 10/01/21, 08:32

    Request.php:86 Unresolved

    I think this is misleading as it's not the original server request, please see https://review.typo3.org/c/Packages/TYPO3.CMS/+/71396 which cleans that up