1 | <?php |
||
25 | class XmlResponseFormatter extends Component implements ResponseFormatterInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var string the Content-Type header for the response |
||
29 | */ |
||
30 | public $contentType = 'application/xml'; |
||
31 | /** |
||
32 | * @var string the XML version |
||
33 | */ |
||
34 | public $version = '1.0'; |
||
35 | /** |
||
36 | * @var string the XML encoding. If not set, it will use the value of [[Response::charset]]. |
||
37 | */ |
||
38 | public $encoding; |
||
39 | /** |
||
40 | * @var string the name of the root element. If set to false, null or is empty then no root tag should be added. |
||
41 | */ |
||
42 | public $rootTag = 'response'; |
||
43 | /** |
||
44 | * @var string the name of the elements that represent the array elements with numeric keys. |
||
45 | */ |
||
46 | public $itemTag = 'item'; |
||
47 | /** |
||
48 | * @var bool whether to interpret objects implementing the [[\Traversable]] interface as arrays. |
||
49 | * Defaults to `true`. |
||
50 | * @since 2.0.7 |
||
51 | */ |
||
52 | public $useTraversableAsArray = true; |
||
53 | /** |
||
54 | * @var bool if object tags should be added |
||
55 | * @since 2.0.11 |
||
56 | */ |
||
57 | public $useObjectTags = true; |
||
58 | |||
59 | /** |
||
60 | * Formats the specified response. |
||
61 | * @param Response $response the response to be formatted. |
||
62 | */ |
||
63 | 19 | public function format($response) |
|
82 | |||
83 | /** |
||
84 | * @param DOMElement $element |
||
85 | * @param mixed $data |
||
86 | */ |
||
87 | 18 | protected function buildXml($element, $data) |
|
125 | |||
126 | /** |
||
127 | * Formats scalar value to use in XML text node |
||
128 | * |
||
129 | * @param int|string|bool $value |
||
130 | * @return string |
||
131 | * @since 2.0.11 |
||
132 | */ |
||
133 | 17 | protected function formatScalarValue($value) |
|
145 | } |
||
146 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: