16
16
use Gt \Input \InputData \FileUploadInputData ;
17
17
use Gt \Input \InputData \QueryStringInputData ;
18
18
19
+ /**
20
+ * @implements ArrayAccess<string, ?string>
21
+ * @implements Iterator<string, ?string>
22
+ */
19
23
class Input implements ArrayAccess, Countable, Iterator {
20
24
use InputValueGetter;
21
25
use KeyValueArrayAccess;
@@ -27,14 +31,16 @@ class Input implements ArrayAccess, Countable, Iterator {
27
31
const DATA_FILES = "files " ;
28
32
const DATA_COMBINED = "combined " ;
29
33
30
- /** @var BodyStream */
31
- protected $ bodyStream ;
32
-
33
- /** @var QueryStringInputData */
34
- protected $ queryStringParameters ;
35
- /** @var BodyInputData */
36
- protected $ bodyParameters ;
34
+ protected BodyStream $ bodyStream ;
35
+ protected QueryStringInputData $ queryStringParameters ;
36
+ protected BodyInputData $ bodyParameters ;
37
37
38
+ /**
39
+ * @param array<string, string> $get
40
+ * @param array<string, string> $post
41
+ * @param array<string, array<string, string>> $files
42
+ * @param string $bodyPath
43
+ */
38
44
public function __construct (
39
45
array $ get = [],
40
46
array $ post = [],
@@ -89,7 +95,6 @@ public function add(string $key, InputDatum $datum, string $method):void {
89
95
90
96
default :
91
97
throw new InvalidInputMethodException ($ method );
92
- break ;
93
98
}
94
99
95
100
$ this ->parameters = new CombinedInputData (
@@ -217,8 +222,10 @@ public function do(string $match):Trigger {
217
222
*
218
223
* $matches is an associative array, where the key is a request variable's name and the
219
224
* value is the request variable's value to match.
225
+ *
226
+ * @param array<string, string>|string $matches
220
227
*/
221
- public function when (...$ matches ):Trigger {
228
+ public function when (array | string ...$ matches ):Trigger {
222
229
$ trigger = new Trigger ($ this );
223
230
$ trigger ->when ($ matches );
224
231
return $ trigger ;
@@ -251,7 +258,7 @@ public function withAll():Trigger {
251
258
return $ this ->newTrigger ("withAll " );
252
259
}
253
260
254
- protected function newTrigger (string $ functionName , ...$ args ):Trigger {
261
+ protected function newTrigger (string $ functionName , string ...$ args ):Trigger {
255
262
$ trigger = new Trigger ($ this );
256
263
return $ trigger ->$ functionName (...$ args );
257
264
}
0 commit comments