Intelephense от жалоб на неопределенный метод в конкретной реализации интерфейса ⇐ Php
Intelephense от жалоб на неопределенный метод в конкретной реализации интерфейса
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
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
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Остановить Intelephense от жалоб на неопределенный метод на реализации бетонного интерфейса
Anonymous » » в форуме Php - 0 Ответы
- 2 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Остановить Intelephense от жалоб на неопределенный метод на реализации бетонного интерфейса
Anonymous » » в форуме Php - 0 Ответы
- 1 Просмотры
-
Последнее сообщение Anonymous
-