Undefined type 'Google_Service_Oauth2' intelephense(1009) PHP
one text
I currently modify my php script using namespace. I've done with the scripts but there are problem with Google API package
// create Client Request to access Google API
$client = new \Google_Client(); => THIS ONE WORKS
$client->setClientId($clientID);
$client->setClientSecret($clientSecret);
$client->setRedirectUri($redirectUri);
$client->addScope("email");
$client->addScope("profile");
$accessToken = $key;
// Get $id_token via HTTPS POST.
try{
$arrToken = $client->setAccessToken($accessToken);
// get profile info
$google_oauth = new \Google_Service_Oauth2($client); => IT DOESNT
$google_account_info = $google_oauth->userinfo->get();
$checkEmail = $google_account_info->email;
$name = $google_account_info->name;
$googleId = $google_account_info->id;
}
Here is the error
Undefined type 'Google_Service_Oauth2' intelephense(1009)
If I do not use namespace, it has no problem. This one really weird.
Source