Intelephense от жалоб на неопределенный метод в конкретной реализации интерфейсаPhp

Кемеровские программисты php общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Intelephense от жалоб на неопределенный метод в конкретной реализации интерфейса

Сообщение Anonymous »


In my Symfony 7.0.3 project, I have a custom OAuth2 authenticator that uses League\Oauth2 by way of knpuniversity/oauth-client-bundle.

In my social authenticator class, I call $oauthUser = $client->fetchUserFromToken($accessToken). The return type from that method is ResourceOwnerInterface, which is implemented by GoogleUser - the class of the returned object.

The annoyance I'm having now is that when I write $oauthUser->getEmail(), intelephense complains that getEmail is an undefined method. It's not, of course, and the code runs just fine.

Is there anything I can do in code or editor configuration (I'm using Visual Studio Code) to prevent those red squiggly lines?

I had the same problem in my controllers calling $this->getUser() which I solved by overloading getUser() with a concrete return type. I'm not sure overloading is possible here though.

Thanks.


Источник: https://stackoverflow.com/questions/781 ... terface-im
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Php»