These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php declare(strict_types=1); |
||
2 | |||
3 | use Aerys\Host; |
||
4 | use Amp\Redis\Client; |
||
5 | use Auryn\Injector; |
||
6 | use ekinhbayar\GitAmp\Github\Credentials; |
||
7 | use ekinhbayar\GitAmp\Storage\Counter; |
||
8 | use ekinhbayar\GitAmp\Storage\RedisCounter; |
||
9 | use ekinhbayar\GitAmp\Websocket\Handler; |
||
10 | use function Aerys\root; |
||
11 | use function Aerys\router; |
||
12 | use function Aerys\websocket; |
||
13 | |||
14 | $configuration = require_once __DIR__ . '/config.php'; |
||
15 | |||
16 | $injector = new Injector; |
||
17 | |||
18 | $injector->alias(Counter::class, RedisCounter::class); |
||
19 | |||
20 | $injector->alias(Credentials::class, get_class($configuration['github'])); |
||
21 | |||
22 | $injector->share($configuration['github']); |
||
23 | |||
24 | $injector->define(Handler::class, [ |
||
25 | ':origins' => [ |
||
26 | 'http://' . $configuration['origins']['websocket'], |
||
27 | 'http://' . $configuration['origins']['server'] , |
||
28 | ], |
||
29 | ]); |
||
30 | |||
31 | $injector->define(Client::class, [ |
||
32 | ':uri' => 'tcp://' . $configuration['redis']['hostname'] . ':' . $configuration['redis']['port'] |
||
33 | ]); |
||
34 | |||
35 | $websocket = $injector->make(Handler::class); |
||
36 | |||
37 | $router = router()->get("/ws", websocket($websocket)); |
||
0 ignored issues
–
show
|
|||
38 | |||
39 | (new Host) |
||
40 | ->name($configuration['origins']['server']) |
||
41 | ->expose($configuration['expose']['ip'], $configuration['expose']['port']) |
||
42 | ->use($router) |
||
43 | ->use(root(__DIR__ . '/public')); |
||
0 ignored issues
–
show
\Aerys\root(__DIR__ . '/public') 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);
![]() |
|||
44 |
PHP provides two ways to mark string literals. Either with single quotes
'literal'
or with double quotes"literal"
. The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (
\'
) and the backslash (\\
). Every other character is displayed as is.Double quoted string literals may contain other variables or more complex escape sequences.
will print an indented:
Single is Value
If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.
For more information on PHP string literals and available escape sequences see the PHP core documentation.