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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@

<!-- Linting is done in a separate CI job, no need to duplicate it. -->
<exclude name="Generic.PHP.Syntax"/>

<!-- WPCS still has a PHP 5.4 minimum. -->
<exclude name="Modernize.FunctionCalls.Dirname"/>
</rule>

<!-- Check code for cross-version PHP compatibility. -->
Expand Down
5 changes: 3 additions & 2 deletions WordPress-Core/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -923,8 +923,9 @@
<!-- Check that class name references use the correct case. -->
<rule ref="WordPress.WP.ClassNameCase"/>

<!-- Check that __DIR__ is favoured over dirname(__FILE__).
<!-- Check that __DIR__ is favoured over dirname(__FILE__)
and that dirname( __DIR__, $levels ) is favoured over nested calls to dirname().
See: https://core.trac.wordpress.org/ticket/48082 -->
<rule ref="Modernize.FunctionCalls.Dirname.FileConstant"/>
<rule ref="Modernize.FunctionCalls.Dirname"/>

</ruleset>
6 changes: 6 additions & 0 deletions WordPress-Extra/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

<rule ref="WordPress-Core"/>

<!-- Silence the "no nested dirnames, use $levels" notice, which is included in Core,
as plugin/themes may still support PHP < 7.0. -->
<rule ref="Modernize.FunctionCalls.Dirname.Nested">
<severity>0</severity>
</rule>

<!-- Generic PHP best practices.
https://github.com/WordPress/WordPress-Coding-Standards/pull/382 -->
<rule ref="Generic.PHP.DeprecatedFunctions"/>
Expand Down
Loading