Skip to content

Commit a8520ae

Browse files
committed
bug symfony#32057 [HttpFoundation] Fix SA/phpdoc JsonResponse (ro0NL)
This PR was squashed before being merged into the 3.4 branch (closes symfony#32057). Discussion ---------- [HttpFoundation] Fix SA/phpdoc JsonResponse | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Commits ------- 270f10c [HttpFoundation] Fix SA/phpdoc JsonResponse
2 parents cfbb5b5 + 270f10c commit a8520ae

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Symfony/Component/HttpFoundation/JsonResponse.php

+14-3
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ public function __construct($data = null, $status = 200, $headers = [], $json =
5555
*
5656
* Example:
5757
*
58-
* return JsonResponse::create($data, 200)
58+
* return JsonResponse::create(['key' => 'value'])
5959
* ->setSharedMaxAge(300);
6060
*
61-
* @param mixed $data The json response data
61+
* @param mixed $data The JSON response data
6262
* @param int $status The response status code
6363
* @param array $headers An array of response headers
6464
*
@@ -70,7 +70,18 @@ public static function create($data = null, $status = 200, $headers = [])
7070
}
7171

7272
/**
73-
* Make easier the creation of JsonResponse from raw json.
73+
* Factory method for chainability.
74+
*
75+
* Example:
76+
*
77+
* return JsonResponse::fromJsonString('{"key": "value"}')
78+
* ->setSharedMaxAge(300);
79+
*
80+
* @param string|null $data The JSON response string
81+
* @param int $status The response status code
82+
* @param array $headers An array of response headers
83+
*
84+
* @return static
7485
*/
7586
public static function fromJsonString($data = null, $status = 200, $headers = [])
7687
{

0 commit comments

Comments
 (0)