Skip to content

Commit a7a1e0d

Browse files
committed
PHPUnit 12, misc. updates
1 parent 2f31650 commit a7a1e0d

25 files changed

Lines changed: 86 additions & 103 deletions

.php-cs-fixer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
->setRules([
55
'@Symfony' => true,
66
'@Symfony:risky' => true,
7-
'@PHP82Migration' => true,
8-
'@PHP80Migration:risky' => true,
7+
'@PHP83Migration' => true,
8+
'@PHP82Migration:risky' => true,
99
'@PHPUnit100Migration:risky' => true,
1010
'array_syntax' => ['syntax' => 'short'],
1111
'blank_line_after_opening_tag' => false,

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
"ext-session": "*",
2424
"ext-sockets": "*",
2525
"phpstan/extension-installer": "^1.4.3",
26-
"phpstan/phpstan": "2.1.1",
27-
"phpstan/phpstan-phpunit": "2.0.3",
28-
"phpunit/phpunit": "11.5.2",
26+
"phpstan/phpstan": "2.1.4",
27+
"phpstan/phpstan-phpunit": "2.0.4",
28+
"phpunit/phpunit": "12.0.2",
2929
"psr/container": "^1.0 || ^2.0",
3030
"psr/event-dispatcher": "^1.0",
31-
"rector/rector": "2.0.6",
31+
"rector/rector": "2.0.9",
3232
"symfony/security-core": "^6.4 || ^7.2"
3333
},
3434
"conflict": {

rector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
__DIR__ . '/vendor/phpstan/phpstan-phpunit/extension.neon',
1313
__DIR__ . '/phpstan.neon',
1414
])
15-
->withPreparedSets(codeQuality: true)
15+
->withPhpSets()
16+
->withPreparedSets(codeQuality: true, phpunitCodeQuality: true)
1617
;

src/ReactPhpServer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
* The {@see ReactPhpServer} is an implementation of the server interface which runs a WebSocket server stack using
1414
* the ReactPHP library.
1515
*/
16-
final class ReactPhpServer implements Server
16+
final readonly class ReactPhpServer implements Server
1717
{
18-
private readonly LoopInterface $loop;
18+
private LoopInterface $loop;
1919

2020
public function __construct(
21-
private readonly ServerMiddleware $middleware,
22-
private readonly ServerInterface $socket,
21+
private ServerMiddleware $middleware,
22+
private ServerInterface $socket,
2323
?LoopInterface $loop = null
2424
) {
2525
gc_enable();

src/Session/Reader/PhpReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
final class PhpReader implements Reader
1313
{
14-
private const DELIMITER = '|';
14+
private const string DELIMITER = '|';
1515

1616
/**
1717
* @throws InvalidSession if the session data cannot be deserialized

src/Session/Storage/Proxy/ReadOnlySessionHandlerProxy.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function __construct(
2222
$this->sessionName = $this->optionsHandler->get('session.name');
2323
}
2424

25+
#[\Override]
2526
public function getId(): string
2627
{
2728
return $this->sessionId ?? parent::getId();
@@ -30,6 +31,7 @@ public function getId(): string
3031
/**
3132
* @throws ReadOnlySession if trying to change the session ID once it has been set
3233
*/
34+
#[\Override]
3335
public function setId(string $id): void
3436
{
3537
if (null !== $this->sessionId) {
@@ -39,6 +41,7 @@ public function setId(string $id): void
3941
$this->sessionId = $id;
4042
}
4143

44+
#[\Override]
4245
public function getName(): string
4346
{
4447
return $this->sessionName;
@@ -47,6 +50,7 @@ public function getName(): string
4750
/**
4851
* @throws ReadOnlySession
4952
*/
53+
#[\Override]
5054
public function setName(string $name): never
5155
{
5256
throw new ReadOnlySession(\sprintf('The session name cannot be changed in "%s".', self::class));

src/WAMP/Middleware/ParseWAMPMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
final class ParseWAMPMessage implements WebSocketServerMiddleware
2323
{
24-
private const WAMP_PROTOCOL_VERSION = 1;
24+
private const int WAMP_PROTOCOL_VERSION = 1;
2525

2626
/**
2727
* @var \SplObjectStorage<Connection, WAMPConnection>

tests/Connection/ReactSocketConnectionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
final class ReactSocketConnectionTest extends TestCase
1212
{
13-
private MockObject&ReactSocketConnectionInterface $reactConnection;
13+
private readonly MockObject&ReactSocketConnectionInterface $reactConnection;
1414

15-
private MockObject&AttributeStore $attributeStore;
15+
private readonly MockObject&AttributeStore $attributeStore;
1616

17-
private ReactSocketConnection $connection;
17+
private readonly ReactSocketConnection $connection;
1818

1919
protected function setUp(): void
2020
{

tests/Http/GuzzleRequestParserTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,9 @@ public function testConvertsToRequest(bool $valid, string $message): void
5151
$attributeStore->expects($this->once())
5252
->method('remove')
5353
->with('http.buffer');
54-
$this->assertInstanceOf(
55-
RequestInterface::class,
56-
(new GuzzleRequestParser())->parse($connection, $message)
57-
);
54+
$this->assertInstanceOf(RequestInterface::class, (new GuzzleRequestParser())->parse($connection, $message));
5855
} else {
59-
$this->assertNull((new GuzzleRequestParser())->parse($connection, $message));
56+
$this->assertNotInstanceOf(RequestInterface::class, (new GuzzleRequestParser())->parse($connection, $message));
6057
}
6158
}
6259

tests/Http/Middleware/ParseHttpRequestTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
final class ParseHttpRequestTest extends TestCase
1818
{
19-
private MockObject&ServerMiddleware $decoratedMiddleware;
20-
private MockObject&RequestParser $requestParser;
21-
private ParseHttpRequest $middleware;
19+
private readonly MockObject&ServerMiddleware $decoratedMiddleware;
20+
private readonly MockObject&RequestParser $requestParser;
21+
private readonly ParseHttpRequest $middleware;
2222

2323
protected function setUp(): void
2424
{

0 commit comments

Comments
 (0)