From d1c5cde1187bbcaad35ce9d498a9bf117db8b0a9 Mon Sep 17 00:00:00 2001 From: Colin Sheaff Date: Mon, 30 Sep 2024 03:41:58 -0500 Subject: [PATCH] [6.x] Fix PHP 8.4 deprecation warnings for implicit nullable types (#376) --- src/Installer/InstallManager.php | 2 +- src/Providers.php | 24 +++++++++---------- src/Socialstream.php | 2 +- .../breeze/database/factories/UserFactory.php | 2 +- .../database/factories/UserFactory.php | 2 +- .../database/factories/UserFactory.php | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Installer/InstallManager.php b/src/Installer/InstallManager.php index 7e9c61b4..247f34f6 100644 --- a/src/Installer/InstallManager.php +++ b/src/Installer/InstallManager.php @@ -14,7 +14,7 @@ use JoelButcher\Socialstream\Installer\Drivers\Jetstream\LivewireDriver as JetstreamLivewireDriver; /** - * @method Driver driver($driver = null) + * @method Driver driver(?string $driver = null) */ class InstallManager extends Manager { diff --git a/src/Providers.php b/src/Providers.php index 803ebc1e..25780783 100644 --- a/src/Providers.php +++ b/src/Providers.php @@ -152,7 +152,7 @@ public static function hasTwitterOAuth2Support(): bool /** * Enable the Bitbucket provider. */ - public static function bitbucket(string $label = null): string + public static function bitbucket(?string $label = null): string { return tap(ProviderEnum::Bitbucket->value, fn (string $provider) => static::addLabelFor($provider, $label)); } @@ -160,7 +160,7 @@ public static function bitbucket(string $label = null): string /** * Enable the Facebook provider. */ - public static function facebook(string $label = null): string + public static function facebook(?string $label = null): string { return tap(ProviderEnum::Facebook->value, fn (string $provider) => static::addLabelFor($provider, $label)); } @@ -168,7 +168,7 @@ public static function facebook(string $label = null): string /** * Enable the GitHub provider. */ - public static function github(string $label = null): string + public static function github(?string $label = null): string { return tap(ProviderEnum::Github->value, fn (string $provider) => static::addLabelFor($provider, $label)); } @@ -176,7 +176,7 @@ public static function github(string $label = null): string /** * Enable the GitLab provider. */ - public static function gitlab(string $label = null): string + public static function gitlab(?string $label = null): string { return tap(ProviderEnum::Gitlab->value, fn (string $provider) => static::addLabelFor($provider, $label)); } @@ -184,7 +184,7 @@ public static function gitlab(string $label = null): string /** * Enable the Google provider. */ - public static function google(string $label = null): string + public static function google(?string $label = null): string { return tap(ProviderEnum::Google->value, fn (string $provider) => static::addLabelFor($provider, $label)); } @@ -192,7 +192,7 @@ public static function google(string $label = null): string /** * Enable the LinkedIn provider. */ - public static function linkedin(string $label = null): string + public static function linkedin(?string $label = null): string { return tap(ProviderEnum::LinkedIn->value, fn (string $provider) => static::addLabelFor($provider, $label)); } @@ -200,7 +200,7 @@ public static function linkedin(string $label = null): string /** * Enable the LinkedIn OpenID provider. */ - public static function linkedinOpenId(string $label = null): string + public static function linkedinOpenId(?string $label = null): string { return tap(ProviderEnum::LinkedInOpenId->value, fn (string $provider) => static::addLabelFor($provider, $label)); } @@ -208,7 +208,7 @@ public static function linkedinOpenId(string $label = null): string /** * Enable the Slack provider. */ - public static function slack(string $label = null): string + public static function slack(?string $label = null): string { return tap(ProviderEnum::Slack->value, fn (string $provider) => static::addLabelFor($provider, $label)); } @@ -218,7 +218,7 @@ public static function slack(string $label = null): string * * @deprecated use `twitterOAuth1` instead. */ - public static function twitter(string $label = null): string + public static function twitter(?string $label = null): string { return tap(ProviderEnum::Twitter->value, fn (string $provider) => static::addLabelFor($provider, $label)); } @@ -226,7 +226,7 @@ public static function twitter(string $label = null): string /** * Enable the Twitter OAuth 1.0 provider. */ - public static function twitterOAuth1(string $label = null): string + public static function twitterOAuth1(?string $label = null): string { return tap(ProviderEnum::Twitter->value, fn (string $provider) => static::addLabelFor($provider, $label)); } @@ -234,12 +234,12 @@ public static function twitterOAuth1(string $label = null): string /** * Enable the Twitter OAuth 2.0 provider. */ - public static function twitterOAuth2(string $label = null): string + public static function twitterOAuth2(?string $label = null): string { return tap(ProviderEnum::TwitterOAuth2->value, fn (string $provider) => static::addLabelFor($provider, $label)); } - public static function addLabelFor(ProviderEnum|string $provider, string $label = null): void + public static function addLabelFor(ProviderEnum|string $provider, ?string $label = null): void { if (! $label) { return; diff --git a/src/Socialstream.php b/src/Socialstream.php index 64a041e8..aff0ca65 100644 --- a/src/Socialstream.php +++ b/src/Socialstream.php @@ -120,7 +120,7 @@ public static function providers(): array /** * Get a completion redirect path for a specific feature. */ - public static function redirects(string $redirect, $default = null) + public static function redirects(string $redirect, mixed $default = null) { return config('socialstream.redirects.'.$redirect) ?? $default ?? config('socialstream.home'); } diff --git a/stubs/breeze/database/factories/UserFactory.php b/stubs/breeze/database/factories/UserFactory.php index 00fc5246..28b2f85c 100644 --- a/stubs/breeze/database/factories/UserFactory.php +++ b/stubs/breeze/database/factories/UserFactory.php @@ -48,7 +48,7 @@ public function unverified(): static /** * Indicate that the user should have a connected account for the given provider. */ - public function withConnectedAccount(string $provider, callable $callback = null): static + public function withConnectedAccount(string $provider, ?callable $callback = null): static { if (! Providers::enabled($provider)) { return $this->state([]); diff --git a/stubs/filament/database/factories/UserFactory.php b/stubs/filament/database/factories/UserFactory.php index 441c0f7e..6576582b 100644 --- a/stubs/filament/database/factories/UserFactory.php +++ b/stubs/filament/database/factories/UserFactory.php @@ -45,7 +45,7 @@ public function unverified(): static /** * Indicate that the user should have a connected account for the given provider. */ - public function withConnectedAccount(string $provider, callable $callback = null): static + public function withConnectedAccount(string $provider, ?callable $callback = null): static { if (! Providers::enabled($provider)) { return $this->state([]); diff --git a/stubs/jetstream/database/factories/UserFactory.php b/stubs/jetstream/database/factories/UserFactory.php index 5256b7a1..a790e1cc 100644 --- a/stubs/jetstream/database/factories/UserFactory.php +++ b/stubs/jetstream/database/factories/UserFactory.php @@ -48,7 +48,7 @@ public function unverified(): static /** * Indicate that the user should have a personal team. */ - public function withPersonalTeam(callable $callback = null): static + public function withPersonalTeam(?callable $callback = null): static { if (! JetstreamFeatures::hasTeamFeatures()) { return $this->state([]); @@ -69,7 +69,7 @@ public function withPersonalTeam(callable $callback = null): static /** * Indicate that the user should have a connected account for the given provider. */ - public function withConnectedAccount(string $provider, callable $callback = null): static + public function withConnectedAccount(string $provider, ?callable $callback = null): static { if (! Providers::enabled($provider)) { return $this->state([]);