[HttpFoundation] Fix SA/phpdoc JsonResponse

This commit is contained in:
Roland Franssen 2019-06-15 08:54:32 +02:00 committed by Fabien Potencier
parent cfbb5b50b1
commit 270f10cc81

View File

@ -55,10 +55,10 @@ class JsonResponse extends Response
* *
* Example: * Example:
* *
* return JsonResponse::create($data, 200) * return JsonResponse::create(['key' => 'value'])
* ->setSharedMaxAge(300); * ->setSharedMaxAge(300);
* *
* @param mixed $data The json response data * @param mixed $data The JSON response data
* @param int $status The response status code * @param int $status The response status code
* @param array $headers An array of response headers * @param array $headers An array of response headers
* *
@ -70,7 +70,18 @@ class JsonResponse extends Response
} }
/** /**
* Make easier the creation of JsonResponse from raw json. * Factory method for chainability.
*
* Example:
*
* return JsonResponse::fromJsonString('{"key": "value"}')
* ->setSharedMaxAge(300);
*
* @param string|null $data The JSON response string
* @param int $status The response status code
* @param array $headers An array of response headers
*
* @return static
*/ */
public static function fromJsonString($data = null, $status = 200, $headers = []) public static function fromJsonString($data = null, $status = 200, $headers = [])
{ {