diff --git a/rector.php b/rector.php index cb8ce52..7202dd1 100644 --- a/rector.php +++ b/rector.php @@ -1,21 +1,12 @@ withPaths([ __DIR__.'/src', __DIR__.'/tests', ]) - ->withSkip([ - /* - * Skip selected rules - */ - AddLiteralSeparatorToNumberRector::class, - AddSeeTestAnnotationRector::class, - ]) ->withImportNames(importShortClasses: false) ->withPHPStanConfigs([ __DIR__ . '/vendor/phpstan/phpstan-phpunit/extension.neon', diff --git a/src/Http/Middleware/RestrictToAllowedOrigins.php b/src/Http/Middleware/RestrictToAllowedOrigins.php index 65853d1..00b271d 100644 --- a/src/Http/Middleware/RestrictToAllowedOrigins.php +++ b/src/Http/Middleware/RestrictToAllowedOrigins.php @@ -37,7 +37,7 @@ public function onOpen(Connection $connection): void $request = $connection->getAttributeStore()->get('http.request'); if (!$request instanceof RequestInterface) { - 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)); + 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)); } if ([] !== $this->allowedOrigins) { diff --git a/src/Session/Middleware/InitializeSession.php b/src/Session/Middleware/InitializeSession.php index 144e733..640228b 100644 --- a/src/Session/Middleware/InitializeSession.php +++ b/src/Session/Middleware/InitializeSession.php @@ -38,7 +38,7 @@ public function onOpen(Connection $connection): void $request = $connection->getAttributeStore()->get('http.request'); if (!$request instanceof RequestInterface) { - 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)); + 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)); } $session = $this->sessionFactory->createSession(); diff --git a/src/Session/Reader/PhpReader.php b/src/Session/Reader/PhpReader.php index 17892d1..6f65228 100644 --- a/src/Session/Reader/PhpReader.php +++ b/src/Session/Reader/PhpReader.php @@ -63,18 +63,18 @@ private function getSerializedSegmentLength(string $data): int|false case 'N': return 2; - // Boolean value + // Boolean value case 'b': return 4; - // Integer or floating point value + // Integer or floating point value case 'i': case 'd': $end = strpos($data, ';'); return false === $end ? false : $end + 1; - // String value + // String value case 's': if (!preg_match('/^s:\d+:"/', $data, $matches)) { return false; @@ -83,7 +83,7 @@ private function getSerializedSegmentLength(string $data): int|false // Add characters for the closing quote and semicolon return \strlen($matches[0]) + (int) substr($matches[0], 2, -2) + 2; - // Array value + // Array value case 'a': if (!preg_match('/^a:\d+:\{/', $data, $matches)) { return false; @@ -116,7 +116,7 @@ private function getSerializedSegmentLength(string $data): int|false // Add characters for the closing brace return $offset + 1; - // Unsupported value + // Unsupported value default: return false; } diff --git a/src/Session/Storage/Proxy/ReadOnlySessionHandlerProxy.php b/src/Session/Storage/Proxy/ReadOnlySessionHandlerProxy.php index a3794ca..360008f 100644 --- a/src/Session/Storage/Proxy/ReadOnlySessionHandlerProxy.php +++ b/src/Session/Storage/Proxy/ReadOnlySessionHandlerProxy.php @@ -33,7 +33,7 @@ public function getId(): string public function setId(string $id): void { if (null !== $this->sessionId) { - throw new ReadOnlySession(sprintf('The session ID cannot be changed once set in "%s".', self::class)); + throw new ReadOnlySession(\sprintf('The session ID cannot be changed once set in "%s".', self::class)); } $this->sessionId = $id; @@ -49,7 +49,7 @@ public function getName(): string */ public function setName(string $name): never { - throw new ReadOnlySession(sprintf('The session name cannot be changed in "%s".', self::class)); + throw new ReadOnlySession(\sprintf('The session name cannot be changed in "%s".', self::class)); } public function open(string $path, string $name): bool diff --git a/src/Session/Storage/ReadOnlyNativeSessionStorage.php b/src/Session/Storage/ReadOnlyNativeSessionStorage.php index 7ebb4e9..d53a5de 100644 --- a/src/Session/Storage/ReadOnlyNativeSessionStorage.php +++ b/src/Session/Storage/ReadOnlyNativeSessionStorage.php @@ -112,7 +112,7 @@ public function getName(): string */ public function setName(string $name): never { - throw new ReadOnlySession(sprintf('The session name cannot be changed in "%s".', self::class)); + throw new ReadOnlySession(\sprintf('The session name cannot be changed in "%s".', self::class)); } /** @@ -120,7 +120,7 @@ public function setName(string $name): never */ public function regenerate(bool $destroy = false, ?int $lifetime = null): never { - throw new ReadOnlySession(sprintf('The session cannot be regenerated in "%s".', self::class)); + throw new ReadOnlySession(\sprintf('The session cannot be regenerated in "%s".', self::class)); } public function save(): void @@ -154,7 +154,7 @@ public function registerBag(SessionBagInterface $bag): void public function getBag(string $name): SessionBagInterface { if (!isset($this->bags[$name])) { - throw new \InvalidArgumentException(sprintf('The SessionBagInterface "%s" is not registered.', $name)); + throw new \InvalidArgumentException(\sprintf('The SessionBagInterface "%s" is not registered.', $name)); } if (!$this->started) { @@ -232,7 +232,7 @@ private function createReader(): Reader 'php' => new PhpReader(), 'php_binary' => new PhpBinaryReader(), 'php_serialize' => new PhpSerializeReader(), - 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)), + 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)), }; } diff --git a/src/WAMP/ArrayTopicRegistry.php b/src/WAMP/ArrayTopicRegistry.php index 44ea069..50e57b6 100644 --- a/src/WAMP/ArrayTopicRegistry.php +++ b/src/WAMP/ArrayTopicRegistry.php @@ -21,7 +21,7 @@ final class ArrayTopicRegistry implements TopicRegistry public function add(Topic $topic): void { if ($this->has($topic->id)) { - throw new TopicAlreadyRegistered(sprintf('A topic for URI "%s" is already registered.', $topic->id)); + throw new TopicAlreadyRegistered(\sprintf('A topic for URI "%s" is already registered.', $topic->id)); } $this->topics[$topic->id] = $topic; @@ -40,7 +40,7 @@ public function all(): iterable */ public function get(string $id): Topic { - return $this->topics[$id] ?? throw new TopicNotFound(sprintf('A topic for URI "%s" is not registered.', $id)); + return $this->topics[$id] ?? throw new TopicNotFound(\sprintf('A topic for URI "%s" is not registered.', $id)); } public function has(string $id): bool diff --git a/src/WAMP/DefaultWAMPConnection.php b/src/WAMP/DefaultWAMPConnection.php index 0dd2a5c..e0d7c6d 100644 --- a/src/WAMP/DefaultWAMPConnection.php +++ b/src/WAMP/DefaultWAMPConnection.php @@ -33,7 +33,7 @@ public function getConnection(): Connection public function send(string|DataInterface $data): void { if ($data instanceof DataInterface && !$this->connection instanceof WebSocketConnection) { - throw new UnsupportedConnection(sprintf('To send a "%s" implementation, "%s" must decorate an instance of "%s".', DataInterface::class, self::class, WebSocketConnection::class)); + throw new UnsupportedConnection(\sprintf('To send a "%s" implementation, "%s" must decorate an instance of "%s".', DataInterface::class, self::class, WebSocketConnection::class)); } if ($this->connection instanceof WebSocketConnection) { diff --git a/src/WAMP/MessageHandler/DefaultMessageHandlerResolver.php b/src/WAMP/MessageHandler/DefaultMessageHandlerResolver.php index 2694b11..397e766 100644 --- a/src/WAMP/MessageHandler/DefaultMessageHandlerResolver.php +++ b/src/WAMP/MessageHandler/DefaultMessageHandlerResolver.php @@ -25,7 +25,7 @@ final class DefaultMessageHandlerResolver implements MessageHandlerResolver public function findMessageHandler(WAMPMessageRequest $request): MessageHandler|MessageMiddleware { if (!$handler = $request->attributes->get('_controller')) { - throw new InvalidRequest(sprintf('Cannot resolve a message handler in "%s" when the "_controller" parameter is not set in the request attributes.', self::class)); + throw new InvalidRequest(\sprintf('Cannot resolve a message handler in "%s" when the "_controller" parameter is not set in the request attributes.', self::class)); } if ($handler instanceof MessageHandler || $handler instanceof MessageMiddleware) { @@ -33,21 +33,21 @@ public function findMessageHandler(WAMPMessageRequest $request): MessageHandler| } if (!\is_string($handler)) { - 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))); + 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))); } if (!class_exists($handler)) { - throw new UnknownMessageHandler(sprintf('Message handler "%s" does not exist.', $handler)); + throw new UnknownMessageHandler(\sprintf('Message handler "%s" does not exist.', $handler)); } try { $handler = new $handler(); } catch (\ArgumentCountError $exception) { - 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); + 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); } if (!$handler instanceof MessageHandler && !$handler instanceof MessageMiddleware) { - 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)); + 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)); } return $handler; diff --git a/src/WAMP/MessageHandler/PsrContainerMessageHandlerResolver.php b/src/WAMP/MessageHandler/PsrContainerMessageHandlerResolver.php index 1293a4f..339f6bd 100644 --- a/src/WAMP/MessageHandler/PsrContainerMessageHandlerResolver.php +++ b/src/WAMP/MessageHandler/PsrContainerMessageHandlerResolver.php @@ -26,7 +26,7 @@ public function __construct(private ContainerInterface $container) {} public function findMessageHandler(WAMPMessageRequest $request): MessageHandler|MessageMiddleware { if (!$handler = $request->attributes->get('_controller')) { - throw new InvalidRequest(sprintf('Cannot resolve a message handler in "%s" when the "_controller" parameter is not set in the request attributes.', self::class)); + throw new InvalidRequest(\sprintf('Cannot resolve a message handler in "%s" when the "_controller" parameter is not set in the request attributes.', self::class)); } if ($handler instanceof MessageHandler || $handler instanceof MessageMiddleware) { @@ -34,17 +34,17 @@ public function findMessageHandler(WAMPMessageRequest $request): MessageHandler| } if (!\is_string($handler)) { - 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))); + 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))); } if (!$this->container->has($handler)) { - throw new UnknownMessageHandler(sprintf('A message handler for service ID "%s" does not exist in the container.', $handler)); + throw new UnknownMessageHandler(\sprintf('A message handler for service ID "%s" does not exist in the container.', $handler)); } $handler = $this->container->get($handler); if (!$handler instanceof MessageHandler && !$handler instanceof MessageMiddleware) { - 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))); + 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))); } return $handler; diff --git a/src/WAMP/Middleware/DispatchMessageToHandler.php b/src/WAMP/Middleware/DispatchMessageToHandler.php index f88c32d..accc987 100644 --- a/src/WAMP/Middleware/DispatchMessageToHandler.php +++ b/src/WAMP/Middleware/DispatchMessageToHandler.php @@ -114,7 +114,7 @@ public function onCall(WAMPConnection $connection, string $id, string $resolvedU $connection->callError( $id, $this->errorUriResolver->resolve('not-found'), - sprintf('Could not find a message handler for URI "%s".', $resolvedUri), + \sprintf('Could not find a message handler for URI "%s".', $resolvedUri), [ 'code' => 404, 'uri' => $resolvedUri, @@ -130,7 +130,7 @@ public function onCall(WAMPConnection $connection, string $id, string $resolvedU $connection->callError( $id, $this->errorUriResolver->resolve('not-found'), - sprintf('Could not find a message handler for URI "%s".', $resolvedUri), + \sprintf('Could not find a message handler for URI "%s".', $resolvedUri), [ 'code' => 404, 'uri' => $resolvedUri, @@ -141,7 +141,7 @@ public function onCall(WAMPConnection $connection, string $id, string $resolvedU } if (!$handler instanceof RPCMessageHandler && !$handler instanceof RPCMessageMiddleware) { - throw new InvalidMessageHandler(sprintf('The message handler for a "CALL" message must be an instance of "%s" or "%s", ensure "%s" implements the right interface.', RPCMessageHandler::class, RPCMessageMiddleware::class, $handler::class)); + throw new InvalidMessageHandler(\sprintf('The message handler for a "CALL" message must be an instance of "%s" or "%s", ensure "%s" implements the right interface.', RPCMessageHandler::class, RPCMessageMiddleware::class, $handler::class)); } $handler->onCall($connection, $id, $request, $params); @@ -165,7 +165,7 @@ public function onSubscribe(WAMPConnection $connection, Topic $topic): void $topic->id, [ 'error' => true, - 'message' => sprintf('Could not find a message handler for URI "%s".', $topic->id), + 'message' => \sprintf('Could not find a message handler for URI "%s".', $topic->id), 'code' => 404, 'uri' => $topic->id, ] @@ -181,7 +181,7 @@ public function onSubscribe(WAMPConnection $connection, Topic $topic): void $topic->id, [ 'error' => true, - 'message' => sprintf('Could not find a message handler for URI "%s".', $topic->id), + 'message' => \sprintf('Could not find a message handler for URI "%s".', $topic->id), 'code' => 404, 'uri' => $topic->id, ] @@ -191,7 +191,7 @@ public function onSubscribe(WAMPConnection $connection, Topic $topic): void } if (!$handler instanceof TopicMessageHandler && !$handler instanceof TopicMessageMiddleware) { - throw new InvalidMessageHandler(sprintf('The message handler for a "SUBSCRIBE" message must be an instance of "%s" or "%s", ensure "%s" implements the right interface.', TopicMessageHandler::class, TopicMessageMiddleware::class, $handler::class)); + throw new InvalidMessageHandler(\sprintf('The message handler for a "SUBSCRIBE" message must be an instance of "%s" or "%s", ensure "%s" implements the right interface.', TopicMessageHandler::class, TopicMessageMiddleware::class, $handler::class)); } $handler->onSubscribe($connection, $topic, $request); @@ -215,7 +215,7 @@ public function onUnsubscribe(WAMPConnection $connection, Topic $topic): void $topic->id, [ 'error' => true, - 'message' => sprintf('Could not find a message handler for URI "%s".', $topic->id), + 'message' => \sprintf('Could not find a message handler for URI "%s".', $topic->id), 'code' => 404, 'uri' => $topic->id, ] @@ -231,7 +231,7 @@ public function onUnsubscribe(WAMPConnection $connection, Topic $topic): void $topic->id, [ 'error' => true, - 'message' => sprintf('Could not find a message handler for URI "%s".', $topic->id), + 'message' => \sprintf('Could not find a message handler for URI "%s".', $topic->id), 'code' => 404, 'uri' => $topic->id, ] @@ -241,7 +241,7 @@ public function onUnsubscribe(WAMPConnection $connection, Topic $topic): void } if (!$handler instanceof TopicMessageHandler && !$handler instanceof TopicMessageMiddleware) { - throw new InvalidMessageHandler(sprintf('The message handler for a "UNSUBSCRIBE" message must be an instance of "%s" or "%s", ensure "%s" implements the right interface.', TopicMessageHandler::class, TopicMessageMiddleware::class, $handler::class)); + throw new InvalidMessageHandler(\sprintf('The message handler for a "UNSUBSCRIBE" message must be an instance of "%s" or "%s", ensure "%s" implements the right interface.', TopicMessageHandler::class, TopicMessageMiddleware::class, $handler::class)); } $handler->onUnsubscribe($connection, $topic, $request); @@ -269,7 +269,7 @@ public function onPublish(WAMPConnection $connection, Topic $topic, array|string $topic->id, [ 'error' => true, - 'message' => sprintf('Could not find a message handler for URI "%s".', $topic->id), + 'message' => \sprintf('Could not find a message handler for URI "%s".', $topic->id), 'code' => 404, 'uri' => $topic->id, ] @@ -285,7 +285,7 @@ public function onPublish(WAMPConnection $connection, Topic $topic, array|string $topic->id, [ 'error' => true, - 'message' => sprintf('Could not find a message handler for URI "%s".', $topic->id), + 'message' => \sprintf('Could not find a message handler for URI "%s".', $topic->id), 'code' => 404, 'uri' => $topic->id, ] @@ -295,7 +295,7 @@ public function onPublish(WAMPConnection $connection, Topic $topic, array|string } if (!$handler instanceof TopicMessageHandler && !$handler instanceof TopicMessageMiddleware) { - throw new InvalidMessageHandler(sprintf('The message handler for a "PUBLISH" message must be an instance of "%s" or "%s", ensure "%s" implements the right interface.', TopicMessageHandler::class, TopicMessageMiddleware::class, $handler::class)); + throw new InvalidMessageHandler(\sprintf('The message handler for a "PUBLISH" message must be an instance of "%s" or "%s", ensure "%s" implements the right interface.', TopicMessageHandler::class, TopicMessageMiddleware::class, $handler::class)); } $handler->onPublish($connection, $topic, $request, $event, $exclude, $eligible); @@ -309,7 +309,7 @@ private function route(string $uri): WAMPMessageRequest try { $parameters = $this->matcher->match($uri); } catch (ResourceNotFoundException $exception) { - throw new RouteNotFound(sprintf('Could not find a message handler for URI "%s".', $uri), $exception->getCode(), $exception); + throw new RouteNotFound(\sprintf('Could not find a message handler for URI "%s".', $uri), $exception->getCode(), $exception); } // This snippet emulates the HttpKernel's RouterListener behavior for setting route attributes to the request diff --git a/src/WAMP/Middleware/ParseWAMPMessage.php b/src/WAMP/Middleware/ParseWAMPMessage.php index 8afa0ca..7a68a2c 100644 --- a/src/WAMP/Middleware/ParseWAMPMessage.php +++ b/src/WAMP/Middleware/ParseWAMPMessage.php @@ -144,7 +144,7 @@ public function onMessage(Connection $connection, string $data): void break; default: - throw new UnsupportedMessageType($message[0], sprintf('Unsupported WAMP message type "%s".', $message[0])); + throw new UnsupportedMessageType($message[0], \sprintf('Unsupported WAMP message type "%s".', $message[0])); } } diff --git a/src/WAMP/Topic.php b/src/WAMP/Topic.php index 1e328f8..dc5cafe 100644 --- a/src/WAMP/Topic.php +++ b/src/WAMP/Topic.php @@ -33,7 +33,7 @@ public function __toString(): string public function add(Connection $connection): void { if (!$connection instanceof WAMPConnection) { - throw new UnsupportedConnection(sprintf('Connections registered in "%s" must be an instance of "%s", "%s" given.', self::class, WAMPConnection::class, get_debug_type($connection))); + throw new UnsupportedConnection(\sprintf('Connections registered in "%s" must be an instance of "%s", "%s" given.', self::class, WAMPConnection::class, get_debug_type($connection))); } $this->subscribers->attach($connection); diff --git a/src/WebSocket/Middleware/EstablishWebSocketConnection.php b/src/WebSocket/Middleware/EstablishWebSocketConnection.php index aa4c6fb..046ac39 100644 --- a/src/WebSocket/Middleware/EstablishWebSocketConnection.php +++ b/src/WebSocket/Middleware/EstablishWebSocketConnection.php @@ -71,7 +71,7 @@ public function onOpen(Connection $connection): void $request = $connection->getAttributeStore()->get('http.request'); if (!$request instanceof RequestInterface) { - 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)); + 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)); } $connection->getAttributeStore()->set('websocket.closing', false); diff --git a/tests/ReactPhpServerTest.php b/tests/ReactPhpServerTest.php index 47fa492..31f7120 100644 --- a/tests/ReactPhpServerTest.php +++ b/tests/ReactPhpServerTest.php @@ -89,7 +89,7 @@ public function testOnData(): void $client = socket_create(\AF_INET, \SOCK_STREAM, \SOL_TCP); if (false === $client) { - self::fail(sprintf('Could not create the socket for testing: %s', socket_strerror(socket_last_error()))); + self::fail(\sprintf('Could not create the socket for testing: %s', socket_strerror(socket_last_error()))); } socket_set_option($client, \SOL_SOCKET, \SO_REUSEADDR, 1); @@ -120,7 +120,7 @@ public function testOnEnd(): void $client = socket_create(\AF_INET, \SOCK_STREAM, \SOL_TCP); if (false === $client) { - self::fail(sprintf('Could not create the socket for testing: %s', socket_strerror(socket_last_error()))); + self::fail(\sprintf('Could not create the socket for testing: %s', socket_strerror(socket_last_error()))); } socket_set_option($client, \SOL_SOCKET, \SO_REUSEADDR, 1); @@ -156,7 +156,7 @@ public function testOnError(): void $client = socket_create(\AF_INET, \SOCK_STREAM, \SOL_TCP); if (false === $client) { - self::fail(sprintf('Could not create the socket for testing: %s', socket_strerror(socket_last_error()))); + self::fail(\sprintf('Could not create the socket for testing: %s', socket_strerror(socket_last_error()))); } socket_set_option($client, \SOL_SOCKET, \SO_REUSEADDR, 1); diff --git a/tests/Session/Middleware/InitializeSessionTest.php b/tests/Session/Middleware/InitializeSessionTest.php index 95e698a..01e2aee 100644 --- a/tests/Session/Middleware/InitializeSessionTest.php +++ b/tests/Session/Middleware/InitializeSessionTest.php @@ -257,7 +257,7 @@ public function testOnError(): void private function createOptionsHandler(): OptionsHandler { - return new class() implements OptionsHandler { + return new class implements OptionsHandler { private array $options = []; public function get(string $option): mixed diff --git a/tests/Session/Storage/Proxy/ReadOnlySessionHandlerProxyTest.php b/tests/Session/Storage/Proxy/ReadOnlySessionHandlerProxyTest.php index d1aaa7b..2a165a5 100644 --- a/tests/Session/Storage/Proxy/ReadOnlySessionHandlerProxyTest.php +++ b/tests/Session/Storage/Proxy/ReadOnlySessionHandlerProxyTest.php @@ -138,7 +138,7 @@ public function testForbidsUpdatingTheSessionTimestamp(): never private function createOptionsHandler(): OptionsHandler { - return new class() implements OptionsHandler { + return new class implements OptionsHandler { private array $options = []; public function get(string $option): mixed diff --git a/tests/Session/Storage/ReadOnlyNativeSessionStorageFactoryTest.php b/tests/Session/Storage/ReadOnlyNativeSessionStorageFactoryTest.php index 10108df..e348541 100644 --- a/tests/Session/Storage/ReadOnlyNativeSessionStorageFactoryTest.php +++ b/tests/Session/Storage/ReadOnlyNativeSessionStorageFactoryTest.php @@ -44,7 +44,7 @@ public function testCreatesTheStorageInstance(): void private function createOptionsHandler(): OptionsHandler { - return new class() implements OptionsHandler { + return new class implements OptionsHandler { private array $options = []; public function get(string $option): mixed diff --git a/tests/Session/Storage/ReadOnlyNativeSessionStorageTest.php b/tests/Session/Storage/ReadOnlyNativeSessionStorageTest.php index f38c28a..ca05219 100644 --- a/tests/Session/Storage/ReadOnlyNativeSessionStorageTest.php +++ b/tests/Session/Storage/ReadOnlyNativeSessionStorageTest.php @@ -124,7 +124,7 @@ public function testSavesTheSession(): void #[DoesNotPerformAssertions] public function testCanRegisterBagsBeforeStartingTheSession(): void { - $bag = new class() implements SessionBagInterface { + $bag = new class implements SessionBagInterface { public function getName(): string { return 'test'; @@ -148,7 +148,7 @@ public function clear(): mixed private function createOptionsHandler(): OptionsHandler { - return new class() implements OptionsHandler { + return new class implements OptionsHandler { private array $options = []; public function get(string $option): mixed diff --git a/tests/WAMP/MessageHandler/DefaultMessageHandlerResolverTest.php b/tests/WAMP/MessageHandler/DefaultMessageHandlerResolverTest.php index b368d28..50fcdd9 100644 --- a/tests/WAMP/MessageHandler/DefaultMessageHandlerResolverTest.php +++ b/tests/WAMP/MessageHandler/DefaultMessageHandlerResolverTest.php @@ -62,7 +62,7 @@ public function testCannotResolveAMessageHandlerWhenTheControllerRequestAttribut $this->expectException(UnknownMessageHandler::class); $attributes = new ParameterBag(); - $attributes->set('_controller', \UnknownClass::class); /** @phpstan-ignore-line class.notFound */ + $attributes->set('_controller', \UnknownClass::class); /* @phpstan-ignore-line class.notFound */ (new DefaultMessageHandlerResolver())->findMessageHandler(new WAMPMessageRequest($attributes)); } diff --git a/tests/WAMP/MessageHandler/PsrContainerMessageHandlerResolverTest.php b/tests/WAMP/MessageHandler/PsrContainerMessageHandlerResolverTest.php index 07608c8..44c2fc2 100644 --- a/tests/WAMP/MessageHandler/PsrContainerMessageHandlerResolverTest.php +++ b/tests/WAMP/MessageHandler/PsrContainerMessageHandlerResolverTest.php @@ -65,7 +65,7 @@ public function testCannotResolveAMessageHandlerWhenTheControllerRequestAttribut $this->expectException(UnknownMessageHandler::class); $attributes = new ParameterBag(); - $attributes->set('_controller', \UnknownClass::class); /** @phpstan-ignore-line class.notFound */ + $attributes->set('_controller', \UnknownClass::class); /* @phpstan-ignore-line class.notFound */ (new PsrContainerMessageHandlerResolver(new Container()))->findMessageHandler(new WAMPMessageRequest($attributes)); } @@ -95,7 +95,7 @@ final class Container implements ContainerInterface */ public function get($id) { - return $this->services[$id] ?? throw new ServiceNotFound(sprintf('Service "%s" does not exist.', $id)); + return $this->services[$id] ?? throw new ServiceNotFound(\sprintf('Service "%s" does not exist.', $id)); } /**