Project

General

Profile

Actions

Bug #99476

closed

Add getRequest to RenderingContextInterface? (>= v11)

Added by Sybille Peters over 1 year ago. Updated over 1 year ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Code Cleanup
Target version:
-
Start date:
2023-01-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

RenderingContextInterface does not contain getRequest().

If extending from AbstractViewHelper and using renderStatic, the function looks like this:

public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{

It should be possible to call $renderingContext->getRequest(), but then checks with phpstan will fail and you would have to check for the class name of the object (which should not really be necessary.

(Previously, it was possible to call $renderingContext->getControllerContext()->getRequest()).


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #99475: Imcomplete deprecation (without trigger etc.) of RenderingContext::getControllerContext and ControllerContext functions (v11)Closed2023-01-06

Actions
Actions #1

Updated by Sybille Peters over 1 year ago

Bloddy hill, the getRequest() function is @internal.

/**
 * @return Request
 * @internal this might change to use a PSR-7 compliant request
 */
public function getRequest(): Request
{

This contradicts the changelog:

Method getRequest() is available in controllers directly, and view-helpers receive the current request by calling RenderingContext->getRequest()

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.5/Deprecation-95139-ExtbaseControllerContext.html#migration

Actions #2

Updated by Sybille Peters over 1 year ago

  • Related to Bug #99475: Imcomplete deprecation (without trigger etc.) of RenderingContext::getControllerContext and ControllerContext functions (v11) added
Actions #3

Updated by Christian Kuhn over 1 year ago

  • Status changed from New to Rejected

Yeah, that situation is a bit unfortunate:
RenderingContextInterface is from fluid standalone. We can't add a method without being breaking in fluid standalone, which would trigger a major release, plus a dependency to psr-7 in fluid standalone.
We also can't extend the interface in core, since that would be liskov contravariant with the view helper interface signatures, so a changing type hints on the VH interfaces is not an option, either.
For now, core has to live with the situation.
Note getRequest() is no longer internal in RenderingContext in v12.

Actions #4

Updated by Sybille Peters over 1 year ago

Christian, Thank you for the explanation!

Actions

Also available in: Atom PDF