| 1 | <?php |
||
| 14 | class RedisRestart implements RestartInterface |
||
| 15 | { |
||
| 16 | /** @var string */ |
||
| 17 | private $key; |
||
| 18 | |||
| 19 | /** @var \Predis\Client|\Redis */ |
||
| 20 | private $redis; |
||
| 21 | |||
| 22 | public function __construct($redis, string $key = 'hermes_restart') |
||
| 31 | |||
| 32 | /** |
||
| 33 | * {@inheritdoc} |
||
| 34 | * |
||
| 35 | * Returns true: |
||
| 36 | * |
||
| 37 | * - if restart timestamp is set, |
||
| 38 | * - and timestamp is not in future, |
||
| 39 | * - and hermes was started ($startTime) before timestamp |
||
| 40 | */ |
||
| 41 | public function shouldRestart(DateTime $startTime): bool |
||
| 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: