diff --git a/CHANGELOG.md b/CHANGELOG.md index e69fcb0a..08f8f875 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee - Changed the return type of `ClientFactory` to return a `ClientInterface` instead of `ClientInterface|HttpClient` - Changed the type of `httplug.client.default` to `ClientInterface` instead of `HttpClient` - Removed the `DummyClient` interface +- Removed the `Http\Client\HttpClient` alias use the `Psr\Http\Client\ClientInterface` typehint in your services for autowiring. # Version 1 diff --git a/src/DependencyInjection/HttplugExtension.php b/src/DependencyInjection/HttplugExtension.php index 8c611914..3807f95b 100644 --- a/src/DependencyInjection/HttplugExtension.php +++ b/src/DependencyInjection/HttplugExtension.php @@ -33,7 +33,6 @@ use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\Extension; -use Symfony\Component\HttpKernel\Kernel; use Twig\Environment as TwigEnvironment; /** @@ -59,12 +58,6 @@ public function load(array $configs, ContainerBuilder $container): void $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.xml'); - // TODO: Move this back into services.xml when we drop support for Symfony 4, or completely remove the service in the next major version. - if (Kernel::MAJOR_VERSION >= 5) { - $loader->load('services_legacy.xml'); - } else { - $loader->load('services_legacy_sf4.xml'); - } $loader->load('plugins.xml'); if (\class_exists(MockClient::class)) { $loader->load('mock-client.xml'); diff --git a/src/Resources/config/services_legacy.xml b/src/Resources/config/services_legacy.xml deleted file mode 100644 index 99bda890..00000000 --- a/src/Resources/config/services_legacy.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - The "%alias_id%" service is deprecated in favor of using PSR-7 Psr\Http\Client\ClientInterface - - - diff --git a/tests/Functional/ServiceInstantiationTest.php b/tests/Functional/ServiceInstantiationTest.php index 37672ee4..1f215ced 100644 --- a/tests/Functional/ServiceInstantiationTest.php +++ b/tests/Functional/ServiceInstantiationTest.php @@ -18,10 +18,8 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request as SymfonyRequest; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\Profiler\Profiler; @@ -132,8 +130,7 @@ protected static function bootKernel(array $options = []): KernelInterface /** @var EventDispatcherInterface $dispatcher */ $dispatcher = static::$kernel->getContainer()->get('event_dispatcher'); - $class = (Kernel::MAJOR_VERSION >= 5) ? RequestEvent::class : GetResponseEvent::class; - $event = new $class(static::$kernel, SymfonyRequest::create('/'), HttpKernelInterface::MASTER_REQUEST); + $event = new RequestEvent(static::$kernel, SymfonyRequest::create('/'), HttpKernelInterface::MAIN_REQUEST); $dispatcher->dispatch($event, KernelEvents::REQUEST); diff --git a/tests/Unit/Collector/PluginClientFactoryListenerTest.php b/tests/Unit/Collector/PluginClientFactoryListenerTest.php index ef2be31a..dae29f80 100644 --- a/tests/Unit/Collector/PluginClientFactoryListenerTest.php +++ b/tests/Unit/Collector/PluginClientFactoryListenerTest.php @@ -11,8 +11,6 @@ use Http\HttplugBundle\Collector\PluginClientFactoryListener; use Nyholm\NSA; use PHPUnit\Framework\TestCase; -use Symfony\Component\EventDispatcher\Event as LegacyEvent; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Contracts\EventDispatcher\Event; @@ -28,8 +26,7 @@ public function testRegisterPluginClientFactory(): void $listener = new PluginClientFactoryListener($factory); - $class = (Kernel::MAJOR_VERSION >= 5) ? Event::class : LegacyEvent::class; - $listener->onEvent(new $class()); + $listener->onEvent(new Event()); $this->assertTrue(is_callable(NSA::getProperty(DefaultPluginClientFactory::class, 'factory'))); }