This check compares the return type specified in the @return annotation of a function
or method doc comment with the types returned by the function and raises an issue if they
mismatch.
Loading history...
25
*/
26
public function serialize($data) {
27
$xml = new SimpleXMLElement('<result/>');
28
$this->toXml($xml, $data);
29
return $xml->asXML();
30
}
31
32
public function contentType() {
33
return $this->contentType;
34
}
35
36
private function toXml(SimpleXMLElement $object, array $data) {
37
foreach( $data as $key => $value ) {
38
if(is_array($value) ) {
39
if( is_numeric($key) ){
40
$key = 'item'.$key; //dealing with <0/>..<n/> issues
Should the return type not be array|integer|double|string|boolean?
This check compares the return type specified in the @return annotation of a function
or method doc comment with the types returned by the function and raises an issue if they
mismatch.
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.