[wp-trac] [WordPress Trac] #10861: Clean up constructors and destructors

WordPress Trac wp-trac at lists.automattic.com
Sun Sep 27 16:22:34 UTC 2009


#10861: Clean up constructors and destructors
--------------------------+-------------------------------------------------
 Reporter:  hakre         |       Owner:       
     Type:  defect (bug)  |      Status:  new  
 Priority:  normal        |   Milestone:  2.9  
Component:  General       |     Version:  2.8.4
 Severity:  normal        |    Keywords:       
--------------------------+-------------------------------------------------

Comment(by hakre):

 I see many maintenance issues with the current code but not with the
 proposed changes. {{{parent::WP_Dependencies()}}} is pretty straight
 forward and since the extending class always is aware of the parent class
 (it's hardcoded), there is no need to have that with a variable call. It's
 just useless.

 The "variable" code looks pretty much copied over from some other project
 without propper checking wether it is useable here or not. It might be
 that the other project needs such a flexibility but it's perfectly
 unfitting in these cases here in WP.

 There is just no need to put hacks in where no hack is needed. Each
 extending class knows exactly it's parent and can call without any
 problems the PHP4 constructor. We do not need any PHP5 __construct
 functions at all, PHP5 handles the PHP4 constructors just properly.

 This will also help to migrate the code more properly to PHP5 some day.
 There is no need of a mix of PHP4 and PHP5 constructors. That's just
 overhead. In those cases where this can be corrected without changing much
 code I've made that. I have not checked the {{{*_Walker}}} classes until
 now.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10861#comment:14>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list