These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace BeyondCode\LaravelWebSockets\Server\Logger; |
||
4 | |||
5 | use Exception; |
||
6 | use Ratchet\ConnectionInterface; |
||
7 | use Ratchet\MessageComponentInterface; |
||
8 | |||
9 | class HttpLogger extends Logger implements MessageComponentInterface |
||
10 | { |
||
11 | /** @var \Ratchet\Http\HttpServerInterface */ |
||
12 | protected $app; |
||
13 | |||
14 | public static function decorate(MessageComponentInterface $app): self |
||
15 | { |
||
16 | $logger = app(self::class); |
||
17 | |||
18 | return $logger->setApp($app); |
||
19 | } |
||
20 | |||
21 | public function setApp(MessageComponentInterface $app) |
||
22 | { |
||
23 | $this->app = $app; |
||
0 ignored issues
–
show
|
|||
24 | |||
25 | return $this; |
||
26 | } |
||
27 | |||
28 | public function onOpen(ConnectionInterface $connection) |
||
29 | { |
||
30 | $this->app->onOpen($connection); |
||
31 | } |
||
32 | |||
33 | public function onMessage(ConnectionInterface $connection, $message) |
||
34 | { |
||
35 | $this->app->onMessage($connection, $message); |
||
36 | } |
||
37 | |||
38 | public function onClose(ConnectionInterface $connection) |
||
39 | { |
||
40 | $this->app->onClose($connection); |
||
41 | } |
||
42 | |||
43 | public function onError(ConnectionInterface $connection, Exception $exception) |
||
44 | { |
||
45 | $exceptionClass = get_class($exception); |
||
46 | |||
47 | $message = "Exception `{$exceptionClass}` thrown: `{$exception->getMessage()}`"; |
||
48 | |||
49 | if ($this->verbose) { |
||
50 | $message .= $exception->getTraceAsString(); |
||
51 | } |
||
52 | |||
53 | $this->error($message); |
||
54 | |||
55 | $this->app->onError($connection, $exception); |
||
56 | } |
||
57 | } |
||
58 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.