1 | <?php |
||
15 | class MarkerFramePicker extends AbstractFramePicker |
||
16 | { |
||
17 | /** |
||
18 | * Frame start byte sequence or null |
||
19 | * |
||
20 | * @var string|null |
||
21 | */ |
||
22 | private $startMarker; |
||
23 | |||
24 | /** |
||
25 | * Frame end marker |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | private $endMarker; |
||
30 | |||
31 | /** |
||
32 | * Offset to search for end marker during data handling |
||
33 | * |
||
34 | * @var int |
||
35 | */ |
||
36 | private $startPos; |
||
37 | |||
38 | /** |
||
39 | * bool |
||
40 | * |
||
41 | * @var bool |
||
42 | */ |
||
43 | private $isCaseSensitive; |
||
44 | |||
45 | /** |
||
46 | * MarkerFramePicker constructor. |
||
47 | * |
||
48 | * @param null|string $startMarker Start marker |
||
49 | * @param string $endMarker End marker |
||
50 | * @param bool $isCaseSensitive True, if case is important |
||
51 | */ |
||
52 | 30 | public function __construct($startMarker, $endMarker, $isCaseSensitive = true) |
|
59 | |||
60 | /** |
||
61 | * Find start of data in frame |
||
62 | * |
||
63 | * @param string $buffer Collected data for frame |
||
64 | * |
||
65 | * @return bool True if start of frame is found |
||
66 | */ |
||
67 | 29 | protected function resolveStartOfFrame($buffer) |
|
86 | |||
87 | /** {@inheritdoc} */ |
||
88 | 29 | protected function doHandleData($chunk, $remoteAddress, &$buffer) |
|
105 | |||
106 | /** {@inheritdoc} */ |
||
107 | 29 | protected function doCreateFrame($buffer, $remoteAddress) |
|
116 | |||
117 | /** |
||
118 | * Performs strpos or stripos according to case sensibility |
||
119 | * |
||
120 | * @param string $haystack Where find text |
||
121 | * @param string $needle What to find |
||
122 | * @param int $offset Start offset in $haystack |
||
123 | * |
||
124 | * @return bool|int |
||
125 | */ |
||
126 | 29 | protected function findMarker($haystack, $needle, $offset = 0) |
|
132 | } |
||
133 |
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.