Skip to content

Commit

Permalink
Drop PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Sep 15, 2023
1 parent b0b400d commit 1523926
Show file tree
Hide file tree
Showing 23 changed files with 59 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_81,
LevelSetList::UP_TO_PHP_82,
SetList::CODE_QUALITY,
PHPUnitLevelSetList::UP_TO_PHPUNIT_100,
]);
Expand Down
2 changes: 1 addition & 1 deletion src/Connection/ClosesConnectionWithResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
trait ClosesConnectionWithResponse
{
/**
* @param int $code Status code
* @param int $code Status code
* @param array<string, string|string[]> $headers Response headers
*/
private function close(Connection $connection, int $code = 400, array $headers = []): void
Expand Down
4 changes: 2 additions & 2 deletions src/Connection/Event/ConnectionClosed.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions src/Connection/Event/ConnectionError.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Connection/Event/ConnectionOpened.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions src/Connection/ReactSocketConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Http/Middleware/ParseHttpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
) {}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Session/Middleware/InitializeSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
) {}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Session/SessionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
12 changes: 6 additions & 6 deletions src/Session/Storage/ReadOnlyNativeSessionStorageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions src/WAMP/DefaultWAMPConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/WAMP/Middleware/DispatchMessageToHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/WAMP/Middleware/UpdateTopicSubscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/WAMP/Topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
*
* @implements \IteratorAggregate<array-key, WAMPConnection>
*/
final class Topic implements \IteratorAggregate, \Countable, \Stringable
final readonly class Topic implements \IteratorAggregate, \Countable, \Stringable
{
/**
* @var \SplObjectStorage<WAMPConnection, null>
*/
private readonly \SplObjectStorage $subscribers;
private \SplObjectStorage $subscribers;

public function __construct(public readonly string $id)
public function __construct(public string $id)
{
$this->subscribers = new \SplObjectStorage();
}
Expand Down
4 changes: 2 additions & 2 deletions src/WAMP/WAMPMessageRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
}
4 changes: 2 additions & 2 deletions src/WebSocket/DefaultWebSocketConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions src/WebSocket/WebSocketConnectionContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {}
}
4 changes: 2 additions & 2 deletions tests/WAMP/MessageHandler/Fixtures/AdvancedMessageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
}

0 comments on commit 1523926

Please sign in to comment.