[wp-trac] [WordPress Trac] #10471: Phase out the use of the global keyword
WordPress Trac
wp-trac at lists.automattic.com
Thu Jul 23 13:05:49 UTC 2009
#10471: Phase out the use of the global keyword
----------------------------+-----------------------------------------------
Reporter: prettyboymp | Owner: markjaquith
Type: task (blessed) | Status: new
Priority: normal | Milestone: Unassigned
Component: Canonical | Version:
Severity: trivial | Keywords: global
----------------------------+-----------------------------------------------
I'd like to request phasing out the use of the global keyword in exchange
for get current instance methods. There are a couple reasons for
this:[[BR]]
1. Help reduce development errors by reducing the risk of variable name
conflicts. I've often run into issues where I will name a local variable
something before calling a core function that uses a global variable named
the same thing. [[BR]]
2. Clean up duplicate code. Lines like the below would only need to
exist in the get method.
{{{
global $wp_styles;
if ( !is_a($wp_styles, 'WP_Styles') ) $wp_styles = new WP_Styles();
}}}
When doing this, the super globals would still need to be available for
backwards compatibility.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10471>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list