Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
Support Guzzle 7 in version check
Browse files Browse the repository at this point in the history
  • Loading branch information
donquixote authored May 1, 2023
1 parent e206d2c commit 3ca7437
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Behat/MinkExtension/ServiceContainer/Driver/GoutteFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,18 @@ private function isGoutte1()

private function isGuzzle6()
{
return interface_exists('GuzzleHttp\ClientInterface') &&
version_compare(\GuzzleHttp\ClientInterface::VERSION, '6.0.0', '>=');
if (!interface_exists(ClientInterface::class)) {
return FALSE;
}
$rc = new \ReflectionClass(ClientInterface::class);
// This constant was removed in Guzzle 7.
if ($rc->hasConstant('VERSION')) {
return version_compare(ClientInterface::VERSION, '6.0.0', '>=');
}
// This constant was added in Guzzle 7.
if ($rc->hasConstant('MAJOR_VERSION')) {
ClientInterface::MAJOR_VERSION >= 6;
}
return FALSE;
}
}

0 comments on commit 3ca7437

Please sign in to comment.