Skip to content

Commit 3c135af

Browse files
Merge pull request #68 from VincentLanglet/fixAbsolutePath
Fix absolute path
2 parents 019067d + 839fef8 commit 3c135af

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
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

TwigCS/Environment/StubbedEnvironment.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ class StubbedEnvironment extends Environment
3232
/**
3333
* @var TwigTest[]
3434
*/
35-
protected $stubTests = [];
35+
protected $stubTests = [
36+
'divisible' => false, // Allow 'divisible by' filter
37+
'same' => false, // Allow 'same as' filter
38+
];
3639

3740
public function __construct()
3841
{

0 commit comments

Comments
 (0)