Skip to content

Commit d4ad8f0

Browse files
authored
Merge pull request #66 from TomasVotruba/tv-fix-skip
[fix] fix bug when --skip-path also ignores usages in those paths
2 parents 0251dbb + ac06c29 commit d4ad8f0

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
],
99
"require": {
1010
"php": ">=8.2",
11-
"illuminate/container": "^11.44",
11+
"illuminate/container": "^12.0",
1212
"nette/utils": "^4.0",
1313
"nikic/php-parser": "^5.4",
1414
"symfony/console": "^6.4",
15-
"symfony/finder": "^6.4",
15+
"symfony/finder": "^7.2",
1616
"webmozart/assert": "^1.11"
1717
},
1818
"require-dev": {
@@ -65,4 +65,4 @@
6565
]
6666
}
6767
}
68-
}
68+
}

src/Commands/CheckCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
112112
/** @var string[] $fileExtensions */
113113
$fileExtensions = (array) $input->getOption('file-extension');
114114

115+
// we have to look for usage in every path
116+
$allFilePaths = $this->phpFilesFinder->findPhpFiles($paths, $fileExtensions, []);
117+
118+
// but we only want to check the files that are not in the skipped paths
115119
$phpFilePaths = $this->phpFilesFinder->findPhpFiles($paths, $fileExtensions, $pathsToSkip);
116120

117121
$progressBar = null;
118122
if (! $isJson) {
119123
$this->symfonyStyle->title('1. Finding used classes');
120-
$progressBar = $this->symfonyStyle->createProgressBar(count($phpFilePaths));
124+
$progressBar = $this->symfonyStyle->createProgressBar(count($allFilePaths));
121125
}
122126

123-
$usedNames = $this->resolveUsedClassNames($phpFilePaths, $progressBar);
127+
$usedNames = $this->resolveUsedClassNames($allFilePaths, $progressBar);
124128

125129
$this->symfonyStyle->newLine(2);
126130

0 commit comments

Comments
 (0)