Skip to content

Commit 10f294d

Browse files
committed
Remove $reponse param of Dispatcher::_invoke().
Use controller's $response property by default.
1 parent c17cc39 commit 10f294d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lib/Cake/Routing/Dispatcher.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function dispatch(CakeRequest $request, CakeResponse $response, $addition
162162
));
163163
}
164164

165-
$response = $this->_invoke($controller, $request, $response);
165+
$response = $this->_invoke($controller, $request);
166166
if (isset($request->params['return'])) {
167167
return $response->body();
168168
}
@@ -174,18 +174,19 @@ public function dispatch(CakeRequest $request, CakeResponse $response, $addition
174174

175175
/**
176176
* Initializes the components and models a controller will be using.
177-
* Triggers the controller action, and invokes the rendering if Controller::$autoRender is true and echo's the output.
178-
* Otherwise the return value of the controller action are returned.
177+
* Triggers the controller action, and invokes the rendering if Controller::$autoRender
178+
* is true and echo's the output. Otherwise the return value of the controller
179+
* action are returned.
179180
*
180181
* @param Controller $controller Controller to invoke
181182
* @param CakeRequest $request The request object to invoke the controller for.
182-
* @param CakeResponse $response The response object to receive the output
183183
* @return CakeResponse the resulting response object
184184
*/
185-
protected function _invoke(Controller $controller, CakeRequest $request, CakeResponse $response) {
185+
protected function _invoke(Controller $controller, CakeRequest $request) {
186186
$controller->constructClasses();
187187
$controller->startupProcess();
188188

189+
$response = $controller->response;
189190
$render = true;
190191
$result = $controller->invokeAction($request);
191192
if ($result instanceof CakeResponse) {

lib/Cake/Test/Case/Routing/DispatcherTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ class TestDispatcher extends Dispatcher {
5757
*
5858
* @param Controller $controller
5959
* @param CakeRequest $request
60-
* @param CakeResponse $response
61-
* @return void
60+
* @return CakeResponse
6261
*/
63-
protected function _invoke(Controller $controller, CakeRequest $request, CakeResponse $response) {
62+
protected function _invoke(Controller $controller, CakeRequest $request) {
6463
$this->controller = $controller;
65-
return parent::_invoke($controller, $request, $response);
64+
return parent::_invoke($controller, $request);
6665
}
6766

6867
/**
@@ -508,7 +507,7 @@ class TestFilterDispatcher extends DispatcherFilter {
508507

509508
/**
510509
* TestFilterDispatcher::beforeDispatch()
511-
*
510+
*
512511
* @param mixed $event
513512
* @return CakeResponse|boolean
514513
*/
@@ -521,7 +520,7 @@ public function beforeDispatch(CakeEvent $event) {
521520

522521
/**
523522
* TestFilterDispatcher::afterDispatch()
524-
*
523+
*
525524
* @param mixed $event
526525
* @return mixed boolean to stop the event dispatching or null to continue
527526
*/

0 commit comments

Comments
 (0)