DutchCodingCompany / filament-socialite

Add OAuth login through Laravel Socialite to Filament.
MIT License
153 stars 38 forks source link

Add $provider as required by the callback #83

Closed phh closed 7 months ago

phh commented 7 months ago

In #80, the expected closure in setCreateUserCallback() was changed from:

@param \Closure(\Laravel\Socialite\Contracts\User $oauthUser, self $socialite): \Illuminate\Contracts\Auth\Authenticatable $callback

to: @param \Closure(string $provider, \Laravel\Socialite\Contracts\User $oauthUser, self $socialite): \Illuminate\Contracts\Auth\Authenticatable $callback

See https://github.com/DutchCodingCompany/filament-socialite/pull/80/files#diff-67b15d15cdb909bec4aa64726a764f56356dafdff7ded1b3c6d5cfbfbc10a15cR143

meaning that is expects a string $provider. It can work without, however, PHPStan is nagging about it, due to it not being provided in the example.

Error:

Parameter #1 $callback of static method DutchCodingCompany\FilamentSocialite\FilamentSocialite::setCreateUserCallback()
         expects (Closure(string, Laravel\Socialite\Contracts\User, DutchCodingCompany\FilamentSocialite\FilamentSocialite):
         Illuminate\Contracts\Auth\Authenticatable)|null, Closure(Laravel\Socialite\Contracts\User,
         DutchCodingCompany\FilamentSocialite\FilamentSocialite): mixed given.

This PR updated the example.

bert-w commented 7 months ago

Thanks!