Skip to content

Commit

Permalink
make classes final for 2.0 (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu authored Sep 5, 2024
1 parent 4d1ca68 commit ffeb988
Show file tree
Hide file tree
Showing 43 changed files with 57 additions and 115 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee
# Version 2

# 2.0.0 - (unreleased)

- Increased min PHP version to 8.1
- Removed the deprecated `Http\HttplugBundle\ClientFactory\PluginClientFactory`. Use `Http\Client\Common\PluginClientFactory` instead.
- Fixed a deprecation when creating a `HttpMethodsClient` via `http_methods_client: true`. Only PSR-17 factories are now passed as constructor arguments.
Expand All @@ -18,6 +19,7 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee
- 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.
- Changed classes marked as `@final` to be actually `final`. If you extended any of those, instead implement interfaces or decorate the class rather than extending it. Open an issue if you think a class needs to be made non-final to discuss what we should do.

# Version 1

Expand Down
4 changes: 1 addition & 3 deletions src/ClientFactory/AutoDiscoveryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
* Use auto discovery to find a HTTP client.
*
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class AutoDiscoveryFactory implements ClientFactory
final class AutoDiscoveryFactory implements ClientFactory
{
public function createClient(array $config = [])
{
Expand Down
4 changes: 1 addition & 3 deletions src/ClientFactory/BuzzFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class BuzzFactory implements ClientFactory
final class BuzzFactory implements ClientFactory
{
public function __construct(private readonly ResponseFactoryInterface $responseFactory)
{
Expand Down
4 changes: 1 addition & 3 deletions src/ClientFactory/CurlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class CurlFactory implements ClientFactory
final class CurlFactory implements ClientFactory
{
public function __construct(
private readonly ResponseFactoryInterface $responseFactory,
Expand Down
4 changes: 1 addition & 3 deletions src/ClientFactory/Guzzle6Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class Guzzle6Factory implements ClientFactory
final class Guzzle6Factory implements ClientFactory
{
public function createClient(array $config = [])
{
Expand Down
4 changes: 1 addition & 3 deletions src/ClientFactory/Guzzle7Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class Guzzle7Factory implements ClientFactory
final class Guzzle7Factory implements ClientFactory
{
public function createClient(array $config = [])
{
Expand Down
4 changes: 1 addition & 3 deletions src/ClientFactory/ReactFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class ReactFactory implements ClientFactory
final class ReactFactory implements ClientFactory
{
public function createClient(array $config = [])
{
Expand Down
4 changes: 1 addition & 3 deletions src/ClientFactory/SocketFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class SocketFactory implements ClientFactory
final class SocketFactory implements ClientFactory
{
public function createClient(array $config = [])
{
Expand Down
4 changes: 1 addition & 3 deletions src/ClientFactory/SymfonyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class SymfonyFactory implements ClientFactory
final class SymfonyFactory implements ClientFactory
{
public function __construct(
private readonly ResponseFactoryInterface $responseFactory,
Expand Down
4 changes: 1 addition & 3 deletions src/Collector/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class Collector extends DataCollector
final class Collector extends DataCollector
{
private ?Stack $activeStack = null;

Expand Down
5 changes: 1 addition & 4 deletions src/Collector/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Http\HttplugBundle\Collector;

use Exception;
use Http\Client\Exception\HttpException;
use Http\Client\Exception\TransferException;
use Http\Message\Formatter as MessageFormatter;
Expand All @@ -19,10 +18,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class Formatter implements MessageFormatter
final class Formatter implements MessageFormatter
{
public function __construct(
private readonly MessageFormatter $formatter,
Expand Down
4 changes: 1 addition & 3 deletions src/Collector/ProfileClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class ProfileClient implements ClientInterface, HttpAsyncClient
final class ProfileClient implements ClientInterface, HttpAsyncClient
{
use VersionBridgeClient;

Expand Down
4 changes: 1 addition & 3 deletions src/Collector/ProfileClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class ProfileClientFactory implements ClientFactory
final class ProfileClientFactory implements ClientFactory
{
/**
* @var ClientFactory|callable
Expand Down
4 changes: 1 addition & 3 deletions src/Collector/ProfilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class ProfilePlugin implements Plugin
final class ProfilePlugin implements Plugin
{
use Plugin\VersionBridgePlugin;

Expand Down
4 changes: 1 addition & 3 deletions src/Collector/StackPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class StackPlugin implements Plugin
final class StackPlugin implements Plugin
{
use Plugin\VersionBridgePlugin;

Expand Down
4 changes: 1 addition & 3 deletions src/Collector/Twig/HttpMessageMarkupExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class HttpMessageMarkupExtension extends AbstractExtension
final class HttpMessageMarkupExtension extends AbstractExtension
{
private ClonerInterface $cloner;

Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@
*
* @author David Buchmann <[email protected]>
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class Configuration implements ConfigurationInterface
final class Configuration implements ConfigurationInterface
{
/**
* Whether to use the debug mode.
Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/HttplugExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@
/**
* @author David Buchmann <[email protected]>
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class HttplugExtension extends Extension
final class HttplugExtension extends Extension
{
public const HTTPLUG_CLIENT_TAG = 'httplug.client';

Expand Down
4 changes: 1 addition & 3 deletions src/Discovery/ConfiguredClientsStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
* we can use the web debug toolbar for clients found with the discovery.
*
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class ConfiguredClientsStrategy implements DiscoveryStrategy
final class ConfiguredClientsStrategy implements DiscoveryStrategy
{
private static ?ClientInterface $client = null;

Expand Down
4 changes: 1 addition & 3 deletions src/Discovery/ConfiguredClientsStrategyListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

/**
* @author Wouter de Jong <[email protected]>
*
* @final
*/
class ConfiguredClientsStrategyListener implements EventSubscriberInterface
final class ConfiguredClientsStrategyListener implements EventSubscriberInterface
{
/**
* Make sure to use the custom strategy.
Expand Down
4 changes: 1 addition & 3 deletions src/HttplugBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
/**
* @author David Buchmann <[email protected]>
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class HttplugBundle extends Bundle
final class HttplugBundle extends Bundle
{
}
2 changes: 1 addition & 1 deletion tests/Functional/DiscoveredClientsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Psr\Http\Client\ClientInterface;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class DiscoveredClientsTest extends WebTestCase
final class DiscoveredClientsTest extends WebTestCase
{
public function testDiscoveredClient(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Issue206.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Nyholm\Psr7\Factory\Psr17Factory;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class Issue206 extends WebTestCase
final class Issue206 extends WebTestCase
{
public function testCustomClientDoesNotCauseException(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/ProfilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Psr\Http\Client\ClientInterface;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class ProfilerTest extends WebTestCase
final class ProfilerTest extends WebTestCase
{
/**
* @group legacy
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/ProfilingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Stopwatch\Stopwatch;

class ProfilingTest extends TestCase
final class ProfilingTest extends TestCase
{
private Collector $collector;

Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/ServiceInstantiationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpKernel\Profiler\Profiler;

class ServiceInstantiationTest extends WebTestCase
final class ServiceInstantiationTest extends WebTestCase
{
public function testHttpClient(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ClientFactory/BuzzFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* @author Tobias Nyholm <[email protected]>
*/
class BuzzFactoryTest extends TestCase
final class BuzzFactoryTest extends TestCase
{
public function testCreateClient(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ClientFactory/CurlFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* @author Tobias Nyholm <[email protected]>
*/
class CurlFactoryTest extends TestCase
final class CurlFactoryTest extends TestCase
{
public function testCreateClient(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ClientFactory/Guzzle6FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @author Tobias Nyholm <[email protected]>
*/
class Guzzle6FactoryTest extends TestCase
final class Guzzle6FactoryTest extends TestCase
{
public function testCreateClient(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ClientFactory/Guzzle7FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @author Tobias Nyholm <[email protected]>
*/
class Guzzle7FactoryTest extends TestCase
final class Guzzle7FactoryTest extends TestCase
{
public function testCreateClient(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ClientFactory/MockFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* @author Gary PEGEOT <[email protected]>
*/
class MockFactoryTest extends TestCase
final class MockFactoryTest extends TestCase
{
public function testCreateClient(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ClientFactory/ReactFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @author Tobias Nyholm <[email protected]>
*/
class ReactFactoryTest extends TestCase
final class ReactFactoryTest extends TestCase
{
public function testCreateClient(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ClientFactory/SocketFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @author Tobias Nyholm <[email protected]>
*/
class SocketFactoryTest extends TestCase
final class SocketFactoryTest extends TestCase
{
public function testCreateClient(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ClientFactory/SymfonyFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* @author Tobias Nyholm <[email protected]>
*/
class SymfonyFactoryTest extends TestCase
final class SymfonyFactoryTest extends TestCase
{
public function testCreateClient(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Collector/CollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Http\HttplugBundle\Collector\Stack;
use PHPUnit\Framework\TestCase;

class CollectorTest extends TestCase
final class CollectorTest extends TestCase
{
public function testCollectClientNames(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Collector/FormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class FormatterTest extends TestCase
final class FormatterTest extends TestCase
{
private MessageFormatter&MockObject $formatter;

Expand Down
Loading

0 comments on commit ffeb988

Please sign in to comment.