Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed bug #20323 : PHPCS tries to load sniffs from hidden directories

  • Loading branch information...
commit 11ac602ef55af565585e0485926bef14260276d0 1 parent 7cb8445
@gsherwood gsherwood authored
Showing with 11 additions and 4 deletions.
  1. +10 −4 CodeSniffer.php
  2. +1 −0  package.xml
View
14 CodeSniffer.php
@@ -685,25 +685,31 @@ private function _expandSniffDirectory($directory, $depth=0)
$di = new RecursiveIteratorIterator($rdi, 0, RecursiveIteratorIterator::CATCH_GET_CHILD);
foreach ($di as $file) {
- $fileName = $file->getFilename();
+ $filename = $file->getFilename();
// Skip hidden files.
- if (substr($fileName, 0, 1) === '.') {
+ if (substr($filename, 0, 1) === '.') {
continue;
}
// We are only interested in PHP and sniff files.
- $fileParts = explode('.', $fileName);
+ $fileParts = explode('.', $filename);
if (array_pop($fileParts) !== 'php') {
continue;
}
- $basename = basename($fileName, '.php');
+ $basename = basename($filename, '.php');
if (substr($basename, -5) !== 'Sniff') {
continue;
}
$path = $file->getPathname();
+
+ // Skip files in hidden directories.
+ if (strpos($path, DIRECTORY_SEPARATOR.'.') !== false) {
+ continue;
+ }
+
if (PHP_CODESNIFFER_VERBOSITY > 1) {
echo str_repeat("\t", $depth);
echo "\t\t=> $path".PHP_EOL;
View
1  package.xml
@@ -48,6 +48,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Fixed bug #20309 : Use "member variable" term in sniff "processMemberVar" method
- Fixed bug #20310 : PSR2 does not check for space after function name
- Fixed bug #20322 : Display rules set to type=error even when suppressing warnings
+ - Fixed bug #20323 : PHPCS tries to load sniffs from hidden directories
</notes>
<contents>
<dir name="/">
Please sign in to comment.
Something went wrong with that request. Please try again.