[wp-trac] [WordPress Trac] #37816: spl_autoload_register() has a shim since 4.6, wp_maybe_use_it()

WordPress Trac noreply at wordpress.org
Wed Aug 24 18:45:53 UTC 2016


#37816: spl_autoload_register() has a shim since 4.6, wp_maybe_use_it()
----------------------------+-------------------
 Reporter:  wonderboymusic  |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  4.7
Component:  Bootstrap/Load  |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-------------------
 WordPress is one of the few remaining PHP projects on this green Earth
 that doesn't lean on Composer in any way. That's fine (?), but since 4.6,
 and the introduction of Requests, there is now a shim for
 `spl_autoload_register()`. Previous arguments against autoloaders were
 mostly based around the fact that SPL can be disabled in PHP installs (it
 can).

 4.6 introduced in autoloader for Requests, because autoloaders make a lot
 of sense. Our naming conventions for classes don't jive with PSR-0 nor
 PSR-4, but Composer generates classmaps when `optimize-autoloader: true`
 is set that just throw a map to the top of the stack that points
 `Namespace\Class => 'file.php'`. We can implement the said classmap
 approach for our classes.

 Patch attached.

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


More information about the wp-trac mailing list