diff --git a/src/HackCodegenConfig.php b/src/HackCodegenConfig.php index 9a40fd59..a4a56150 100644 --- a/src/HackCodegenConfig.php +++ b/src/HackCodegenConfig.php @@ -37,7 +37,14 @@ public function getMaxLineLength(): int { return 80; } + <<__Memoize>> public function getRootDir(): string { - return __DIR__; + $dir = __DIR__; + $root_pos = strpos($dir, '/vendor/facebook/hack-codegen/'); + if ($root_pos === false) { + return $dir; + } + $root = Str::substr($dir, 0, $root_pos); + return $root; } }