diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a5a20be..861fd89 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,11 +9,11 @@ jobs: strategy: fail-fast: true matrix: - php: ['8.1', '8.2'] + php: ['8.2'] composer-flags: ['--prefer-stable'] can-fail: [false] include: - - php: '8.1' + - php: '8.2' composer-flags: '--prefer-stable --prefer-lowest' can-fail: false diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 78d2631..d62699e 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -4,9 +4,9 @@ ->setRules([ '@Symfony' => true, '@Symfony:risky' => true, - '@PHP81Migration' => true, + '@PHP82Migration' => true, '@PHP80Migration:risky' => true, - '@PHPUnit84Migration:risky' => true, + '@PHPUnit100Migration:risky' => true, 'array_syntax' => ['syntax' => 'short'], 'blank_line_after_opening_tag' => false, 'declare_strict_types' => false, diff --git a/composer.json b/composer.json index b2972b1..505291f 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ ], "license": "MIT", "require": { - "php": "8.1.* || 8.2.*", + "php": "8.2.*", "guzzlehttp/psr7": "^2.4", "psr/http-message": "^1.0 || ^2.0", "ratchet/rfc6455": "^0.3.1", @@ -22,12 +22,12 @@ "ext-session": "*", "ext-sockets": "*", "phpstan/extension-installer": "^1.2", - "phpstan/phpstan": "1.10.33", + "phpstan/phpstan": "1.10.34", "phpstan/phpstan-phpunit": "1.3.14", - "phpunit/phpunit": "10.3.3", + "phpunit/phpunit": "10.3.4", "psr/container": "^1.0 || ^2.0", "psr/event-dispatcher": "^1.0", - "rector/rector": "0.18.2" + "rector/rector": "0.18.3" }, "conflict": { "psr/container": ">=3.0", diff --git a/docs/intro.md b/docs/intro.md index 05b69e5..ab775bb 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -10,4 +10,4 @@ The below table shows the support status and supported PHP versions for each maj | Version | Status | PHP Versions | |---------|----------------|--------------| -| 1.x | In Development | 8.1 | +| 1.x | In Development | 8.2 | diff --git a/rector.php b/rector.php index 8b6080f..050b9b1 100644 --- a/rector.php +++ b/rector.php @@ -30,7 +30,7 @@ ]); $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_81, + LevelSetList::UP_TO_PHP_82, SetList::CODE_QUALITY, PHPUnitLevelSetList::UP_TO_PHPUNIT_100, ]); diff --git a/src/Connection/ClosesConnectionWithResponse.php b/src/Connection/ClosesConnectionWithResponse.php index 5690a5c..1d9beaa 100644 --- a/src/Connection/ClosesConnectionWithResponse.php +++ b/src/Connection/ClosesConnectionWithResponse.php @@ -13,7 +13,7 @@ trait ClosesConnectionWithResponse { /** - * @param int $code Status code + * @param int $code Status code * @param array $headers Response headers */ private function close(Connection $connection, int $code = 400, array $headers = []): void diff --git a/src/Connection/Event/ConnectionClosed.php b/src/Connection/Event/ConnectionClosed.php index c8ff4f7..7433340 100644 --- a/src/Connection/Event/ConnectionClosed.php +++ b/src/Connection/Event/ConnectionClosed.php @@ -4,9 +4,9 @@ use BabDev\WebSocket\Server\Connection; -final class ConnectionClosed implements ConnectionAware +final readonly class ConnectionClosed implements ConnectionAware { - public function __construct(private readonly Connection $connection) {} + public function __construct(private Connection $connection) {} public function getConnection(): Connection { diff --git a/src/Connection/Event/ConnectionError.php b/src/Connection/Event/ConnectionError.php index 9a1ea16..0313393 100644 --- a/src/Connection/Event/ConnectionError.php +++ b/src/Connection/Event/ConnectionError.php @@ -4,11 +4,11 @@ use BabDev\WebSocket\Server\Connection; -final class ConnectionError implements ConnectionAware +final readonly class ConnectionError implements ConnectionAware { public function __construct( - private readonly Connection $connection, - private readonly \Throwable $throwable, + private Connection $connection, + private \Throwable $throwable, ) {} public function getConnection(): Connection diff --git a/src/Connection/Event/ConnectionOpened.php b/src/Connection/Event/ConnectionOpened.php index a317473..bc658b0 100644 --- a/src/Connection/Event/ConnectionOpened.php +++ b/src/Connection/Event/ConnectionOpened.php @@ -4,9 +4,9 @@ use BabDev\WebSocket\Server\Connection; -final class ConnectionOpened implements ConnectionAware +final readonly class ConnectionOpened implements ConnectionAware { - public function __construct(private readonly Connection $connection) {} + public function __construct(private Connection $connection) {} public function getConnection(): Connection { diff --git a/src/Connection/ReactSocketConnection.php b/src/Connection/ReactSocketConnection.php index 8e2e492..620a5cf 100644 --- a/src/Connection/ReactSocketConnection.php +++ b/src/Connection/ReactSocketConnection.php @@ -9,11 +9,11 @@ * The React socket connection is a connection class wrapping a {@see ConnectionInterface} * from the `react/socket` package. */ -final class ReactSocketConnection implements Connection +final readonly class ReactSocketConnection implements Connection { public function __construct( - private readonly ConnectionInterface $connection, - private readonly AttributeStore $attributeStore, + private ConnectionInterface $connection, + private AttributeStore $attributeStore, ) {} public function getAttributeStore(): AttributeStore diff --git a/src/Http/Middleware/ParseHttpRequest.php b/src/Http/Middleware/ParseHttpRequest.php index b6c967f..331cdf1 100644 --- a/src/Http/Middleware/ParseHttpRequest.php +++ b/src/Http/Middleware/ParseHttpRequest.php @@ -14,13 +14,13 @@ /** * The parse HTTP request server middleware transforms the incoming HTTP request into a {@see RequestInterface} object. */ -final class ParseHttpRequest implements ServerMiddleware +final readonly class ParseHttpRequest implements ServerMiddleware { use ClosesConnectionWithResponse; public function __construct( - private readonly ServerMiddleware $middleware, - private readonly RequestParser $requestParser = new GuzzleRequestParser(), + private ServerMiddleware $middleware, + private RequestParser $requestParser = new GuzzleRequestParser(), ) {} /** diff --git a/src/Session/Middleware/InitializeSession.php b/src/Session/Middleware/InitializeSession.php index f9f29b5..4f86c35 100644 --- a/src/Session/Middleware/InitializeSession.php +++ b/src/Session/Middleware/InitializeSession.php @@ -19,12 +19,12 @@ * This middleware uses Symfony's HttpFoundation component to interact with the session data. Applications * using another session service will need their own middleware component. */ -final class InitializeSession implements ServerMiddleware +final readonly class InitializeSession implements ServerMiddleware { public function __construct( - private readonly ServerMiddleware $middleware, - private readonly SessionFactoryInterface $sessionFactory, - private readonly OptionsHandler $optionsHandler = new IniOptionsHandler(), + private ServerMiddleware $middleware, + private SessionFactoryInterface $sessionFactory, + private OptionsHandler $optionsHandler = new IniOptionsHandler(), ) {} /** diff --git a/src/Session/SessionFactory.php b/src/Session/SessionFactory.php index a980631..0c0824b 100644 --- a/src/Session/SessionFactory.php +++ b/src/Session/SessionFactory.php @@ -7,9 +7,9 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageFactoryInterface; -final class SessionFactory implements SessionFactoryInterface +final readonly class SessionFactory implements SessionFactoryInterface { - public function __construct(private readonly SessionStorageFactoryInterface $storageFactory) {} + public function __construct(private SessionStorageFactoryInterface $storageFactory) {} public function createSession(): SessionInterface { diff --git a/src/Session/Storage/ReadOnlyNativeSessionStorageFactory.php b/src/Session/Storage/ReadOnlyNativeSessionStorageFactory.php index 8aa67b1..f6adb5c 100644 --- a/src/Session/Storage/ReadOnlyNativeSessionStorageFactory.php +++ b/src/Session/Storage/ReadOnlyNativeSessionStorageFactory.php @@ -11,14 +11,14 @@ use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageFactoryInterface; use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; -final class ReadOnlyNativeSessionStorageFactory implements SessionStorageFactoryInterface +final readonly class ReadOnlyNativeSessionStorageFactory implements SessionStorageFactoryInterface { public function __construct( - private readonly OptionsHandler $optionsHandler = new IniOptionsHandler(), - private readonly ?Reader $reader = null, - private readonly array $options = [], - private readonly AbstractProxy|\SessionHandlerInterface|null $handler = null, - private readonly ?MetadataBag $metaBag = null + private OptionsHandler $optionsHandler = new IniOptionsHandler(), + private ?Reader $reader = null, + private array $options = [], + private AbstractProxy|\SessionHandlerInterface|null $handler = null, + private ?MetadataBag $metaBag = null ) {} public function createStorage(?Request $request): SessionStorageInterface diff --git a/src/WAMP/DefaultWAMPConnection.php b/src/WAMP/DefaultWAMPConnection.php index eb5e4cc..0dd2a5c 100644 --- a/src/WAMP/DefaultWAMPConnection.php +++ b/src/WAMP/DefaultWAMPConnection.php @@ -13,11 +13,9 @@ * The WAMP connection is a connection class decorating another {@see Connection} adding helper methods to * send WAMP messages to the connected client. */ -final class DefaultWAMPConnection implements WAMPConnection +final readonly class DefaultWAMPConnection implements WAMPConnection { - public function __construct( - private readonly Connection $connection, - ) {} + public function __construct(private Connection $connection) {} public function getAttributeStore(): AttributeStore { diff --git a/src/WAMP/MessageHandler/PsrContainerMessageHandlerResolver.php b/src/WAMP/MessageHandler/PsrContainerMessageHandlerResolver.php index d892f7a..1293a4f 100644 --- a/src/WAMP/MessageHandler/PsrContainerMessageHandlerResolver.php +++ b/src/WAMP/MessageHandler/PsrContainerMessageHandlerResolver.php @@ -14,9 +14,9 @@ * The PSR container message handler resolver is a message handler resolver which returns a message handler set on the route's * "_controller" attribute or attempts to locate the message handler from a PSR-11 compatible container. */ -final class PsrContainerMessageHandlerResolver implements MessageHandlerResolver +final readonly class PsrContainerMessageHandlerResolver implements MessageHandlerResolver { - public function __construct(private readonly ContainerInterface $container) {} + public function __construct(private ContainerInterface $container) {} /** * @throws InvalidMessageHandler if the resolved object is not a valid message handler diff --git a/src/WAMP/Middleware/DispatchMessageToHandler.php b/src/WAMP/Middleware/DispatchMessageToHandler.php index 5d3dc8d..5905c3d 100644 --- a/src/WAMP/Middleware/DispatchMessageToHandler.php +++ b/src/WAMP/Middleware/DispatchMessageToHandler.php @@ -41,12 +41,12 @@ * This middleware uses Symfony's Routing component to create a router for the server application. Applications * choosing to use another router service will need their own middleware component. */ -final class DispatchMessageToHandler implements WAMPServerMiddleware +final readonly class DispatchMessageToHandler implements WAMPServerMiddleware { public function __construct( - private readonly UrlMatcherInterface $matcher, - private readonly MessageHandlerResolver $resolver, - private readonly ?EventDispatcherInterface $dispatcher = null, + private UrlMatcherInterface $matcher, + private MessageHandlerResolver $resolver, + private ?EventDispatcherInterface $dispatcher = null, ) {} /** diff --git a/src/WAMP/Middleware/UpdateTopicSubscriptions.php b/src/WAMP/Middleware/UpdateTopicSubscriptions.php index a8e50d9..b0e1aac 100644 --- a/src/WAMP/Middleware/UpdateTopicSubscriptions.php +++ b/src/WAMP/Middleware/UpdateTopicSubscriptions.php @@ -13,11 +13,11 @@ * The update topic subscriptions server middleware is responsible for updating the list of connections for each * active topic. */ -final class UpdateTopicSubscriptions implements WAMPServerMiddleware +final readonly class UpdateTopicSubscriptions implements WAMPServerMiddleware { public function __construct( - private readonly WAMPServerMiddleware $middleware, - private readonly TopicRegistry $topicRegistry, + private WAMPServerMiddleware $middleware, + private TopicRegistry $topicRegistry, ) {} /** diff --git a/src/WAMP/Topic.php b/src/WAMP/Topic.php index 3539d83..c2d591d 100644 --- a/src/WAMP/Topic.php +++ b/src/WAMP/Topic.php @@ -10,14 +10,14 @@ * * @implements \IteratorAggregate */ -final class Topic implements \IteratorAggregate, \Countable, \Stringable +final readonly class Topic implements \IteratorAggregate, \Countable, \Stringable { /** * @var \SplObjectStorage */ - private readonly \SplObjectStorage $subscribers; + private \SplObjectStorage $subscribers; - public function __construct(public readonly string $id) + public function __construct(public string $id) { $this->subscribers = new \SplObjectStorage(); } diff --git a/src/WAMP/WAMPMessageRequest.php b/src/WAMP/WAMPMessageRequest.php index c77d5a4..1711535 100644 --- a/src/WAMP/WAMPMessageRequest.php +++ b/src/WAMP/WAMPMessageRequest.php @@ -7,7 +7,7 @@ /** * The WAMP message request class encapsulates the matched route information for an incoming WAMP message. */ -final class WAMPMessageRequest +final readonly class WAMPMessageRequest { - public function __construct(public readonly ParameterBag $attributes) {} + public function __construct(public ParameterBag $attributes) {} } diff --git a/src/WebSocket/DefaultWebSocketConnection.php b/src/WebSocket/DefaultWebSocketConnection.php index 56c2101..de35d07 100644 --- a/src/WebSocket/DefaultWebSocketConnection.php +++ b/src/WebSocket/DefaultWebSocketConnection.php @@ -11,9 +11,9 @@ * The websocket connection is a connection class decorating another {@see Connection} adding support for * processing messages using the `ratchet/rfc6455` package. */ -final class DefaultWebSocketConnection implements WebSocketConnection +final readonly class DefaultWebSocketConnection implements WebSocketConnection { - public function __construct(private readonly Connection $connection) {} + public function __construct(private Connection $connection) {} public function getAttributeStore(): AttributeStore { diff --git a/src/WebSocket/WebSocketConnectionContext.php b/src/WebSocket/WebSocketConnectionContext.php index 6bfba43..6159f17 100644 --- a/src/WebSocket/WebSocketConnectionContext.php +++ b/src/WebSocket/WebSocketConnectionContext.php @@ -7,10 +7,10 @@ /** * The websocket connection context is a data object holding a reference to a connection and its message buffer. */ -final class WebSocketConnectionContext +final readonly class WebSocketConnectionContext { public function __construct( - public readonly WebSocketConnection $connection, - public readonly MessageBuffer $buffer, + public WebSocketConnection $connection, + public MessageBuffer $buffer, ) {} } diff --git a/tests/WAMP/MessageHandler/Fixtures/AdvancedMessageHandler.php b/tests/WAMP/MessageHandler/Fixtures/AdvancedMessageHandler.php index abe1e7f..6af39d8 100644 --- a/tests/WAMP/MessageHandler/Fixtures/AdvancedMessageHandler.php +++ b/tests/WAMP/MessageHandler/Fixtures/AdvancedMessageHandler.php @@ -4,7 +4,7 @@ use BabDev\WebSocket\Server\MessageHandler; -final class AdvancedMessageHandler implements MessageHandler +final readonly class AdvancedMessageHandler implements MessageHandler { - public function __construct(public readonly string $name) {} + public function __construct(public string $name) {} }