Phase out the use of the global keyword
|Reported by:||prettyboymp||Owned by:|
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:
- 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.
- 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.
Change History (3)
- Component changed from Canonical to General
- Keywords back-compat added
- Milestone changed from Unassigned to Future Release
- Owner markjaquith deleted
- Type changed from task (blessed) to feature request
- Version set to 2.9