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 is_token_namespaced() utility method to dedicated ContextHelper + minor simplifications #2227

Merged
merged 2 commits into from
Apr 19, 2023

Commits on Apr 19, 2023

  1. Move is_token_namespaced() utility method to dedicated ContextHelper

    The `is_token_namespaced()` utility method is only used by a small set of sniffs, so is better placed in a dedicated class.
    
    This commit moves the `is_token_namespaced()` method to the new `WordPressCS\WordPress\Helpers\ContextHelper` class and starts using that class in the relevant sniffs.
    
    Related to 1465
    
    This method is tested via the `WordPress.WP.DiscouragedFunctions` sniff.
    jrfnl committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    02672af View commit details
    Browse the repository at this point in the history
  2. ContextHelper::is_token_namespaced(): minor simplifications

    * A non-inline HTML token will always have another non-empty token before it, if nothing else, the PHP open tag, so checking if `$prev` is `false` is redundant.
    * Same for the second time this is done, as the same applies for the `T_NS_SEPARATOR` token.
    jrfnl committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    16da3db View commit details
    Browse the repository at this point in the history