1 | <?php |
||
20 | class StreamedClientIo extends AbstractClientIo |
||
21 | { |
||
22 | /** |
||
23 | * Read attempts count |
||
24 | */ |
||
25 | const READ_ATTEMPTS = 2; |
||
26 | |||
27 | /** |
||
28 | * Amount of read attempts |
||
29 | * |
||
30 | * @var int |
||
31 | */ |
||
32 | private $readAttempts = self::READ_ATTEMPTS; |
||
33 | |||
34 | /** |
||
35 | * Remote socket address |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | private $remoteAddress; |
||
40 | |||
41 | /** {@inheritdoc} */ |
||
42 | 26 | protected function readRawDataIntoPicker(FramePickerInterface $picker, $isOutOfBand) |
|
46 | |||
47 | /** {@inheritdoc} */ |
||
48 | 5 | protected function writeRawData($data, $isOutOfBand) |
|
76 | |||
77 | /** {@inheritdoc} */ |
||
78 | 37 | protected function isConnected() |
|
82 | |||
83 | /** {@inheritdoc} */ |
||
84 | 25 | protected function getRemoteAddress() |
|
92 | |||
93 | /** {@inheritdoc} */ |
||
94 | 2 | protected function canReachFrame() |
|
98 | |||
99 | /** |
||
100 | * Read OOB data from socket |
||
101 | * |
||
102 | * @param FramePickerInterface $picker |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | 1 | private function readOobData(FramePickerInterface $picker) |
|
116 | |||
117 | /** |
||
118 | * Read regular data |
||
119 | * |
||
120 | * @param FramePickerInterface $picker Picker to read data into |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | 25 | private function readRegularData(FramePickerInterface $picker) |
|
153 | |||
154 | /** |
||
155 | * Return first byte from socket buffer |
||
156 | * |
||
157 | * @return string |
||
158 | */ |
||
159 | 25 | private function getDataInSocket() |
|
163 | |||
164 | /** |
||
165 | * Checks whether data read from stream buffer can be filled later |
||
166 | * |
||
167 | * @param string $data Read data |
||
168 | * |
||
169 | * @return bool |
||
170 | */ |
||
171 | 24 | private function isReadDataActuallyEmpty($data) |
|
181 | |||
182 | /** |
||
183 | * Calculate attempts value |
||
184 | * |
||
185 | * @param array $context Read context |
||
186 | * @param int $currentAttempts Current attempts counter |
||
187 | * |
||
188 | * @return int |
||
189 | */ |
||
190 | 24 | private function resolveReadAttempts(array $context, $currentAttempts) |
|
198 | |||
199 | /** |
||
200 | * Write out-of-band data |
||
201 | * |
||
202 | * @param resource $socket Socket resource |
||
203 | * @param string $data Data to write |
||
204 | * |
||
205 | * @return int Amount of written bytes |
||
206 | */ |
||
207 | 1 | private function writeOobData($socket, $data) |
|
229 | |||
230 | /** |
||
231 | * Return remote address if we connected or false otherwise |
||
232 | * |
||
233 | * @return string|bool |
||
234 | */ |
||
235 | 37 | private function resolveRemoteAddress() |
|
239 | } |
||
240 |
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.