Bug #53800 [Opn->Csd]: namespace, interfaces and classes

From: Date: Fri, 21 Jan 2011 00:21:50 +0000
Subject: Bug #53800 [Opn->Csd]: namespace, interfaces and classes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-158037@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53800&edit=1 ID: 53800 User updated by: tommyhp2 at gmail dot com Reported by: tommyhp2 at gmail dot com Summary: namespace, interfaces and classes -Status: Open +Status: Closed Type: Bug Package: CGI related Operating System: Windows 2008 R2 PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: sorry ... found my problem. use org\puremvc\php\patterns\observer\Notifier; \N >.> perhaps this should be a request changing \ to / to prevent escaping? Thanks for your time. Previous Comments: ------------------------------------------------------------------------ [2011-01-20 23:53:12] tommyhp2 at gmail dot com Description: ------------ The script works as expected when not using namespace. I get a fatal error on my "class SimpleCommand extends Notifier implements ICommand, INotifier" declaration. Test script: --------------- 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(); Expected result: ---------------- org\puremvc\php\patterns\observer\Notifier::__construct org\puremvc\php\patterns\observer\Notifier::__construct -> org\puremvc\php\patterns\command\SimpleCommand::__construct Actual result: -------------- 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 21 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53800&edit=1

« previous php.bugs (#158037) next »