Skip to content

Commit

Permalink
Fix: Give non-distributable configuration files priority
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed May 19, 2022
1 parent 33888b3 commit 47dd306
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion README.md
Expand Up @@ -143,7 +143,14 @@ cd ~/dirA
twigcs --config ~/dirB/.twig_cs.dist.php # Will lint templates in ~/dirA with the config of ~/dirB
```

By default, the files `.twig_cs.php`, `.twig_cs.dist.php`, `.twig_cs` and `.twig_cs.dist` are looked up in your current working directory (CWD).
By default, the files

- `.twig_cs.php`
- `.twig_cs`
- `.twig_cs.dist.php`
- `.twig_cs.dist`

are looked up in your current working directory (CWD).

You can also provide finders inside config files, they will completely replace the path in the CLI:

Expand Down
2 changes: 1 addition & 1 deletion src/Config/ConfigResolver.php
Expand Up @@ -338,8 +338,8 @@ private function computeConfigFiles()

return [
$configDir.\DIRECTORY_SEPARATOR.'.twig_cs.php',
$configDir.\DIRECTORY_SEPARATOR.'.twig_cs.dist.php',
$configDir.\DIRECTORY_SEPARATOR.'.twig_cs',
$configDir.\DIRECTORY_SEPARATOR.'.twig_cs.dist.php',
$configDir.\DIRECTORY_SEPARATOR.'.twig_cs.dist',
];
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Config/ConfigResolverTest.php
Expand Up @@ -153,18 +153,18 @@ public function provideDefaultConfigFileNameAndAvailableDefaultConfigFileNames()
],
],
[
'.twig_cs.dist.php',
'.twig_cs',
[
'.twig_cs',
'.twig_cs.dist',
'.twig_cs.dist.php',
],
],
[
'.twig_cs',
'.twig_cs.dist.php',
[
'.twig_cs',
'.twig_cs.dist',
'.twig_cs.dist.php',
],
],
[
Expand Down

0 comments on commit 47dd306

Please sign in to comment.