File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 22
33namespace Okapi \CodeTransformer \Core ;
44
5+ use Composer \Autoload \ClassLoader ;
56use Okapi \CodeTransformer \CodeTransformerKernel ;
67use Okapi \Path \Path ;
8+ use ReflectionClass ;
79
810/**
911 * # Options
@@ -68,13 +70,9 @@ public function setOptions(
6870 ?int $ cacheFileMode ,
6971 ?bool $ debug ,
7072 ): void {
71- $ rootDir = getcwd ();
72-
73- if ($ rootDir === false ) {
74- // @codeCoverageIgnoreStart
75- $ rootDir = Path::resolve (Path::join (__DIR__ , '../../../../.. ' ));
76- // @codeCoverageIgnoreEnd
77- }
73+ $ composerRef = new ReflectionClass (ClassLoader::class);
74+ $ composerDir = $ composerRef ->getFileName ();
75+ $ rootDir = Path::resolve (Path::join ($ composerDir , '../../.. ' ));
7876
7977 $ this ->appDir = $ rootDir ;
8078 $ this ->cacheDir = $ cacheDir ?? Path::join ($ rootDir , $ this ->defaultCacheDir );
You can’t perform that action at this time.
0 commit comments