Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public function shouldRestart(DateTime $startTime): bool |
||
42 | { |
||
43 | // load UNIX timestamp from redis |
||
44 | $restartTime = $this->redis->get($this->key); |
||
|
|||
45 | if ($restartTime === null) { |
||
46 | return false; |
||
47 | } |
||
48 | $restartTime = (int) $restartTime; |
||
49 | |||
50 | // do not restart if restart time is in future |
||
51 | if ($restartTime > time()) { |
||
52 | return false; |
||
53 | } |
||
54 | |||
55 | // do not restart if hermes started after restart time |
||
56 | if ($restartTime < $startTime->getTimestamp()) { |
||
57 | return false; |
||
58 | } |
||
59 | |||
60 | return true; |
||
61 | } |
||
62 | } |
||
63 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: