| Conditions | 4 |
| Paths | 1 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 21 | public function convert(Future $future): PromiseInterface |
||
| 22 | { |
||
| 23 | return new Promise(function ($resolve, $reject) use ($future): void { |
||
| 24 | /** @var TimerInterface|null $timer */ |
||
| 25 | $timer = $this->loop->addPeriodicTimer(0.001, function () use (&$timer, $future, $resolve, $reject): void { |
||
|
|
|||
| 26 | if (!$future->done()) { |
||
| 27 | return; |
||
| 28 | } |
||
| 29 | |||
| 30 | if ($timer instanceof TimerInterface) { |
||
| 31 | $this->loop->cancelTimer($timer); |
||
| 32 | } |
||
| 33 | |||
| 34 | try { |
||
| 35 | $resolve($future->value()); |
||
| 36 | } catch (\Throwable $throwable) { |
||
| 37 | $reject($throwable); |
||
| 38 | } |
||
| 39 | }); |
||
| 40 | }); |
||
| 41 | } |
||
| 42 | } |
||
| 43 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.