1 | <?php |
||
5 | class Spinner extends DynamicTerminalObject |
||
6 | { |
||
7 | /** |
||
8 | * The characters to be used to present progress. |
||
9 | * |
||
10 | * @var string $characters |
||
11 | */ |
||
12 | private $characters = ["[=---]", "[-=--]", "[--=-]", "[---=]", "[--=-]", "[-=--]"]; |
||
13 | |||
14 | /** |
||
15 | * The current item of the sequence |
||
16 | * |
||
17 | * @var integer $current |
||
18 | */ |
||
19 | private $current = 0; |
||
20 | |||
21 | /** |
||
22 | * Flag indicating whether we are writing the bar for the first time |
||
23 | * |
||
24 | * @var boolean $first_line |
||
25 | */ |
||
26 | private $first_line = true; |
||
27 | |||
28 | /** |
||
29 | * Current label |
||
30 | * |
||
31 | * @var string $label |
||
32 | */ |
||
33 | private $label; |
||
34 | |||
35 | /** |
||
36 | * When the spinner was last drawn. |
||
37 | * |
||
38 | * @var float $last_drawn |
||
39 | */ |
||
40 | private $last_drawn; |
||
41 | |||
42 | /** |
||
43 | * How long to wait in seconds between drawing each stage. |
||
44 | * |
||
45 | * @var float $time_limit |
||
46 | */ |
||
47 | private $time_limit = 0.1; |
||
48 | |||
49 | |||
50 | /** |
||
51 | * If they pass in a sequence, set the sequence |
||
52 | * |
||
53 | * @param string $label |
||
54 | * @param string[] $characters |
||
55 | */ |
||
56 | public function __construct($label = null, ...$characters) |
||
73 | |||
74 | |||
75 | /** |
||
76 | * Set the length of time to wait between drawing each stage. |
||
77 | * |
||
78 | * @param float $time_limit |
||
79 | * |
||
80 | * @return Spinner |
||
81 | */ |
||
82 | public function timeLimit($time_limit) |
||
88 | |||
89 | |||
90 | /** |
||
91 | * Set the character to loop around. |
||
92 | * |
||
93 | * @param string $characters |
||
94 | * |
||
95 | * @return Spinner |
||
96 | */ |
||
97 | public function characters(...$characters) |
||
107 | |||
108 | |||
109 | /** |
||
110 | * Re-writes the spinner |
||
111 | * |
||
112 | * @param string $label |
||
113 | * |
||
114 | * @return void |
||
115 | */ |
||
116 | public function advance($label = null) |
||
138 | |||
139 | |||
140 | /** |
||
141 | * Draw the spinner |
||
142 | * |
||
143 | * @param string $characters |
||
144 | * @param string $label |
||
145 | */ |
||
146 | private function drawSpinner($characters, $label) |
||
162 | } |
||
163 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..