Skip to content

Commit

Permalink
Merge pull request #137 from ZejdCicak/master
Browse files Browse the repository at this point in the history
Fix: Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated
  • Loading branch information
BrainMaestro committed Mar 2, 2023
2 parents 9043d12 + 407b855 commit 3d197c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ function git_dir()
// Don't show command error if git is not initialized
$errorToDevNull = is_windows() ? '' : ' 2>/dev/null';

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

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

0 comments on commit 3d197c4

Please sign in to comment.