Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/Format/FormatterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface FormatterInterface
/**
* Takes the given data and formats it.
*
* @param array<array-key, mixed>|object|string $data
* @param mixed $data
*
* @return false|non-empty-string
*/
Expand Down
2 changes: 1 addition & 1 deletion system/Format/JSONFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class JSONFormatter implements FormatterInterface
/**
* Takes the given data and formats it.
*
* @param array<array-key, mixed>|object|string $data
* @param mixed $data
*
* @return false|non-empty-string
*/
Expand Down
2 changes: 1 addition & 1 deletion system/Format/XMLFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class XMLFormatter implements FormatterInterface
/**
* Takes the given data and formats it.
*
* @param array<array-key, mixed>|object|string $data
* @param mixed $data
*
* @return false|non-empty-string
*/
Expand Down
4 changes: 2 additions & 2 deletions system/HTTP/ResponseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function setContentType(string $mime, string $charset = 'UTF-8');
/**
* Converts the $body into JSON and sets the Content Type header.
*
* @param array<array-key, mixed>|object|string $body
* @param mixed $body
*
* @return $this
*/
Expand All @@ -218,7 +218,7 @@ public function getJSON();
/**
* Converts $body into XML, and sets the correct Content-Type.
*
* @param array<array-key, mixed>|string $body
* @param mixed $body
*
* @return $this
*/
Expand Down
8 changes: 4 additions & 4 deletions system/HTTP/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function setContentType(string $mime, string $charset = 'UTF-8')
/**
* Converts the $body into JSON and sets the Content Type header.
*
* @param array<array-key, mixed>|object|string $body
* @param mixed $body
*
* @return $this
*/
Expand Down Expand Up @@ -201,7 +201,7 @@ public function getJSON()
/**
* Converts $body into XML, and sets the correct Content-Type.
*
* @param array<array-key, mixed>|string $body
* @param mixed $body
*
* @return $this
*/
Expand Down Expand Up @@ -234,8 +234,8 @@ public function getXML()
* Handles conversion of the data into the appropriate format,
* and sets the correct Content-Type header for our response.
*
* @param array<array-key, mixed>|object|string $body
* @param string $format Valid: json, xml
* @param mixed $body
* @param string $format Valid: json, xml
*
* @return false|string
*
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Test/TestResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public function testGetJSONEmptyJSON(): void
public function testGetJSONFalseJSON(): void
{
$this->getTestResponse('<h1>Hello World</h1>');
$this->response->setJSON(false, true); // @phpstan-ignore argument.type (Needed for testing)
$this->response->setJSON(false, true);

// this should be FALSE - json_encode(false)
$this->assertSame('false', $this->testResponse->getJSON());
Expand All @@ -323,7 +323,7 @@ public function testGetJSONFalseJSON(): void
public function testGetJSONTrueJSON(): void
{
$this->getTestResponse('<h1>Hello World</h1>');
$this->response->setJSON(true, true); // @phpstan-ignore argument.type (Needed for testing)
$this->response->setJSON(true, true);

// this should be TRUE - json_encode(true)
$this->assertSame('true', $this->testResponse->getJSON());
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/changelogs/v4.7.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Message Changes
Changes
*******

- **Response:** ``setJSON()`` and ``setXML()``, and the ``FormatterInterface::format()`` contract implemented by ``JSONFormatter`` and ``XMLFormatter``, now type their body/data parameter as ``mixed`` instead of ``array|object|string``, matching what they already accepted at runtime (e.g., scalars and ``bool``).

************
Deprecations
************
Expand Down
Loading