interface problem in PHP5

From: Date: Sat, 04 Sep 2004 17:38:43 +0000
Subject: interface problem in PHP5
Groups: php.general 
Request: Send a blank email to php-general+get-195865@lists.php.net to get a copy of this message
Can anuyone describe this error? Compile Error: E:\Source\CMAES\src\include\dom.inc.php line 67 - Declaration of CMAES_DOM_Node_List::item() must be compatible with that of CMAES_DOM_Node_List_Interface::item() // {{{ interface CMAES_DOM_Node_List /** * * @access public */ interface CMAES_DOM_Node_List_Interface {
     function item();
     function search();
     function addItem();
     function removeItem();
} // }}} /** * CMAES_DOM_Node * */ class CMAES_DOM_Node_List implements CMAES_DOM_Node_List_Interface {
    // {{{ properties
    /**
    * Number of elements in node list
    * @var integer
    */
    public $iLength = 0;
    /**
    * Nodes in list
    * @var array
    */
    private $_aNodes = array();
    // }}}
    // {{{ item
     /**
     *  Returns the nth index given in item.
     *
     * @param inte $a_iIndex - index in list
     * @return mixed node object or null if item was not found
     * @access public
     */
    function &item($a_iIndex)
    {
        if (!array_key_exists($a_iIndex, $this->_aNodes)) {
            return null;
        }
        return $this->_aNodes[$a_iIndex];
    }
    // }}}
    // {{{ addItem
     /**
     * Adds new node to the list.
     *
     * @param object $a_oNode - object to add
     * @param int $a_iOffset(optional) - index to put object in
     * @param int $a_iReplace(optional) - number of objects to replace
     * @return void
     * @access public
     */
    function addItem(CMAES_DOM_Node &$a_oNode, $a_iOffset = null, $a_iReplace = 0)
    {
        if (!($a_oNode instanceof CMAES_DOM_Document)) {
            $a_iOffset = ($a_iOffset !== null) ? $a_iOffset : $this->iLength;
            array_splice($this->_aNodes, $a_iOffset, $a_iReplace, array(&$a_oNode));
            $this->iLength = count($this->_aNodes);
        }
    }
    // }}}
    // {{{ removeItem
     /**
     * Removes node from the list and return the removed node
     *
     * @param int $a_iIndex - index to remove
     * @return object removed node
     * @access public
     */
    function &removeItem($a_iIndex)
    {
        // First remove from this node list
        $oOldChild =& $this->_aNodes[$a_iIndex];
        array_splice($this->_aNodes, $a_iIndex, 1);
        $this->iLength = count($this->_aNodes);
        return $oOldChild;
    }
    // }}}
    // {{{ search
     /**
     * search for a node in the list and return node if successful
     *
     * @param object $a_oNode - Node to search for
     * @return int index in list or null if not found
     * @access public
     */
    function search(CMAES_DOM_Node $a_oNode)
    {
        for ($i = 0; $i < $this->iLength; $i++) {
            if ($a_oNode === $this->_aNodes[$i]) {
                return $i;
            }
        }
        return null;
    }
}

« previous php.general (#195865) next »