Skip to content

Commit

Permalink
Merge pull request #2324 from WordPress/feature/core-update-dirname-s…
Browse files Browse the repository at this point in the history
…niff-handling
  • Loading branch information
GaryJones committed Jul 26, 2023
2 parents 2c593e4 + 01d23a6 commit ca2da67
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
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

0 comments on commit ca2da67

Please sign in to comment.