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

Support Guzzle 7 in version check #387

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/Behat/MinkExtension/ServiceContainer/Driver/GoutteFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Behat\MinkExtension\ServiceContainer\Driver;

use GuzzleHttp\ClientInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\Definition;

Expand Down Expand Up @@ -125,7 +126,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;
}
}