|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-01-21 01:21 UTC] tommyhp2 at gmail dot com
-Status: Open
+Status: Closed
[2011-01-21 01:21 UTC] tommyhp2 at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 08:00:01 2025 UTC |
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