Undefined method GuzzleHttp\Client::sendAsync() with KnpLabs / php-github-api

176 Views Asked by At

I try to use KnpLabs/php-github-api (https://github.com/KnpLabs/php-github-api) to access all commits of a public repository master branch (for test purposes, i ask https://github.com/KnpLabs/php-github-api).

Here is the call :

protected function askGitHub()
{
    $config = $this->getConfigFormValues();

    $client = new \Redis();
    $client->connect('127.0.0.1', 6379);
    // Create a PSR6 cache pool
    $pool = new RedisCachePool($client);

    $client = new GitClient();
    $client->addCache($pool);

    // Do some request
    $commits = $client->api('repo')->commits()->all(
        $config['USER'], // Le propriétaire du projet : KnpLabs
        $config['REPO'], // Le projet à consulter : php-github-api
        array('sha' => 'master') // La branche, probablement
    );

    // Stop using cache
    $client->removeCache();
}

I expect to have some sort of array, but i only receive a fatal error message :

 Fatal error: Uncaught Error: Call to undefined method GuzzleHttp\Client::sendAsync() in [...]\vendor\php-http\guzzle6-adapter\src\Client.php on line 60

I know for sure error occured when calling the all() method.

If i dump methods of the client in Client .php, it obviously had no sendAsync() method :

  0 => string '__construct' (length=11)
  1 => string 'getDefaultOption' (length=16)
  2 => string 'setDefaultOption' (length=16)
  3 => string 'getBaseUrl' (length=10)
  4 => string 'createRequest' (length=13)
  5 => string 'get' (length=3)
  6 => string 'head' (length=4)
  7 => string 'delete' (length=6)
  8 => string 'put' (length=3)
  9 => string 'patch' (length=5)
  10 => string 'post' (length=4)
  11 => string 'options' (length=7)
  12 => string 'send' (length=4)
  13 => string 'sendAll' (length=7)
  14 => string 'getDefaultHandler' (length=17)
  15 => string 'getDefaultUserAgent' (length=19)
  16 => string 'getEmitter' (length=10)

Hence the message. Seeking for an answer, i've found GuzzleHttp Error: Call to undefined method GuzzleHttp\Client::sendAsync(). Following comments in this question doesn't help at all.

At this point, I am completely stuck as it is not my code that is in fault.

Some context informations :

  • this is in a prestashop module development that i encountered this behaviour ;
  • I use W10 with Wamp64 ;
  • PHP is 7.2.33 ;
  • Redis if up and running.
  • Finally, my composer.json requirements :
"require": {
    "php": ">=5.6.0",
    "knplabs/github-api": "3.0",
    "php-http/guzzle6-adapter": "2.0.1",
    "http-interop/http-factory-guzzle": "1.0",
    "cache/redis-adapter": "^1.1",
    "guzzlehttp/guzzle": "6.0"
  },

Does someone have any clue ?

0

There are 0 best solutions below