1 | <?php |
||
23 | final class MultipartStream extends StreamAbstract{ |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $boundary; |
||
29 | |||
30 | /** |
||
31 | * @var \Psr\Http\Message\StreamFactoryInterface |
||
32 | */ |
||
33 | protected $streamFactory; |
||
34 | |||
35 | /** |
||
36 | * @var bool |
||
37 | */ |
||
38 | protected $built = false; |
||
39 | |||
40 | /** |
||
41 | * MultipartStream constructor. |
||
42 | * |
||
43 | * @param array $elements [ |
||
|
|||
44 | * name => string, |
||
45 | * contents => StreamInterface/resource/string, |
||
46 | * headers => array, |
||
47 | * filename => string |
||
48 | * ] |
||
49 | * @param string|null $boundary |
||
50 | */ |
||
51 | public function __construct(array $elements = null, string $boundary = null){ |
||
60 | |||
61 | /** |
||
62 | * @return string |
||
63 | */ |
||
64 | public function getBoundary():string{ |
||
67 | |||
68 | /** |
||
69 | * @return \chillerlan\HTTP\Psr7\MultipartStream |
||
70 | */ |
||
71 | public function build():MultipartStream{ |
||
83 | |||
84 | /** |
||
85 | * @param array $e |
||
86 | * |
||
87 | * @return \chillerlan\HTTP\Psr7\MultipartStream |
||
88 | */ |
||
89 | public function addElement(array $e):MultipartStream{ |
||
150 | |||
151 | |||
152 | private function hasHeader(array $headers, $key){ |
||
162 | |||
163 | /** |
||
164 | * @inheritdoc |
||
165 | */ |
||
166 | public function __toString(){ |
||
169 | |||
170 | /** |
||
171 | * @inheritdoc |
||
172 | */ |
||
173 | public function getSize():?int{ |
||
176 | |||
177 | /** |
||
178 | * @inheritdoc |
||
179 | */ |
||
180 | public function isWritable():bool{ |
||
183 | |||
184 | /** |
||
185 | * @inheritdoc |
||
186 | */ |
||
187 | public function write($string):int{ |
||
190 | |||
191 | /** |
||
192 | * @inheritdoc |
||
193 | */ |
||
194 | public function isReadable():bool{ |
||
197 | |||
198 | /** |
||
199 | * @inheritdoc |
||
200 | */ |
||
201 | public function getContents():string{ |
||
204 | |||
205 | } |
||
206 |
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.