Skip to content

Commit dc6b746

Browse files
committed
Fix : Throw a better message if http-client is not installed
1 parent e8f26ca commit dc6b746

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
4747
use Symfony\Component\DependencyInjection\Reference;
4848
use Symfony\Component\Finder\Finder;
49+
use Symfony\Component\HttpClient\HttpClient;
4950
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
5051
use Symfony\Component\Validator\Validator\ValidatorInterface;
5152
use Symfony\Component\Yaml\Yaml;
@@ -129,6 +130,10 @@ public function load(array $configs, ContainerBuilder $container): void
129130
->addTag('api_platform.filter');
130131

131132
if ($container->hasParameter('test.client.parameters') && class_exists(AbstractBrowser::class)) {
133+
if (!class_exists(HttpClient::class)) {
134+
throw new RuntimeException('Run "composer require --dev symfony/http-client" to use the test client"');
135+
}
136+
132137
$loader->load('test.xml');
133138
}
134139
}

0 commit comments

Comments
 (0)