Model public method throws CMapIterator warning I have a strange problem with the following public method on a model.

public function getAttributes()
{
    return $this-&gt;getId() . $this-&gt;getStyle() . $this-&gt;getDataAttributes();
}


CMapIterator warns with the following array_keys() expects parameter 1 to be array, string given

But if I alter it to

public function getAttributes()
{
    return array($this-&gt;getId() . $this-&gt;getStyle() . $this-&gt;getDataAttributes())[0];
}


Everybody is happy. It's late and I'm probably shouldn't be coding but any thoughts on the issue would be much appreciated.

Here is the complete model for reference...

namespace Craft;

class Core_CodeModel extends BaseModel
{
    /**
     * @return array
     */
    protected function defineAttributes()
    {
        return array_merge(parent::defineAttributes(), array(
            'cssId' =&gt; array(AttributeType::String),
            'cssClass' =&gt; array(AttributeType::String),
            'style' =&gt; array(AttributeType::String),
            'dataAttributes' =&gt; array(AttributeType::Mixed),
        ));
    }

    public function getDataAttributes()
    {
        return is_array($this-&gt;dataAttributes) ? ' ' . craft()-&gt;core_code-&gt;joinDataAttributes($this-&gt;dataAttributes) : '';
    }

    public function getId()
    {
        return !empty($this-&gt;cssId) ? ' id="' . $this-&gt;cssId . '"' : '';
    }

    public function getStyle()
    {
        return !empty($this-&gt;style) ? ' style="' . str_replace(array("\r", "\n"), '', $this-&gt;style) . '"' : '';
    }

    public function getAttributes()
    {
        return $this-&gt;getId() . $this-&gt;getStyle() . $this-&gt;getDataAttributes();
    }

}
User error. It's a naming collision with the getAttributes method within my model and the CModel class.