joelbutcher / socialstream

OAuth for Laravel, simplified.

Home Page:https://docs.socialstream.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect TypeHint for invalidStateHandler causes phpstan error

zenlex opened this issue · comments

* @var \JoelButcher\Socialstream\Contracts\CreatesConnectedAccounts;

This line should specify the type as HandlesInvalidState not CreatesConnectedAccounts

Why do you have PHPStan configured to evaluate vendor source code? As of 4.x This package should no longer be using @var PHPDoc, we shifted to using PHP's type system instead.

Thanks @joelbutcher you raise a good point, I'll go check that project. I thought I was snagging it because of something published but missed the location (end of a long day 😓 ). Appreciate the info about v4 as well!

@joelbutcher FYI turns out I wasn't evaluating vendor code directly. Looks like on this project we override some methods on the OAuthController, and the catch block in

  try {
            $providerAccount = $resolver->resolve($provider);
        } catch (InvalidStateException $e) {
            $this->invalidStateHandler->handle($e);
        }

was flagging ->handle() as an unknown method on CreatesConnectedAccounts even though it should be a method on HandlesInvalidState because of the phpdoc declaration. I'm going to look and see if I can just bump to v4 on this project.