Skip to content

Commit

Permalink
Update configure.php
Browse files Browse the repository at this point in the history
When you don't fork but download this package, there is no link to a git remote. This leads to two PHP warnings when running the configure.php script:

- Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in .../configure.php on line 63
- PHP Warning:  Undefined array key 1 in .../configure.php on line 212

Adding an empty string as a fallback resolves those warnings.

Thank you for this repo! 😊
  • Loading branch information
marventhieme authored Dec 2, 2024
1 parent 4ebca2c commit a846e6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function writeln(string $line): void

function run(string $command): string
{
return trim(shell_exec($command));
return trim(shell_exec($command) ?? '');
}

function str_after(string $subject, string $search): string
Expand Down Expand Up @@ -209,7 +209,7 @@ function setupCodeStyleLibrary(string $codeStyleLibrary): void
$gitEmail = run('git config user.email');
$authorEmail = ask('Author email', $gitEmail);

$usernameGuess = explode(':', run('git config remote.origin.url'))[1];
$usernameGuess = explode(':', run('git config remote.origin.url'))[1] ?? '';
$usernameGuess = dirname($usernameGuess);
$usernameGuess = basename($usernameGuess);
$authorUsername = ask('Author username', $usernameGuess);
Expand Down

0 comments on commit a846e6f

Please sign in to comment.