Skip to content

Commit

Permalink
Merge branch 'feature/3388-tweaks-for-wsl-support' of https://github.…
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Nov 1, 2021
2 parents 2f6db41 + f0c1acd commit 1a68116
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use PHP_CodeSniffer\Exceptions\DeepExitException;
use PHP_CodeSniffer\Exceptions\RuntimeException;
use PHP_CodeSniffer\Util\Common;

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

$lastDir = $currentDir;
$currentDir = dirname($currentDir);
} while ($currentDir !== '.' && $currentDir !== $lastDir && @is_readable($currentDir) === true);
} while ($currentDir !== '.' && $currentDir !== $lastDir && Common::isReadable($currentDir) === true);
}//end if

if (defined('STDIN') === false
Expand Down Expand Up @@ -1656,7 +1657,7 @@ public static function getAllConfigData()
return [];
}

if (is_readable($configFile) === false) {
if (Common::isReadable($configFile) === false) {
$error = 'ERROR: Config file '.$configFile.' is not readable'.PHP_EOL.PHP_EOL;
throw new DeepExitException($error, 3);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Util/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ public static function isPharFile($path)
*/
public static function isReadable($path)
{
if (is_readable($path) === true) {
if (@is_readable($path) === true) {
return true;
}

if (file_exists($path) === true && is_file($path) === true) {
if (@file_exists($path) === true && @is_file($path) === true) {
$f = @fopen($path, 'rb');
if (fclose($f) === true) {
return true;
Expand Down

0 comments on commit 1a68116

Please sign in to comment.