在企业微信中,withAccessToken与文档中的示例不符
Guxinpei opened this issue · comments
我用的环境
- 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
类
谢谢,已更新