Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Bug #6841 factory() shuld by static
Submitted: 2006-02-20 09:13 UTC
From: skr at condero dot com Assigned:
Status: Suspended Package: DB_DataObject (version 1.8.2)
PHP Version: 5.0.4 OS: Linux (Suse 9.3)
Roadmaps: (Not assigned)    
Subscription  


 [2006-02-20 09:13 UTC] skr at condero dot com (Sven Krzyzak)
Description: ------------ The method factory should by static. A Framework with professional ambitions should by follow good patterns of design. And returning of the instance as a reference instead of value is another idea. Test script: --------------- interface CompanyComponent { public static function factory(); public function __destruct(); } interface UserExtension extends CompanyComponent { ... } class AuthUserExtension extends DB_DataObject implements UserExtension { ... public static function factory($param) { $inst = parent :: factory($param); ... return $inst; } ... } AuthUserExtension :: factory("somthing"); Expected result: ---------------- an instance of UserExtension Actual result: -------------- Fatal error: Cannot make non static method DB_DataObject::factory() static in class AuthUserExtension in /home/skr/svn_work_copy/groups/trunk/classes/AuthUserExtension.php on line 5

Comments

 [2006-02-20 13:15 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2007-04-27 13:12 UTC] skr at condero dot com
Welcome to PHP6 In PHP6 however, calling an instance method (not defined using `static`) as a class method (using `class::method()` ) will display an EWarning. Also note that in PHP6, calling a class method (defined using `static`) as an instance method (using `$instance->method()`) will ALSO display an EWarning