Skip to content

Commit ca2da67

Browse files
authored
Merge pull request #2324 from WordPress/feature/core-update-dirname-sniff-handling
2 parents 2c593e4 + 01d23a6 commit ca2da67

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.phpcs.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050

5151
<!-- Linting is done in a separate CI job, no need to duplicate it. -->
5252
<exclude name="Generic.PHP.Syntax"/>
53+
54+
<!-- WPCS still has a PHP 5.4 minimum. -->
55+
<exclude name="Modernize.FunctionCalls.Dirname"/>
5356
</rule>
5457

5558
<!-- Check code for cross-version PHP compatibility. -->

WordPress-Core/ruleset.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,9 @@
923923
<!-- Check that class name references use the correct case. -->
924924
<rule ref="WordPress.WP.ClassNameCase"/>
925925

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

930931
</ruleset>

WordPress-Extra/ruleset.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55

66
<rule ref="WordPress-Core"/>
77

8+
<!-- Silence the "no nested dirnames, use $levels" notice, which is included in Core,
9+
as plugin/themes may still support PHP < 7.0. -->
10+
<rule ref="Modernize.FunctionCalls.Dirname.Nested">
11+
<severity>0</severity>
12+
</rule>
13+
814
<!-- Generic PHP best practices.
915
https://github.com/WordPress/WordPress-Coding-Standards/pull/382 -->
1016
<rule ref="Generic.PHP.DeprecatedFunctions"/>

0 commit comments

Comments
 (0)