1 | <?php |
||
25 | class Timer implements TimerInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | protected $maxIterations; |
||
31 | |||
32 | /** |
||
33 | * @var int |
||
34 | */ |
||
35 | protected $iterations; |
||
36 | |||
37 | /** |
||
38 | * @var BaseTimerInterface |
||
39 | */ |
||
40 | private $timer; |
||
41 | |||
42 | /** |
||
43 | * @var Delegate |
||
44 | */ |
||
45 | private $task; |
||
46 | |||
47 | /** |
||
48 | * @var DeferredInterface |
||
49 | */ |
||
50 | private $deferred = null; |
||
51 | |||
52 | /** |
||
53 | * @var mixed |
||
54 | */ |
||
55 | private $lastResult; |
||
56 | |||
57 | /** |
||
58 | * @param LoopInterface $loop |
||
59 | * @param callable $task |
||
60 | * @param int|float $interval |
||
61 | * @param bool $periodic |
||
62 | * @param int $count |
||
63 | * |
||
64 | * @throws \InvalidArgumentException |
||
65 | */ |
||
66 | public function __construct(LoopInterface $loop, callable $task, $interval, $periodic = false, $count = null) |
||
84 | |||
85 | /** |
||
86 | * {@inheritdoc} |
||
87 | */ |
||
88 | public function interval() |
||
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | public function iterations() |
||
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | public function maxIterations() |
||
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | public function isActive() |
||
116 | |||
117 | /** |
||
118 | * {@inheritdoc} |
||
119 | */ |
||
120 | public function cancel() |
||
125 | |||
126 | /** |
||
127 | * {@inheritdoc} |
||
128 | */ |
||
129 | public function then(callable $onSucceed = null, callable $onRejected = null, callable $onNotify = null) |
||
133 | |||
134 | /** |
||
135 | * {@inheritdoc} |
||
136 | */ |
||
137 | public function otherwise(callable $catch) |
||
141 | |||
142 | /** |
||
143 | * {@inheritdoc} |
||
144 | */ |
||
145 | public function always(callable $finally, callable $notify = null) |
||
149 | |||
150 | /** |
||
151 | * {@inheritdoc} |
||
152 | */ |
||
153 | public function state() |
||
157 | |||
158 | /** |
||
159 | * @return \Cubiche\Core\Async\Promise\Deferred |
||
160 | */ |
||
161 | protected function deferred() |
||
169 | |||
170 | /** |
||
171 | */ |
||
172 | private function onTick() |
||
190 | } |
||
191 |
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 mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.