Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit 5b577c5

Browse files
authored
Merge pull request #17 from fredemmott/better-default-root-dir
Better HackCodegenConfig::getRootDir()
2 parents 6a05f9d + 42e0f5b commit 5b577c5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/HackCodegenConfig.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@ public function getMaxLineLength(): int {
3737
return 80;
3838
}
3939

40+
<<__Memoize>>
4041
public function getRootDir(): string {
41-
return __DIR__;
42+
$dir = __DIR__;
43+
$root_pos = strpos($dir, '/vendor/facebook/hack-codegen/');
44+
if ($root_pos === false) {
45+
return $dir;
46+
}
47+
$root = Str::substr($dir, 0, $root_pos);
48+
return $root;
4249
}
4350
}

0 commit comments

Comments
 (0)