8000 fixed root search path to include only './src' and './tests' · 77web/symfony@cd2a7bb · GitHub
[go: up one dir, main page]

Skip to content

Commit cd2a7bb

Browse files
committed
fixed root search path to include only './src' and './tests'
1 parent 3d5a96e commit cd2a7bb

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

check_cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,20 @@ $finder
2626
->name('*.xml')
2727
->name('*.xml.dist')
2828
->name('*.yml')
29-
->in(__DIR__)
29+
->in(array(__DIR__.'/src', __DIR__.'/tests'))
3030
->notName(basename(__FILE__))
3131
->exclude('.git')
3232
->exclude('vendor')
3333
;
3434

35-
$exit = 0;
35+
$count = 0;
36+
3637
foreach ($finder as $file) {
3738

3839
/* @var $file Symfony\Component\Finder\SplFileInfo */
3940

4041
// These files are skipped because tests would break
41-
if (in_array($file->getRelativePathname(), array(
42+
foreach(array(
4243
'tests/Symfony/Tests/Component/ClassLoader/ClassCollectionLoaderTest.php',
4344
'tests/Symfony/Tests/Component/DependencyInjection/Fixtures/containers/container9.php',
4445
'tests/Symfony/Tests/Component/DependencyInjection/Fixtures/includes/foo.php',
@@ -47,8 +48,11 @@ foreach ($finder as $file) {
4748
'tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.php',
4849
'tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher2.php',
4950
'tests/Symfony/Tests/Component/Yaml/Fixtures/sfTests.yml',
50-
))) {
51-
continue;
51+
) as $skippedFile) {
52+
53+
if ($skippedFile === substr($file->getRealPath(), strlen($skippedFile) * -1)) {
54+
continue(2);
55+
}
5256
}
5357

5458
$old = file_get_contents($file->getRealpath());
@@ -90,13 +94,13 @@ foreach ($finder as $file) {
9094
}
9195

9296
if ($new != $old) {
93-
$exit = 1;
97+
$count++;
98+
9499
if ($fix) {
95100
file_put_contents($file->getRealpath(), $new);
96101
}
97-
98-
echo $file->getRelativePathname().PHP_EOL;
102+
printf('%4d) %s'.PHP_EOL, $count, $file->getRelativePathname());
99103
}
100104
}
101105

102-
exit($exit);
106+
exit($count ? 1 : 0);

0 commit comments

Comments
 (0)
0