[wp-trac] [WordPress Trac] #22400: Remove all, or at least most, uses of extract() within WordPress

WordPress Trac noreply at wordpress.org
Fri May 23 18:14:19 UTC 2014


#22400: Remove all, or at least most, uses of extract() within WordPress
-------------------------------------------------+-------------------------
 Reporter:  Viper007Bond                         |       Owner:
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  4.0
Component:  General                              |     Version:  3.4.2
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  westi-likes needs-testing has-patch  |     Focuses:
  needs-unit-tests reporter-feedback             |
-------------------------------------------------+-------------------------
Changes (by wonderboymusic):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 Marking as fixed after ~90 commits. There is only one call to `extract()`
 remaining: `load_template()`. Unless someone has a bulletproof refactor
 that isn't gross, we can leave it.

 The reasons for removing `extract()`:
 * It sucks
 * it obfuscates variable assignment
 * It isn't allowed by Hack - though this really doesn't matter. HHVM will
 still interpret PHP code.
 * In IDEs, all kinds of code standards flags and warnings appear for
 variables being used that seemingly don't exist.
 * Static analysis tools hate them for the same reasons. We don't have to
 be slaves to static analysis, but tooling is great for catching human
 error, and we should attack low-hanging fruit when possible.

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


More information about the wp-trac mailing list