Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move "global variable" related utilities to dedicated WPGlobalVariablesHelper #2159

Merged
merged 1 commit into from
Dec 20, 2022

Commits on Dec 19, 2022

  1. Move "global variable" related utilities to dedicated `WPGlobalVariab…

    …lesHelper`
    
    The "global variable" related utilities are only used by a small number of sniffs, so are better placed in a dedicated class.
    
    This commit moves the `$wp_globals` property to a new `WordPressCS\WordPress\Helpers\WPGlobalVariablesHelper` and starts using that class in the relevant sniffs.
    
    Note:
    * The property is now `private` (and `static`).
        This protects the property against inadvertent changes.
    * Access to the property can be obtained via the new `WPGlobalVariablesHelper::get_names()` method.
    * Alternatively, the new `WPGlobalVariablesHelper::is_wp_global()` method can be used to check is a given variable name is the name of a WP global variable.
    
    Related to 1465
    jrfnl committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    38152a4 View commit details
    Browse the repository at this point in the history