Test Setup Failed
Pull Request — master (#17)
by Ekin
02:31
created

server.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
use Aerys\Host;
3
use Amp\Redis\Client;
4
use Amp\Artax\Client as ArtaxClient;
5
use Auryn\Injector;
6
use ekinhbayar\GitAmp\Events\Factory;
7
use ekinhbayar\GitAmp\Events\GithubEventType;
8
use ekinhbayar\GitAmp\Github\Credentials;
9
use ekinhbayar\GitAmp\Storage\Counter;
10
use ekinhbayar\GitAmp\Storage\RedisCounter;
11
use ekinhbayar\GitAmp\Websocket\Handler;
12
use ekinhbayar\GitAmp\Client\GitAmp;
13
use function Aerys\root;
14
use function Aerys\router;
15
use function Aerys\websocket;
16
17
$configuration = require_once __DIR__ . '/config.php';
18
19
$injector = new Injector;
20
21
$injector->alias(Counter::class, RedisCounter::class);
22
23
$injector->alias(Credentials::class, get_class($configuration['github']));
24
25
// @todo find out why the credentials are being instantiated multiple times
26
$injector->share($configuration['github']);
27
28
$injector->define(Handler::class, [
29
    ":origins" => [
30
        "http://" . $configuration['origins']['websocket'],
31
        "http://" . $configuration['origins']['server'] ,
32
    ],
33
    ":audiohub" => new GitAmp(new ArtaxClient(), $configuration['github'], new GithubEventType(), new Factory())
34
]);
35
36
$injector->make(GitAmp::class);
37
38
$injector->define(Client::class, [
39
    ":uri" => "tcp://" . $configuration['redis']['hostname'] . ":" . $configuration['redis']['port']
40
]);
41
42
$websocket = $injector->make(Handler::class);
43
44
$router = router()->get("/ws", websocket($websocket));
45
46
// add document root
47
$root = root(__DIR__ . "/public");
48
49
(new Host)
50
    ->name($configuration['origins']['server'])
51
    ->expose($configuration['expose']['ip'], $configuration['expose']['port'])
52
    ->use($router)
53
    ->use($root);
0 ignored issues
show
$root is of type object<Aerys\Bootable>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
54