Skip to content

Commit aada5c4

Browse files
committed
Run CS fixer
1 parent a5ac1be commit aada5c4

21 files changed

+52
-61
lines changed

rector.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
<?php declare(strict_types=1);
22

33
use Rector\Config\RectorConfig;
4-
use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector;
5-
use Rector\PHPUnit\CodeQuality\Rector\Class_\AddSeeTestAnnotationRector;
64

75
return RectorConfig::configure()
86
->withPaths([
97
__DIR__.'/src',
108
__DIR__.'/tests',
119
])
12-
->withSkip([
13-
/*
14-
* Skip selected rules
15-
*/
16-
AddLiteralSeparatorToNumberRector::class,
17-
AddSeeTestAnnotationRector::class,
18-
])
1910
->withImportNames(importShortClasses: false)
2011
->withPHPStanConfigs([
2112
__DIR__ . '/vendor/phpstan/phpstan-phpunit/extension.neon',

src/Http/Middleware/RestrictToAllowedOrigins.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function onOpen(Connection $connection): void
3737
$request = $connection->getAttributeStore()->get('http.request');
3838

3939
if (!$request instanceof RequestInterface) {
40-
throw new MissingRequest(sprintf('The "%s" middleware requires the HTTP request has been processed. Ensure the "%s" middleware (or a custom middleware setting the "http.request" in the attribute store) has been run.', self::class, ParseHttpRequest::class));
40+
throw new MissingRequest(\sprintf('The "%s" middleware requires the HTTP request has been processed. Ensure the "%s" middleware (or a custom middleware setting the "http.request" in the attribute store) has been run.', self::class, ParseHttpRequest::class));
4141
}
4242

4343
if ([] !== $this->allowedOrigins) {

src/Session/Middleware/InitializeSession.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function onOpen(Connection $connection): void
3838
$request = $connection->getAttributeStore()->get('http.request');
3939

4040
if (!$request instanceof RequestInterface) {
41-
throw new MissingRequest(sprintf('The "%s" middleware requires the HTTP request has been processed. Ensure the "%s" middleware (or a custom middleware setting the "http.request" in the attribute store) has been run.', self::class, ParseHttpRequest::class));
41+
throw new MissingRequest(\sprintf('The "%s" middleware requires the HTTP request has been processed. Ensure the "%s" middleware (or a custom middleware setting the "http.request" in the attribute store) has been run.', self::class, ParseHttpRequest::class));
4242
}
4343

4444
$session = $this->sessionFactory->createSession();

src/Session/Reader/PhpReader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ private function getSerializedSegmentLength(string $data): int|false
6363
case 'N':
6464
return 2;
6565

66-
// Boolean value
66+
// Boolean value
6767
case 'b':
6868
return 4;
6969

70-
// Integer or floating point value
70+
// Integer or floating point value
7171
case 'i':
7272
case 'd':
7373
$end = strpos($data, ';');
7474

7575
return false === $end ? false : $end + 1;
7676

77-
// String value
77+
// String value
7878
case 's':
7979
if (!preg_match('/^s:\d+:"/', $data, $matches)) {
8080
return false;
@@ -83,7 +83,7 @@ private function getSerializedSegmentLength(string $data): int|false
8383
// Add characters for the closing quote and semicolon
8484
return \strlen($matches[0]) + (int) substr($matches[0], 2, -2) + 2;
8585

86-
// Array value
86+
// Array value
8787
case 'a':
8888
if (!preg_match('/^a:\d+:\{/', $data, $matches)) {
8989
return false;
@@ -116,7 +116,7 @@ private function getSerializedSegmentLength(string $data): int|false
116116
// Add characters for the closing brace
117117
return $offset + 1;
118118

119-
// Unsupported value
119+
// Unsupported value
120120
default:
121121
return false;
122122
}

src/Session/Storage/Proxy/ReadOnlySessionHandlerProxy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getId(): string
3333
public function setId(string $id): void
3434
{
3535
if (null !== $this->sessionId) {
36-
throw new ReadOnlySession(sprintf('The session ID cannot be changed once set in "%s".', self::class));
36+
throw new ReadOnlySession(\sprintf('The session ID cannot be changed once set in "%s".', self::class));
3737
}
3838

3939
$this->sessionId = $id;
@@ -49,7 +49,7 @@ public function getName(): string
4949
*/
5050
public function setName(string $name): never
5151
{
52-
throw new ReadOnlySession(sprintf('The session name cannot be changed in "%s".', self::class));
52+
throw new ReadOnlySession(\sprintf('The session name cannot be changed in "%s".', self::class));
5353
}
5454

5555
public function open(string $path, string $name): bool

src/Session/Storage/ReadOnlyNativeSessionStorage.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ public function getName(): string
112112
*/
113113
public function setName(string $name): never
114114
{
115-
throw new ReadOnlySession(sprintf('The session name cannot be changed in "%s".', self::class));
115+
throw new ReadOnlySession(\sprintf('The session name cannot be changed in "%s".', self::class));
116116
}
117117

118118
/**
119119
* @throws ReadOnlySession
120120
*/
121121
public function regenerate(bool $destroy = false, ?int $lifetime = null): never
122122
{
123-
throw new ReadOnlySession(sprintf('The session cannot be regenerated in "%s".', self::class));
123+
throw new ReadOnlySession(\sprintf('The session cannot be regenerated in "%s".', self::class));
124124
}
125125

126126
public function save(): void
@@ -154,7 +154,7 @@ public function registerBag(SessionBagInterface $bag): void
154154
public function getBag(string $name): SessionBagInterface
155155
{
156156
if (!isset($this->bags[$name])) {
157-
throw new \InvalidArgumentException(sprintf('The SessionBagInterface "%s" is not registered.', $name));
157+
throw new \InvalidArgumentException(\sprintf('The SessionBagInterface "%s" is not registered.', $name));
158158
}
159159

160160
if (!$this->started) {
@@ -232,7 +232,7 @@ private function createReader(): Reader
232232
'php' => new PhpReader(),
233233
'php_binary' => new PhpBinaryReader(),
234234
'php_serialize' => new PhpSerializeReader(),
235-
default => throw new SessionMisconfigured(sprintf('The "%s" serialize handler is not supported in "%s", set the PHP "session.serialize_handler" option to a supported handler or inject your own "%s" instance.', $this->optionsHandler->get('session.serialize_handler'), self::class, Reader::class)),
235+
default => throw new SessionMisconfigured(\sprintf('The "%s" serialize handler is not supported in "%s", set the PHP "session.serialize_handler" option to a supported handler or inject your own "%s" instance.', $this->optionsHandler->get('session.serialize_handler'), self::class, Reader::class)),
236236
};
237237
}
238238

src/WAMP/ArrayTopicRegistry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class ArrayTopicRegistry implements TopicRegistry
2121
public function add(Topic $topic): void
2222
{
2323
if ($this->has($topic->id)) {
24-
throw new TopicAlreadyRegistered(sprintf('A topic for URI "%s" is already registered.', $topic->id));
24+
throw new TopicAlreadyRegistered(\sprintf('A topic for URI "%s" is already registered.', $topic->id));
2525
}
2626

2727
$this->topics[$topic->id] = $topic;
@@ -40,7 +40,7 @@ public function all(): iterable
4040
*/
4141
public function get(string $id): Topic
4242
{
43-
return $this->topics[$id] ?? throw new TopicNotFound(sprintf('A topic for URI "%s" is not registered.', $id));
43+
return $this->topics[$id] ?? throw new TopicNotFound(\sprintf('A topic for URI "%s" is not registered.', $id));
4444
}
4545

4646
public function has(string $id): bool

src/WAMP/DefaultWAMPConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getConnection(): Connection
3333
public function send(string|DataInterface $data): void
3434
{
3535
if ($data instanceof DataInterface && !$this->connection instanceof WebSocketConnection) {
36-
throw new UnsupportedConnection(sprintf('To send a "%s" implementation, "%s" must decorate an instance of "%s".', DataInterface::class, self::class, WebSocketConnection::class));
36+
throw new UnsupportedConnection(\sprintf('To send a "%s" implementation, "%s" must decorate an instance of "%s".', DataInterface::class, self::class, WebSocketConnection::class));
3737
}
3838

3939
if ($this->connection instanceof WebSocketConnection) {

src/WAMP/MessageHandler/DefaultMessageHandlerResolver.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,29 @@ final class DefaultMessageHandlerResolver implements MessageHandlerResolver
2525
public function findMessageHandler(WAMPMessageRequest $request): MessageHandler|MessageMiddleware
2626
{
2727
if (!$handler = $request->attributes->get('_controller')) {
28-
throw new InvalidRequest(sprintf('Cannot resolve a message handler in "%s" when the "_controller" parameter is not set in the request attributes.', self::class));
28+
throw new InvalidRequest(\sprintf('Cannot resolve a message handler in "%s" when the "_controller" parameter is not set in the request attributes.', self::class));
2929
}
3030

3131
if ($handler instanceof MessageHandler || $handler instanceof MessageMiddleware) {
3232
return $handler;
3333
}
3434

3535
if (!\is_string($handler)) {
36-
throw new InvalidRequest(sprintf('The "%s" class only supports strings or an instance of "%s" or "%s" as the "_controller" parameter in the request attributes, "%s" given.', self::class, MessageHandler::class, MessageMiddleware::class, get_debug_type($handler)));
36+
throw new InvalidRequest(\sprintf('The "%s" class only supports strings or an instance of "%s" or "%s" as the "_controller" parameter in the request attributes, "%s" given.', self::class, MessageHandler::class, MessageMiddleware::class, get_debug_type($handler)));
3737
}
3838

3939
if (!class_exists($handler)) {
40-
throw new UnknownMessageHandler(sprintf('Message handler "%s" does not exist.', $handler));
40+
throw new UnknownMessageHandler(\sprintf('Message handler "%s" does not exist.', $handler));
4141
}
4242

4343
try {
4444
$handler = new $handler();
4545
} catch (\ArgumentCountError $exception) {
46-
throw new CannotInstantiateMessageHandler($handler, sprintf('Cannot instantiate message handler "%s" in "%s", only handlers with no constructors can be instantiated by this resolver.', $handler, self::class), 0, $exception);
46+
throw new CannotInstantiateMessageHandler($handler, \sprintf('Cannot instantiate message handler "%s" in "%s", only handlers with no constructors can be instantiated by this resolver.', $handler, self::class), 0, $exception);
4747
}
4848

4949
if (!$handler instanceof MessageHandler && !$handler instanceof MessageMiddleware) {
50-
throw new InvalidMessageHandler(sprintf('A message handler resolver can only return instances of "%s" or "%s", ensure "%s" implements the right interface.', MessageHandler::class, MessageMiddleware::class, $handler::class));
50+
throw new InvalidMessageHandler(\sprintf('A message handler resolver can only return instances of "%s" or "%s", ensure "%s" implements the right interface.', MessageHandler::class, MessageMiddleware::class, $handler::class));
5151
}
5252

5353
return $handler;

src/WAMP/MessageHandler/PsrContainerMessageHandlerResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ public function __construct(private ContainerInterface $container) {}
2626
public function findMessageHandler(WAMPMessageRequest $request): MessageHandler|MessageMiddleware
2727
{
2828
if (!$handler = $request->attributes->get('_controller')) {
29-
throw new InvalidRequest(sprintf('Cannot resolve a message handler in "%s" when the "_controller" parameter is not set in the request attributes.', self::class));
29+
throw new InvalidRequest(\sprintf('Cannot resolve a message handler in "%s" when the "_controller" parameter is not set in the request attributes.', self::class));
3030
}
3131

3232
if ($handler instanceof MessageHandler || $handler instanceof MessageMiddleware) {
3333
return $handler;
3434
}
3535

3636
if (!\is_string($handler)) {
37-
throw new InvalidRequest(sprintf('The "%s" class only supports strings or an instance of "%s" or "%s" as the "_controller" parameter in the request attributes, "%s" given.', self::class, MessageHandler::class, MessageMiddleware::class, get_debug_type($handler)));
37+
throw new InvalidRequest(\sprintf('The "%s" class only supports strings or an instance of "%s" or "%s" as the "_controller" parameter in the request attributes, "%s" given.', self::class, MessageHandler::class, MessageMiddleware::class, get_debug_type($handler)));
3838
}
3939

4040
if (!$this->container->has($handler)) {
41-
throw new UnknownMessageHandler(sprintf('A message handler for service ID "%s" does not exist in the container.', $handler));
41+
throw new UnknownMessageHandler(\sprintf('A message handler for service ID "%s" does not exist in the container.', $handler));
4242
}
4343

4444
$handler = $this->container->get($handler);
4545

4646
if (!$handler instanceof MessageHandler && !$handler instanceof MessageMiddleware) {
47-
throw new InvalidMessageHandler(sprintf('A message handler resolver can only return instances of "%s" or "%s", "%s" returned.', MessageHandler::class, MessageMiddleware::class, get_debug_type($handler)));
47+
throw new InvalidMessageHandler(\sprintf('A message handler resolver can only return instances of "%s" or "%s", "%s" returned.', MessageHandler::class, MessageMiddleware::class, get_debug_type($handler)));
4848
}
4949

5050
return $handler;

0 commit comments

Comments
 (0)