-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernize/Dirname: respect a passed
php_version
If no `php_version` is passed, the sniff will behave as before. However, is a `php_version` is passed, the sniff will now selectively stay silent depending on the configured PHP and whether the proposed fixes could be applied. Includes additional tests. Includes adding information about the support of the `php_version` config setting to the README docs.
- Loading branch information
Showing
10 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
/* | ||
* This test file is run with php_version set to a value of 50000. | ||
* | ||
* Neither of the fixes the sniff offers will be applied as the PHP version is too low. | ||
*/ | ||
|
||
$path = dirname(__FILE__); | ||
$path = dirname(dirname(__DIR__)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
/* | ||
* This test file is run with php_version set to a value of 50000. | ||
* | ||
* Neither of the fixes the sniff offers will be applied as the PHP version is too low. | ||
*/ | ||
|
||
$path = dirname(__FILE__); | ||
$path = dirname(dirname(__DIR__)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This test file is run with php_version set to a value of 50300. | ||
* | ||
* The `FileConstant` error code should trigger, but the `Nested` error code | ||
* should be ignored as the PHP version is too low. | ||
*/ | ||
|
||
$path = dirname(__FILE__); | ||
$path = dirname(dirname(__DIR__)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This test file is run with php_version set to a value of 50300. | ||
* | ||
* The `FileConstant` error code should trigger, but the `Nested` error code | ||
* should be ignored as the PHP version is too low. | ||
*/ | ||
|
||
$path = __DIR__; | ||
$path = dirname(dirname(__DIR__)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
/* | ||
* This test file is run with php_version set to a value of 70000. | ||
* | ||
* Both of the fixes the sniff offers will be applied as the PHP version allows for it. | ||
*/ | ||
|
||
$path = dirname(__FILE__); | ||
$path = dirname(dirname(__DIR__)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
/* | ||
* This test file is run with php_version set to a value of 70000. | ||
* | ||
* Both of the fixes the sniff offers will be applied as the PHP version allows for it. | ||
*/ | ||
|
||
$path = __DIR__; | ||
$path = dirname(__DIR__, 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This test file is only here to reset the value of the php_version configuration option. | ||
*/ | ||
|
||
dirname($path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters