@@ -49,6 +49,7 @@ private function process(): int
4949 $ resolver = new ConfigurationResolver (
5050 $ this ->getConfig (),
5151 [
52+ 'config ' => $ this ->getConfigFilePath (),
5253 'allow-risky ' => 'yes ' ,
5354 'diff ' => $ output ->isVerbose (),
5455 'dry-run ' => $ this ->dusterConfig ->get ('lint ' ),
@@ -63,7 +64,7 @@ private function process(): int
6364 );
6465
6566 $ changes = (new Runner (
66- $ resolver ->getFinder (),
67+ $ this -> getConfig () ->getFinder (),
6768 $ resolver ->getFixers (),
6869 $ resolver ->getDiffer (),
6970 app ()->get (EventDispatcher::class),
@@ -84,13 +85,29 @@ private function process(): int
8485
8586 private function getConfig (): ConfigInterface
8687 {
87- $ config = $ this ->getConfigFile ();
88+ $ config = $ this ->includeConfig ();
8889
8990 if (! $ config instanceof ConfigInterface) {
9091 throw new InvalidConfigurationException ("The PHP CS Fixer config file does not return a 'PhpCsFixer\ConfigInterface' instance. " );
9192 }
9293
93- $ finder = $ config ->getFinder ();
94+ return $ config ->setFinder ($ this ->updateFinder ($ config ->getFinder ()));
95+ }
96+
97+ /**
98+ * Update the finder with the paths and exclude from the config.
99+ * We are bypassing resolveFinder() in ConfigurationResolver
100+ * to allow for us to use the global duster config.
101+ */
102+ private function updateFinder (Finder $ finder ): Finder
103+ {
104+ collect ($ this ->dusterConfig ->get ('paths ' , []))->each (function ($ path ) use ($ finder ) {
105+ if (is_dir ($ path )) {
106+ $ finder = $ finder ->in ($ path );
107+ } elseif (is_file ($ path )) {
108+ $ finder = $ finder ->append ([$ path ]);
109+ }
110+ });
94111
95112 collect ($ this ->dusterConfig ->get ('exclude ' , []))->each (function ($ path ) use ($ finder ) {
96113 if (is_dir ($ path )) {
@@ -100,12 +117,17 @@ private function getConfig(): ConfigInterface
100117 }
101118 });
102119
103- return $ config ->setFinder ($ finder );
120+ return $ finder ;
121+ }
122+
123+ private function includeConfig (): Config
124+ {
125+ return include $ this ->getConfigFilePath ();
104126 }
105127
106- private function getConfigFile (): Config
128+ private function getConfigFilePath (): string
107129 {
108- return include (string ) collect ([
130+ return (string ) collect ([
109131 Project::path () . '/.php-cs-fixer.dist.php ' ,
110132 Project::path () . '/.php-cs-fixer.php ' ,
111133 base_path ('standards/.php-cs-fixer.dist.php ' ),
0 commit comments