Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit 440be27

Browse files
philwcdancryer
authored andcommitted
Add pattern excludes (#23)
* Add travis env instructions * Add pattern excludes
1 parent 4b38b21 commit 440be27

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

PhpDocblockChecker/CheckerCommand.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ protected function processDirectory($path = '', array &$worklist = [])
322322

323323
$itemPath = $path . $item->getFilename();
324324

325-
if (in_array($itemPath, $this->exclude)) {
325+
if($this->isFileExcluded($itemPath)){
326326
continue;
327327
}
328328

@@ -356,7 +356,7 @@ protected function processStdin(array &$worklist = [])
356356
continue;
357357
}
358358

359-
if (in_array($file, $this->exclude)) {
359+
if($this->isFileExcluded($file)){
360360
continue;
361361
}
362362

@@ -366,6 +366,24 @@ protected function processStdin(array &$worklist = [])
366366
}
367367
}
368368

369+
/**
370+
* @param $file
371+
* @return bool
372+
*/
373+
private function isFileExcluded($file) {
374+
if (in_array($file, $this->exclude)) {
375+
return true;
376+
}
377+
378+
foreach ($this->exclude as $pattern) {
379+
if (fnmatch($pattern, $file)) {
380+
return true;
381+
}
382+
}
383+
384+
return false;
385+
}
386+
369387
/**
370388
* Check a specific PHP file for errors.
371389
* @param string $fileName

0 commit comments

Comments
 (0)