[wp-trac] [WordPress Trac] #48962: Start using namespaces in Core

WordPress Trac noreply at wordpress.org
Fri Dec 13 09:39:16 UTC 2019


#48962: Start using namespaces in Core
-------------------------+-----------------------------
 Reporter:  taraschr     |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 After moving WordPress minimum PHP version to 5.6 with plans for 7.x there
 was a big reason to upgrade core to modern PHP-development approaches.

 The biggest advantage of namespaces is autoloading. Nowadays many plugin
 developers using Composer or their own autoloaders in every plugin. Some
 part of developers just "include(_once)" everything. And Composer is more
 preferable solution.

 But it is a big problem. Many plugins are using their local directory
 autoloader/composer. And that can be easily solved by using Composer in
 WordPress distibution. Composer can simplify work with dependecies and
 plugin updates or even WordPress updates.

 I don't think that WordPress need own autoloader when in PHP-world exists
 de-facto standard in face of Composer. But it is just my personal opinion.

 There are no extraordinary problems to upgrade code to namespace basis. It
 can be done by some script. To avoid BC changes we need just use
 \class_alias() for namespaced classes to make copy in global namespace.
 Old class-files can be marked as deprecated.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48962>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list