possible namespace bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux