Skip to content

Commit

Permalink
Fix constructor parameter type in OptionalPackages.php
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdijia committed Apr 10, 2024
1 parent d178e20 commit 1e805d7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions installer/OptionalPackages.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class OptionalPackages
*/
private $stabilityFlags;

public function __construct(IOInterface $io, Composer $composer, string $projectRoot = null)
public function __construct(IOInterface $io, Composer $composer, ?string $projectRoot = null)
{
$this->io = $io;
$this->composer = $composer;
Expand Down Expand Up @@ -139,11 +139,13 @@ function ($value) {
'n'
);

if ($answer != 'n') {
$content = file_get_contents($this->installerSource . '/resources/bin/hyperf.stub');
$content = str_replace('%TIME_ZONE%', $answer, $content);
file_put_contents($this->projectRoot . '/bin/hyperf.php', $content);
if ($answer == 'n') {
$answer = date_default_timezone_get();
}

$content = file_get_contents($this->installerSource . '/resources/bin/hyperf.stub');
$content = str_replace('%TIME_ZONE%', $answer, $content);
file_put_contents($this->projectRoot . '/bin/hyperf.php', $content);
}

/**
Expand Down

0 comments on commit 1e805d7

Please sign in to comment.