Issues (4)

src/Server.php (2 issues)

Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Antidot\React\Socket;
6
7
use Ratchet\Http\HttpServer;
8
use Ratchet\Server\IoServer;
9
use Ratchet\Wamp\WampServer;
10
use Ratchet\WebSocket\WsServer;
11
use React\EventLoop\Factory;
12
13
class Server
14
{
15
    public function __invoke(array $config): void
16
    {
17
        $loop = Factory::create();
18
        $application = new Application();
19
        $loop->addTimer(0.001, function($timer) use ($config) {
0 ignored issues
show
The parameter $timer is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

19
        $loop->addTimer(0.001, function(/** @scrutinizer ignore-unused */ $timer) use ($config) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
            echo \sprintf("Socket server listening to tcp://%s.\n", $config['uri']);
21
        });
22
23
        $webSocket = new \React\Socket\Server($config['uri'], $loop);
24
        $server = new IoServer(
0 ignored issues
show
The assignment to $server is dead and can be removed.
Loading history...
25
            new HttpServer(
26
                new WsServer(
27
                    new WampServer(
28
                        $application
29
                    )
30
                )
31
            ),
32
            $webSocket
33
        );
34
35
        $loop->run();
36
    }
37
}
38