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 Auryn\Injector; |
||
5 | use Amp\Artax\Client; |
||
6 | use Amp\Artax\BasicClient; |
||
7 | use ekinhbayar\GitAmp\Github\Credentials; |
||
8 | use ekinhbayar\GitAmp\Http\Origin; |
||
9 | use ekinhbayar\GitAmp\Log\Request as RequestLogger; |
||
10 | use ekinhbayar\GitAmp\Provider\GitHub; |
||
11 | use ekinhbayar\GitAmp\Provider\Listener; |
||
12 | use ekinhbayar\GitAmp\Storage\Counter; |
||
13 | use ekinhbayar\GitAmp\Storage\NativeCounter; |
||
14 | use ekinhbayar\GitAmp\Websocket\Handler; |
||
15 | use Monolog\Logger; |
||
16 | use Monolog\Handler\StreamHandler; |
||
17 | use Psr\Log\LoggerInterface; |
||
18 | use function Aerys\root; |
||
19 | use function Aerys\router; |
||
20 | use function Aerys\websocket; |
||
21 | |||
22 | $configuration = require_once __DIR__ . '/config.php'; |
||
23 | |||
24 | $injector = new Injector; |
||
25 | |||
26 | $injector->alias(Listener::class, GitHub::class); |
||
27 | |||
28 | $injector->alias(Counter::class, NativeCounter::class); |
||
29 | |||
30 | $injector->alias(Credentials::class, get_class($configuration['github'])); |
||
31 | |||
32 | $injector->share($configuration['github']); |
||
33 | |||
34 | $injector->alias(LoggerInterface::class, Logger::class); |
||
35 | $injector->share(Logger::class); |
||
36 | |||
37 | $injector->delegate(Logger::class, function() use ($configuration) { |
||
38 | $logger = new Logger('gitamp'); |
||
39 | |||
40 | $logger->pushHandler(new StreamHandler('php://stdout', $configuration['logLevel'])); |
||
41 | |||
42 | return $logger; |
||
43 | }); |
||
44 | |||
45 | $injector->define(Handler::class, [ |
||
46 | ':origin' => (new Origin($configuration))->get(), |
||
47 | ]); |
||
48 | |||
49 | $injector->alias(Client::class, BasicClient::class); |
||
50 | |||
51 | $websocket = $injector->make(Handler::class); |
||
52 | |||
53 | $router = router()->get('/ws', websocket($websocket)); |
||
54 | |||
55 | $requestLogger = new RequestLogger(); |
||
56 | |||
57 | if (isset($configuration['ssl'])) { |
||
58 | (new Host()) |
||
0 ignored issues
–
show
|
|||
59 | ->name($configuration['hostname']) |
||
60 | ->expose($configuration['expose']['ip'], $configuration['expose']['port']) |
||
61 | ->use($requestLogger) |
||
62 | ->redirect('https://' . $configuration['hostname']) |
||
63 | ; |
||
64 | |||
65 | (new Host()) |
||
66 | ->name($configuration['hostname']) |
||
67 | ->expose($configuration['ssl']['ip'], $configuration['ssl']['port']) |
||
68 | ->encrypt($configuration['ssl']['certificate'], $configuration['ssl']['key']) |
||
69 | ->use($requestLogger) |
||
70 | ->use($router) |
||
71 | ->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);
![]() |
|||
72 | ; |
||
73 | } else { |
||
74 | (new Host()) |
||
75 | ->name($configuration['hostname']) |
||
76 | ->expose($configuration['expose']['ip'], $configuration['expose']['port']) |
||
77 | ->use($requestLogger) |
||
78 | ->use($router) |
||
79 | ->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);
![]() |
|||
80 | ; |
||
81 | } |
||
82 | |||
83 | $logger = $injector->make(LoggerInterface::class); |
||
84 | |||
85 | Amp\Loop::setErrorHandler(function(Throwable $e) use ($logger) { |
||
86 | $logger->emergency('GitAmp blew up', ['exception' => $e]); |
||
87 | }); |
||
88 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.