Skip to content

Commit a41458f

Browse files
authored
Merge pull request #1918 from nowackipawel/patch-55
JSONFormatter
2 parents ca29a3b + c1b51bd commit a41458f

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

system/Format/FormatterInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ interface FormatterInterface
5151
*
5252
* @return mixed
5353
*/
54-
public function format(array $data);
54+
public function format($data);
5555
}

system/Format/JSONFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ class JSONFormatter implements FormatterInterface
5151
*
5252
* @param $data
5353
*
54-
* @return mixed
54+
* @return string|bool (JSON string | false)
5555
*/
56-
public function format(array $data)
56+
public function format($data)
5757
{
5858
$options = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES;
5959

system/Format/XMLFormatter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ class XMLFormatter implements FormatterInterface
5050
*
5151
* @param $data
5252
*
53-
* @return mixed
53+
* @return string|bool (XML string | false)
5454
*/
55-
public function format(array $data)
55+
public function format($data)
5656
{
5757
// SimpleXML is installed but default
5858
// but best to check, and then provide a fallback.
@@ -66,7 +66,7 @@ public function format(array $data)
6666

6767
$output = new \SimpleXMLElement('<?xml version="1.0"?><response></response>');
6868

69-
$this->arrayToXML($data, $output);
69+
$this->arrayToXML((array)$data, $output);
7070

7171
return $output->asXML();
7272
}

0 commit comments

Comments
 (0)