Skip to content

Commit 1a68116

Browse files
committed
Merge branch 'feature/3388-tweaks-for-wsl-support' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents 2f6db41 + f0c1acd commit 1a68116

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Config.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
use PHP_CodeSniffer\Exceptions\DeepExitException;
1616
use PHP_CodeSniffer\Exceptions\RuntimeException;
17+
use PHP_CodeSniffer\Util\Common;
1718

1819
/**
1920
* Stores the configuration used to run PHPCS and PHPCBF.
@@ -363,7 +364,7 @@ public function __construct(array $cliArgs=[], $dieOnUnknownArg=true)
363364

364365
$lastDir = $currentDir;
365366
$currentDir = dirname($currentDir);
366-
} while ($currentDir !== '.' && $currentDir !== $lastDir && @is_readable($currentDir) === true);
367+
} while ($currentDir !== '.' && $currentDir !== $lastDir && Common::isReadable($currentDir) === true);
367368
}//end if
368369

369370
if (defined('STDIN') === false
@@ -1656,7 +1657,7 @@ public static function getAllConfigData()
16561657
return [];
16571658
}
16581659

1659-
if (is_readable($configFile) === false) {
1660+
if (Common::isReadable($configFile) === false) {
16601661
$error = 'ERROR: Config file '.$configFile.' is not readable'.PHP_EOL.PHP_EOL;
16611662
throw new DeepExitException($error, 3);
16621663
}

src/Util/Common.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ public static function isPharFile($path)
6060
*/
6161
public static function isReadable($path)
6262
{
63-
if (is_readable($path) === true) {
63+
if (@is_readable($path) === true) {
6464
return true;
6565
}
6666

67-
if (file_exists($path) === true && is_file($path) === true) {
67+
if (@file_exists($path) === true && @is_file($path) === true) {
6868
$f = @fopen($path, 'rb');
6969
if (fclose($f) === true) {
7070
return true;

0 commit comments

Comments
 (0)