Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make implicit nullable param to explicit (PHP 8.4 compatibility) #903

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Ray.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ class Ray
/** @var Closure|null */
public static $beforeSendRequest = null;

public static function create(Client $client = null, string $uuid = null): self
public static function create(?Client $client = null, string $uuid = null): self
{
$settings = SettingsFactory::createFromConfigFile();

return new static($settings, $client, $uuid);
}

public function __construct(Settings $settings, Client $client = null, string $uuid = null)
public function __construct(Settings $settings, ?Client $client = null, ?string $uuid = null)
{
$this->settings = $settings;

Expand Down
8 changes: 4 additions & 4 deletions src/Settings/SettingsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static function createFromArray(array $settings = []): Settings
return new Settings($settings);
}

public static function createFromConfigFile(string $configDirectory = null): Settings
public static function createFromConfigFile(?string $configDirectory = null): Settings
{
$settingValues = (new static())->getSettingsFromConfigFile($configDirectory);

Expand All @@ -24,7 +24,7 @@ public static function createFromConfigFile(string $configDirectory = null): Set
return $settings;
}

public function getSettingsFromConfigFile(string $configDirectory = null): array
public function getSettingsFromConfigFile(?string $configDirectory = null): array
{
$configFilePath = $this->searchConfigFiles($configDirectory);

Expand All @@ -37,7 +37,7 @@ public function getSettingsFromConfigFile(string $configDirectory = null): array
return $options ?? [];
}

protected function searchConfigFiles(string $configDirectory = null): string
protected function searchConfigFiles(?string $configDirectory = null): string
{
if (! isset(self::$cache[$configDirectory])) {
self::$cache[$configDirectory] = $this->searchConfigFilesOnDisk($configDirectory);
Expand All @@ -46,7 +46,7 @@ protected function searchConfigFiles(string $configDirectory = null): string
return self::$cache[$configDirectory];
}

protected function searchConfigFilesOnDisk(string $configDirectory = null): string
protected function searchConfigFilesOnDisk(?string $configDirectory = null): string
{
$configNames = [
'ray.php',
Expand Down
4 changes: 2 additions & 2 deletions tests/TestClasses/FakeClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class FakeClock implements Clock
/** @var DateTimeImmutable|null */
protected $fixedNow;

public function __construct(DateTimeImmutable $now = null)
public function __construct(?DateTimeImmutable $now = null)
{
$this->fixedNow = $now;
}
Expand All @@ -20,7 +20,7 @@ public function now(): DateTimeImmutable
return $this->fixedNow ?? new DateTimeImmutable();
}

public function freeze(DateTimeImmutable $now = null): void
public function freeze(?DateTimeImmutable $now = null): void
{
$this->fixedNow = $now ?? new DateTimeImmutable();
}
Expand Down