Skip to content

Commit

Permalink
bug #32057 [HttpFoundation] Fix SA/phpdoc JsonResponse (ro0NL)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 3.4 branch (closes #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
  • Loading branch information
fabpot committed Jun 16, 2019
2 parents cfbb5b5 + 270f10c commit a8520ae
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Symfony/Component/HttpFoundation/JsonResponse.php
Expand Up @@ -55,10 +55,10 @@ public function __construct($data = null, $status = 200, $headers = [], $json =
*
* Example:
*
* return JsonResponse::create($data, 200)
* return JsonResponse::create(['key' => 'value'])
* ->setSharedMaxAge(300);
*
* @param mixed $data The json response data
* @param mixed $data The JSON response data
* @param int $status The response status code
* @param array $headers An array of response headers
*
Expand All @@ -70,7 +70,18 @@ public static function create($data = null, $status = 200, $headers = [])
}

/**
* 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 = [])
{
Expand Down

0 comments on commit a8520ae

Please sign in to comment.