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

Core/Extra: tweak the inclusion of the Modernize.FunctionCalls.Dirname sniff #2324

Merged
merged 1 commit into from
Jul 26, 2023

Commits on Jul 26, 2023

  1. Core/Extra: tweak the inclusion of the `Modernize.FunctionCalls.Dirna…

    …me` sniff
    
    Follow up on 2137
    
    As  WP Core has now dropped support for PHP < 7.0, it can start using the `dirname()` `$levels` parameters.
    Think:
    ```php
    // PHP < 7.0.
    $path = dirname( dirname( dirname( __DIR__ ) ) );
    
    // PHP 7.0+.
    $path = dirname( __DIR__, 3 );
    ```
    
    The `Modernize.FunctionCalls.Dirname` sniff we include also includes a check (and fixer) for that, so we can now include that sniff completely in the `Core` ruleset.
    
    For now, I'm proposing to silence the error code related to the PHP 7.0 modernization opportunity (again) for the `Extra` ruleset as not all plugins/themes will have dropped support for PHP < 7.0 yet.
    
    To be on the safe side, I'm explicitly excluding the whole sniff from the ruleset used for WPCS itself as WPCS still has a PHP 5.4 minimum.
    jrfnl committed Jul 26, 2023
    Configuration menu
    Copy the full SHA
    01d23a6 View commit details
    Browse the repository at this point in the history