Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!!! FEATURE: Dispatcher psr overhaul #3311

Merged
merged 41 commits into from
Sep 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d94562f
!!!FEATURE: Clearer controller pattern
kitsunet Nov 11, 2023
8ee71e9
Controller cleanup
kitsunet Dec 26, 2023
0fcf522
Style and suggestions cleanup
kitsunet Dec 26, 2023
e3fb34b
Tests for SimpleActionController
kitsunet Dec 26, 2023
b12f1df
Fix AjaxWidget dispatching to use new StopActionException::response
kitsunet Dec 27, 2023
3360130
Correct style issues
kitsunet Dec 27, 2023
0689c78
Fix spelling error
kitsunet Dec 28, 2023
465c80b
Merge remote-tracking branch 'origin/9.0' into feature/actioncontroll…
mhsdesign Jan 25, 2024
88f43d5
TASK: Adjust typos and doc of `ControllerInterface`
mhsdesign Jan 25, 2024
03662a7
TASK: Fix `RestController::redirectToUri`
mhsdesign Jan 25, 2024
3df0dbd
Update Neos.Flow/Tests/Functional/Http/Fixtures/Controller/FooControl…
kitsunet Jan 26, 2024
57d8995
TASK: Update `ControllerInterface::processRequest` doc
mhsdesign Jan 25, 2024
f3ba560
TASK: Fix `FooController` test
mhsdesign Jan 26, 2024
e3cdfb4
!!! TASK: Separate `ForwardException` from `StopActionException`
mhsdesign Jan 25, 2024
d507942
!!! TASK: Adjust Signals Dispatcher `beforeControllerInvocation` and …
mhsdesign Jan 26, 2024
c1ce1bc
TASK: Set fix $code of `StopActionException`
mhsdesign Jan 26, 2024
18da350
TASK: Adjust docs of MVC Control flow exceptions
mhsdesign Jan 26, 2024
73d7214
TASK: Rename factory methods of MVC Control flow exceptions
mhsdesign Jan 26, 2024
a59bdaa
Merge pull request #3 from mhsdesign/test-can-i-push-to-christian-que…
kitsunet Jan 26, 2024
554aa08
SpecialResponses become final
kitsunet Jan 27, 2024
82caa27
TASK: Revert introduction of `SimpleActionController`
mhsdesign Feb 3, 2024
c96fd84
TASK: Revert introduction of `SpecialResponsesSupport`
mhsdesign Feb 3, 2024
e540eb3
TASK: Fix phpstan
mhsdesign Feb 3, 2024
52cafdd
Merge pull request #3232 from kitsunet/feature/actioncontroller-simpl…
mhsdesign Feb 6, 2024
d6d083d
TASK: Avoid accessing "global" request, response and arguments in act…
mhsdesign Jan 29, 2024
b959935
WIP: Experiment prefer PsrResponse over ActionResponse
mhsdesign Jan 29, 2024
144a06f
WIP: Adjust tests to use psr response and not action response
mhsdesign Jan 29, 2024
09c24f5
FEATURE: Allow `*Action` to return psr response
mhsdesign Jan 29, 2024
6cc4787
TASK: Adjust `StopActionException::createForResponse` to use psr resp…
mhsdesign Feb 6, 2024
6c13cae
TASK: Properly deprecate ActionResponse
mhsdesign Feb 6, 2024
c3a4a67
TASK: Avoid use of ActionResponse in controller
mhsdesign Feb 6, 2024
09e0dae
TASK: Prefer `new BufferStream()` over `streamFor('')`
mhsdesign Mar 2, 2024
3d32ace
TASK: Widget view helper explicitly merge things
mhsdesign Mar 2, 2024
6229f94
TASK: Allow still to return an `ActionResponse` from a view
mhsdesign Mar 3, 2024
415584b
Merge pull request #3294 from mhsdesign/task/makeActionResponseObsolete
mhsdesign Mar 3, 2024
43964e1
Merge remote-tracking branch 'origin/9.0' into feature/dispatcher-ret…
mhsdesign Mar 3, 2024
0002e5e
TASK: Type $controllerArguments correctly
mhsdesign Mar 3, 2024
f4c5479
Merge remote-tracking branch 'origin/9.0' into feature/dispatcher-ret…
mhsdesign Apr 24, 2024
066748a
TASK: Remove `Neos\Flow\Http\RequestHandler::getHttpResponse`
mhsdesign May 21, 2024
096c9ba
Remove unused use statements
kitsunet Sep 12, 2024
b21bd4b
Merge remote-tracking branch 'origin/9.0' into feature/dispatcher-ret…
mhsdesign Sep 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TASK: Set fix $code of StopActionException
mhsdesign committed Jan 26, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit c1ce1bc064246d85a3f9ab410c1ffad1e31ad3d5
2 changes: 1 addition & 1 deletion Neos.Flow/Classes/Mvc/Controller/AbstractController.php
Original file line number Diff line number Diff line change
@@ -313,7 +313,7 @@ protected function redirectToUri(string|UriInterface $uri, int $delay = 0, int $
}

$response = $this->responseRedirectsToUri($uri, $delay, $statusCode, $this->response);
$this->throwStopActionWithResponse($response, '', 1699716808);
$this->throwStopActionWithResponse($response, '');
}

/**
2 changes: 1 addition & 1 deletion Neos.Flow/Classes/Mvc/Controller/RestController.php
Original file line number Diff line number Diff line change
@@ -138,6 +138,6 @@ protected function redirectToUri(string|UriInterface $uri, int $delay = 0, int $
$response->setContent('');
}

$this->throwStopActionWithResponse($response, '', 1699716808);
$this->throwStopActionWithResponse($response, '');
}
}
9 changes: 4 additions & 5 deletions Neos.Flow/Classes/Mvc/Controller/SpecialResponsesSupport.php
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ protected function responseThrowsStatus(int $statusCode, string $content = '', ?
$response->setContent($content);
}

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

/**
@@ -49,7 +49,7 @@ protected function responseRedirectsToUri(UriInterface $uri, int $delay = 0, int

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

$nextResponse->setStatusCode($statusCode);
@@ -61,13 +61,12 @@ protected function responseRedirectsToUri(UriInterface $uri, int $delay = 0, int
/**
* @param ActionResponse $response
* @param string $message
* @param int $code
* @return never
* @throws StopActionException
*/
protected function throwStopActionWithResponse(ActionResponse $response, string $message = '', int $code = 0): never
protected function throwStopActionWithResponse(ActionResponse $response, string $message = ''): never
{
throw StopActionException::create($response, $message, $code);
throw StopActionException::create($response, $message);
}

/**
5 changes: 2 additions & 3 deletions Neos.Flow/Classes/Mvc/Exception/StopActionException.php
Original file line number Diff line number Diff line change
@@ -38,9 +38,8 @@ private function __construct(string $message, int $code, ?\Throwable $previous,

public static function create(
ActionResponse $response,
string $message,
int $code
string $message
) {
return new self($message, $code, null, $response);
return new self($message, 1558088618, null, $response);
}
}
6 changes: 3 additions & 3 deletions Neos.Flow/Tests/Unit/Mvc/DispatcherTest.php
Original file line number Diff line number Diff line change
@@ -155,7 +155,7 @@ public function dispatchIgnoresStopExceptionsForFirstLevelActionRequests()
$this->mockParentRequest->expects(self::exactly(2))->method('isDispatched')->willReturnOnConsecutiveCalls(false, true);
$this->mockParentRequest->expects(self::once())->method('isMainRequest')->willReturn(true);

$this->mockController->expects(self::atLeastOnce())->method('processRequest')->will(self::throwException(StopActionException::create(new ActionResponse(), '', 0)));
$this->mockController->expects(self::atLeastOnce())->method('processRequest')->will(self::throwException(StopActionException::create(new ActionResponse(), '')));

$this->dispatcher->dispatch($this->mockParentRequest);
}
@@ -168,7 +168,7 @@ public function dispatchCatchesStopExceptionOfActionRequestsAndRollsBackToThePar
$this->mockActionRequest->expects(self::atLeastOnce())->method('isDispatched')->willReturn(false);
$this->mockParentRequest->expects(self::atLeastOnce())->method('isDispatched')->willReturn(true);

$this->mockController->expects(self::atLeastOnce())->method('processRequest')->will(self::throwException(StopActionException::create(new ActionResponse(), '', 0)));
$this->mockController->expects(self::atLeastOnce())->method('processRequest')->will(self::throwException(StopActionException::create(new ActionResponse(), '')));

$this->dispatcher->dispatch($this->mockActionRequest, $this->actionResponse);
}
@@ -187,7 +187,7 @@ public function dispatchContinuesWithNextRequestFoundInAForwardException()

$this->mockController->expects(self::exactly(2))->method('processRequest')
->withConsecutive([$this->mockActionRequest], [$this->mockParentRequest])
->willReturnOnConsecutiveCalls(self::throwException(StopActionException::create(new ActionResponse(), '', 0)), self::throwException($forwardException));
->willReturnOnConsecutiveCalls(self::throwException(StopActionException::create(new ActionResponse(), '')), self::throwException($forwardException));

$this->dispatcher->dispatch($this->mockActionRequest);
}