Skip to content

Commit

Permalink
TASK: Make SpecialResponsesSupport static to avoid accidentally acc…
Browse files Browse the repository at this point in the history
…essing any state
  • Loading branch information
mhsdesign committed Jan 30, 2024
1 parent 57170ee commit 695ce85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Neos.Flow/Classes/Mvc/Controller/SpecialResponsesSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ trait SpecialResponsesSupport
* @return never
* @throws StopActionException
*/
final protected function responseThrowsStatus(int $statusCode, string $content = '', ?ActionResponse $response = null): never
final protected static function responseThrowsStatus(int $statusCode, string $content = '', ?ActionResponse $response = null): never
{
$response = $response ?? new ActionResponse;

Expand All @@ -30,7 +30,7 @@ final protected function responseThrowsStatus(int $statusCode, string $content =
$response->setContent($content);
}

$this->throwStopActionWithResponse($response, $content);
self::throwStopActionWithResponse($response, $content);
}

/**
Expand All @@ -43,13 +43,13 @@ final protected function responseThrowsStatus(int $statusCode, string $content =
* @return ActionResponse
* @throws StopActionException
*/
final protected function responseRedirectsToUri(UriInterface $uri, int $delay = 0, int $statusCode = 303, ?ActionResponse $response = null): ActionResponse
final protected static function responseRedirectsToUri(UriInterface $uri, int $delay = 0, int $statusCode = 303, ?ActionResponse $response = null): ActionResponse
{
$nextResponse = $response !== null ? clone $response : new ActionResponse();

if ($delay < 1) {
$nextResponse->setRedirectUri($uri, $statusCode);
$this->throwStopActionWithResponse($nextResponse, '');
self::throwStopActionWithResponse($nextResponse, '');
}

$nextResponse->setStatusCode($statusCode);
Expand All @@ -64,7 +64,7 @@ final protected function responseRedirectsToUri(UriInterface $uri, int $delay =
* @return never
* @throws StopActionException
*/
final protected function throwStopActionWithResponse(ActionResponse $response, string $details = ''): never
final protected static function throwStopActionWithResponse(ActionResponse $response, string $details = ''): never
{
throw StopActionException::createForResponse($response, $details);
}
Expand All @@ -80,7 +80,7 @@ final protected function throwStopActionWithResponse(ActionResponse $response, s
* @return never
* @throws ForwardException
*/
final protected function forwardToRequest(ActionRequest $request): never
final protected static function forwardToRequest(ActionRequest $request): never
{
$nextRequest = clone $request;
throw ForwardException::createForNextRequest($nextRequest, '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ abstract class AbstractWidgetController extends ActionController
* Handles a request. The result output is returned by altering the given response.
*
* @param ActionRequest $request The request object
* @return ActionResponse $response The response, modified by this handler
* @return ActionResponse The response, modified by this handler
* @throws WidgetContextNotFoundException
* @throws InvalidActionVisibilityException
* @throws InvalidArgumentTypeException
Expand Down

0 comments on commit 695ce85

Please sign in to comment.