Re: interface problem in PHP5

From: Date: Sat, 04 Sep 2004 19:48:47 +0000
Subject: Re: interface problem in PHP5
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-195875@lists.php.net to get a copy of this message
"Erik franzén" <erik@nordicaudi.com> wrote in message news:20040904173846.53823.qmail@pb1.pair.com... > 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(); I think you have to also define the arguments you want to use for item() in your interface: function item($a_iIndex); > 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) Are you sure you need '&' here? Shouldn't PHP5 pass all variables by reference on default? Regards, Torsten Roehr

« previous php.general (#195875) next »