WordPress.org

Make WordPress Core

Opened 12 months ago

Last modified 12 months ago

#48962 new enhancement

Start using namespaces in Core

Reported by: taraschr Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords: dev-feedback
Focuses: Cc:

Description

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.

Change History (2)

#1 @taraschr
12 months ago

  • Keywords dev-feedback added
Note: See TracTickets for help on using tickets.