Skip to content

Commit f17505e

Browse files
🐛 Handle absolute paths
1 parent 019067d commit f17505e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

TwigCS/Config/Config.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,21 @@ public function findFiles()
4848
{
4949
$paths = $this->get('paths');
5050
$exclude = $this->get('exclude');
51+
$workingDir = $this->get('workingDirectory');
5152

5253
// Build the finder.
5354
$files = Finder::create()
54-
->in($this->get('workingDirectory'))
55+
->in($workingDir)
5556
->name($this->config['pattern'])
5657
->files();
5758

5859
// Include all matching paths.
5960
foreach ($paths as $path) {
61+
// Trim absolute path
62+
if (substr($path, 0, strlen($workingDir)) == $workingDir) {
63+
$path = ltrim(substr($path, strlen($workingDir)), '/');
64+
}
65+
6066
$files->path($path);
6167
}
6268

0 commit comments

Comments
 (0)