From 967e983203f45c47ca154df85d47f08f54b5cafb Mon Sep 17 00:00:00 2001 From: Andrii Dembitskyi Date: Sun, 15 Dec 2024 20:15:41 +0200 Subject: [PATCH] :sparkles: `withRootFiles` now apply rector for dotfiles too (#6592) Resolves https://github.com/rectorphp/rector/issues/8896 --- src/Configuration/RectorConfigBuilder.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index b858c65c3a..2022bcc1a9 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -363,8 +363,8 @@ public function withSkipPath(string $skipPath): self } /** - * Include PHP files from the root directory, - * typically ecs.php, rector.php etc. + * Include PHP files from the root directory (including hidden ones), + * typically ecs.php, rector.php, .php-cs-fixer.dist.php etc. */ public function withRootFiles(): self { @@ -413,7 +413,9 @@ function (string $string): string { $rootPhpFilesFinder = (new Finder())->files() ->in(getcwd()) ->depth(0) - ->name('*.php'); + ->ignoreDotFiles(false) + ->name('*.php') + ->name('.*.php'); foreach ($rootPhpFilesFinder as $rootPhpFileFinder) { $path = $rootPhpFileFinder->getRealPath();