Skip to content

Commit 3d197c4

Browse files
authored
Merge pull request #137 from ZejdCicak/master
Fix: Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated
2 parents 9043d12 + 407b855 commit 3d197c4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/helpers.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ function git_dir()
5151
// Don't show command error if git is not initialized
5252
$errorToDevNull = is_windows() ? '' : ' 2>/dev/null';
5353

54-
$gitDir = trim(shell_exec('git rev-parse --git-common-dir'.$errorToDevNull));
54+
$gitDir = trim((string) shell_exec('git rev-parse --git-common-dir'.$errorToDevNull));
5555
if ($gitDir === '' || $gitDir === '--git-common-dir') {
5656
// the version of git does not support `--git-common-dir`
5757
// we fallback to `--git-dir` which and lose worktree support
58-
$gitDir = trim(shell_exec('git rev-parse --git-dir'.$errorToDevNull));
58+
$gitDir = trim((string) shell_exec('git rev-parse --git-dir'.$errorToDevNull));
5959
}
6060

6161
return $gitDir === '' ? false : realpath($gitDir);

0 commit comments

Comments
 (0)