From 9535b6f75e51babaccadc76de5392a8874e620ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Fr=C3=B6deberg?= Date: Mon, 15 Jan 2024 14:44:59 +0100 Subject: [PATCH] Change to double-quoted strings With single quotes ('\n'), the str_replace() function won't recognize it as a newline character. It will look for the literal sequence of a backslash followed by n, which I don't think we want. --- src/Helpers/Git.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Helpers/Git.php b/src/Helpers/Git.php index 13b38a3..04bbd06 100644 --- a/src/Helpers/Git.php +++ b/src/Helpers/Git.php @@ -20,7 +20,7 @@ class Git public static function getCommitHash(): ? string { try { - $branch = str_replace('\n', '', last(explode('/', (string)file_get_contents(base_path() . '/.git/HEAD')))); + $branch = str_replace("\n", '', last(explode('/', (string)file_get_contents(base_path() . '/.git/HEAD')))); $hash = file_get_contents(base_path() . '/.git/refs/heads/' . $branch); } catch (Exception $exception) { throw new GitHashException($exception->getMessage(), previous: $exception);