w7corp / easywechat

📦 一个 PHP 微信 SDK

Home Page:https://easywechat.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

在企业微信中,withAccessToken与文档中的示例不符

Guxinpei opened this issue · comments

commented

我用的环境

  • PHP 版本:8.1
  • overtrue/wechat 版本:"w7corp/easywechat": "^6.7"
  • 是否使用了框架?框架名称:Laravel

问题及现象

use EasyWeChat\Work\Application;
 $config = [...$someConfig];
 (new Application($config))->getClient()->withAccessToken('access_token'); 
 //此处会抛出异常
 //EasyWeChat\Kernel\HttpClient\AccessTokenAwareClient::withAccessToken(): Argument #1 ($accessToken) must be of type EasyWeChat\Kernel\Contracts\AccessToken, string given

根据我们提供的文档 https://easywechat.com/6.x/client.html#%E8%87%AA%E5%AE%9A%E4%B9%89-access-token

$client->withAccessToken('access_token');
$client->get('xxxx');
$client->post('xxxx');

很明显此处应当是一个string参数,但实际上AccessTokenAwareClient类中withAccessToken方法接受的事EasyWeChat\Kernel\Contracts\AccessToken

谢谢,已更新