1 | <?php |
||
27 | final class MultipartStream extends StreamAbstract{ |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $boundary; |
||
33 | |||
34 | /** |
||
35 | * @var bool |
||
36 | */ |
||
37 | protected $built = false; |
||
38 | |||
39 | /** |
||
40 | * MultipartStream constructor. |
||
41 | * |
||
42 | * @param array $elements [ |
||
|
|||
43 | * name => string, |
||
44 | * contents => StreamInterface/resource/string, |
||
45 | * headers => array, |
||
46 | * filename => string |
||
47 | * ] |
||
48 | * @param string|null $boundary |
||
49 | */ |
||
50 | public function __construct(array $elements = null, string $boundary = null){ |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getBoundary():string{ |
||
66 | |||
67 | /** |
||
68 | * @return \chillerlan\HTTP\Psr7\MultipartStream |
||
69 | */ |
||
70 | public function build():MultipartStream{ |
||
82 | |||
83 | /** |
||
84 | * @param array $e |
||
85 | * |
||
86 | * @return \chillerlan\HTTP\Psr7\MultipartStream |
||
87 | */ |
||
88 | public function addElement(array $e):MultipartStream{ |
||
127 | |||
128 | /** |
||
129 | * @param array $e |
||
130 | * |
||
131 | * @return array |
||
132 | */ |
||
133 | protected function setElementHeaders(array $e):array{ |
||
163 | |||
164 | /** |
||
165 | * @param array $headers |
||
166 | * @param string $key |
||
167 | * |
||
168 | * @return bool |
||
169 | */ |
||
170 | protected function hasHeader(array $headers, string $key):bool{ |
||
181 | |||
182 | /** |
||
183 | * @inheritDoc |
||
184 | */ |
||
185 | public function __toString(){ |
||
188 | |||
189 | /** |
||
190 | * @inheritDoc |
||
191 | */ |
||
192 | public function getSize():?int{ |
||
195 | |||
196 | /** |
||
197 | * @inheritDoc |
||
198 | */ |
||
199 | public function isWritable():bool{ |
||
202 | |||
203 | /** |
||
204 | * @inheritDoc |
||
205 | */ |
||
206 | public function write($string):int{ |
||
209 | |||
210 | /** |
||
211 | * @inheritDoc |
||
212 | */ |
||
213 | public function isReadable():bool{ |
||
216 | |||
217 | /** |
||
218 | * @inheritDoc |
||
219 | */ |
||
220 | public function getContents():string{ |
||
223 | |||
224 | } |
||
225 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive. In addition it looks for parameters that have the generic type
array
and suggests a stricter type likearray<String>
.Most often this is a case of a parameter that can be null in addition to its declared types.