diff options
Diffstat (limited to 'scripts/linters/src/Support/Paths.php')
| -rw-r--r-- | scripts/linters/src/Support/Paths.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/linters/src/Support/Paths.php b/scripts/linters/src/Support/Paths.php new file mode 100644 index 00000000..2e500570 --- /dev/null +++ b/scripts/linters/src/Support/Paths.php @@ -0,0 +1,15 @@ +<?php + +declare(strict_types=1); + +namespace Shirabe\Lint\Support; + +final class Paths +{ + public static function relativeTo(string $rootDir, string $path): string + { + $root = rtrim($rootDir, '/') . '/'; + + return str_starts_with($path, $root) ? substr($path, strlen($root)) : $path; + } +} |
