Skip to content

Commit acdef3f

Browse files
author
Dominik Liebler
committed
fixed return type of RendererInterface
1 parent 3fcf860 commit acdef3f

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

Structural/Decorator/RenderInJson.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ class RenderInJson extends Decorator
1010
/**
1111
* render data as JSON.
1212
*
13-
* @return mixed|string
13+
* @return string
1414
*/
1515
public function renderData()
1616
{
17-
$output = $this->wrapped->renderData();
18-
19-
return json_encode($output);
17+
return json_encode($this->wrapped->renderData());
2018
}
2119
}

Structural/Decorator/RenderInXml.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,15 @@ class RenderInXml extends Decorator
1010
/**
1111
* render data as XML.
1212
*
13-
* @return mixed|string
13+
* @return string
1414
*/
1515
public function renderData()
1616
{
17-
$output = $this->wrapped->renderData();
18-
1917
// do some fancy conversion to xml from array ...
2018

2119
$doc = new \DOMDocument();
2220

23-
foreach ($output as $key => $val) {
21+
foreach ($this->wrapped->renderData() as $key => $val) {
2422
$doc->appendChild($doc->createElement($key, $val));
2523
}
2624

Structural/Decorator/RendererInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface RendererInterface
1010
/**
1111
* render data.
1212
*
13-
* @return mixed
13+
* @return string
1414
*/
1515
public function renderData();
1616
}

0 commit comments

Comments
 (0)