possible namespace bug?

From: Date: Thu, 20 Jan 2011 22:33:54 +0000
Subject: possible namespace bug?
Groups: php.general 
Request: Send a blank email to php-general+get-310926@lists.php.net to get a copy of this message
Hi folks, I thought I try implementing namesapce on one the ported apps I did a while back but ran into a problem. First the code: //namespace org\puremvc\php\interfaces; interface ICommand { function execute(INotification $notification); } interface INotifier { function sendNotification($notificationName, $body = null, $type = null); } //-------------------------------------------------------------------------- --- //namespace org\puremvc\php\patterns\observer; //use org\puremvc\php\interfaces\INotifier; class Notifier implements INotifier { public function __construct() { echo __METHOD__; } public function sendNotification($notificationName, $body = null, $type = null) { } } //-------------------------------------------------------------------------- --- //namespace org\puremvc\php\patterns\command; //use org\puremvc\php\interfaces\ICommand; //use org\puremvc\php\interfaces\INotifier; //use org\puremvc\php\patterns\observer\Notifier; class SimpleCommand extends Notifier implements ICommand, INotifier { public function __construct() { parent::__construct(); echo ' -> '; echo __METHOD__; } function execute(INotification $notification) { } } //-------------------------------------------------------------------------- --- //echo '<br/>'; new \org\puremvc\php\patterns\observer\Notifier(); //echo '<br/>'; new \org\puremvc\php\patterns\command\SimpleCommand(); The above works as expected without namespace. When I uncomment the lines namespace/use, I get this error: Fatal error: Declaration of org\puremvc\php\patterns\command\SimpleCommand::execute() must be compatible with that of org\puremvc\php\interfaces\ICommand::execute() on line 30. Line 30 is the class SimpleCommand declaration. Anyone having similar problems? My platform is PHP 5.3.5 VC9 NTS as FastCGI on Win08r2 x64. Thanks, Tommy

« previous php.general (#310926) next »