WordPress.org

Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #22400, comment 2


Ignore:
Timestamp:
11/09/12 23:23:53 (3 years ago)
Author:
Viper007Bond
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22400, comment 2

    v1 v2  
    11Having `$defaults` contain all valid parameters certainly helps a lot but I still think `extract()` is bad. 
    22 
    3 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 more clear that this is a configuration argument rather than just a data storage variable. 
     3If 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. 
    44 
    55I think another question is what's the advantage to using `extract()`? I can't think of any other than saving keystrokes which shouldn't be a valid reason.