merged branch Crell/response-chain-prepare (PR #3954)

Commits
-------

a0d047b Return  from Response::prepare() so that the method may be chained.

Discussion
----------

Return  from Response::prepare() so that the method may be chained.

Currently, Response::prepare() returns nothing, ever.  That's such a waste.  This one-liner returns $this, so that the method may be chained.  That allows for, for instance:

$kernel->handle($request)->prepare($request)->send();

---------------------------------------------------------------------------

by Crell at 2012-04-15T23:48:44Z

Done and done.

---------------------------------------------------------------------------

by vicb at 2012-04-16T06:05:08Z

Please update e05fbf19a9/src/Symfony/Component/HttpFoundation/StreamedResponse.php (L77) and squash your commits. thanks.

---------------------------------------------------------------------------

by Crell at 2012-04-17T00:26:07Z

Fixed and squished.
This commit is contained in:
Fabien Potencier 2012-04-18 09:08:22 +02:00
commit 0bfeda6b72
2 changed files with 5 additions and 1 deletions

View File

@ -198,6 +198,8 @@ class Response
* the Request that is "associated" with this Response.
*
* @param Request $request A Request instance
*
* @return Response The current response.
*/
public function prepare(Request $request)
{
@ -237,6 +239,8 @@ class Response
$headers->set('Content-Length', $length);
}
}
return $this;
}
/**

View File

@ -82,7 +82,7 @@ class StreamedResponse extends Response
$this->headers->set('Cache-Control', 'no-cache');
parent::prepare($request);
return parent::prepare($request);
}
/**