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

Array sniffs: ignore short lists #1780

Merged
merged 2 commits into from
Jul 28, 2019

Commits on Jul 27, 2019

  1. Sniff: Add new is_short_list() utility method

    New utility method to determine whether a _short array_ token is in actual fact representing a PHP 7.1+ short list.
    
    This method will be short-lived in WPCS as it will be introduced in WPCS 3.5.0 and can be deprecated once the minimum required PHPCS version goes up.
    jrfnl committed Jul 27, 2019
    Configuration menu
    Copy the full SHA
    bc24df5 View commit details
    Browse the repository at this point in the history
  2. Array sniffs: ignore short lists

    While we should probably define rules for long/short list constructs, WPCS at this time, does not have a opinion on the formatting of these.
    
    The `Arrays` sniffs, however, would all treat _short lists_ as if they were _short arrays_ and apply the array rules on them.
    
    This PR fixes this by bowing out early if a short array is in actual fact a short list.
    
    Includes unit tests in each of the sniffs in the `Arrays` category affected by this issue.
    
    Fixes 1692
    jrfnl committed Jul 27, 2019
    Configuration menu
    Copy the full SHA
    ab53976 View commit details
    Browse the repository at this point in the history