[wp-trac] [WordPress Trac] #33413: most PHP classes should be in their own file

WordPress Trac noreply at wordpress.org
Wed Aug 19 02:53:32 UTC 2015


#33413: most PHP classes should be in their own file
----------------------------+--------------------
 Reporter:  wonderboymusic  |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  4.4
Component:  General         |     Version:  trunk
 Severity:  normal          |  Resolution:
 Keywords:  dev-feedback    |     Focuses:
----------------------------+--------------------

Comment (by jmichaelward):

 Replying to [comment:1 pento]:
 > I'd probably add a block to include the classes in their original
 location if they're undefined, in case people are manually including
 individual files.
 >
 > ie, in `query.php`:
 >
 > {{{
 > if ( ! class_exists( 'WP_Query' ) ) {
 >     require( ABSPATH . WPINC . '/class-wp-query.php' );
 > }
 > }}}

 I strongly agree with the premise of this ticket, and I also concur with
 @pento's concern above, with regard to making sure classes that are moved
 out of their original files can still be referenced by existing codebases.

 With regard to coding standards, whether or not WordPress as an open-
 source project wants to adopt the PSR-1 standards, I have noticed from
 digging through the codebase a bit recently that there is quite a bit of
 code that fails to adhere to WordPress's own standards. I think it's
 worthy of discussion whether that's something to address for 4.4 (and
 future releases), as there are some code quality issues throughout core
 that could benefit from cleanup/simplification (such as ensuring braces
 always surround conditional blocks, not doing an if { return $this; } else
 { return $that; } etc. I'll dig around and see if there's already a ticket
 about this, and if not, I'll open one.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33413#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list