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

WordPress Trac noreply at wordpress.org
Fri Nov 9 23:34:13 UTC 2012


#22400: Remove all, or at least most, uses of extract() within WordPress
--------------------------+------------------------------
 Reporter:  Viper007Bond  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  lowest        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.4.2
 Severity:  minor         |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by ericmann):

 Replying to [comment:2 Viper007Bond]:
 > If I see `$foo` somewhere deep in the function, it's not immediately
 clear if this is a function-set value or a user-supplied value. Yes, I
 probably have to search either way to see where the variable comes from
 but by instead using `$args['foo']`, it's immediately clear that this is a
 configuration argument rather than just a data storage variable.

 I agree.  Additionally, we're finally making huge strides in keeping core
 documented. It's easy to mark up a function signature with phpDoc and
 identify the `$args` array that gets passed in.  Seeing a variable later
 that's not in this signature definition is confusing at best and
 misleading at worst.

 If I see `$foo` in a function, I have to research where it's set.  Is it a
 global?  Did I create it?  Is it the return of another function?

 If I see `$args['foo']`, and I also know that `$args` was passed in
 (because it's in the documentation), there is zero ambiguity.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22400#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list