Skip to content

Commit 55055d5

Browse files
LTSCommerceclaude
andcommitted
fix: override projectRoot in CS Fixer finder with getcwd()
The PHAR-based fallback in php_cs.php computes projectRoot by going 5 levels up from configDefaults/generic/. This works when php-qa-ci is installed as a dependency but goes too far when the library IS the root project. Use getcwd() in the library's own finder override. Also broadened exclusion from tests/assets/psr4 to tests/assets and added ignoreVCSIgnored for consistency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bbedb9d commit 55055d5

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

qaConfig/php_cs_finder.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<?php
22

33
declare(strict_types=1);
4-
if (isset($GLOBALS['projectRoot'])) {
5-
throw new RuntimeException('$projectRoot must be defined and must be a valid path to the project root');
6-
}
4+
5+
// Override $projectRoot from parent scope — the PHAR-based fallback in php_cs.php
6+
// computes the wrong path when the library IS the root project (goes too many levels up).
7+
// Use the actual working directory instead.
8+
$projectRoot = getcwd() ?: $projectRoot;
79

810
return (new PhpCsFixer\Finder())
911
->in($projectRoot)
1012
->exclude(
1113
[
1214
'var',
13-
'tests/assets/psr4',
15+
'tests/assets',
1416
]
1517
)
18+
->ignoreVCSIgnored(true)
1619
;

0 commit comments

Comments
 (0)