@@ -32,6 +32,8 @@ public function __construct(
32
32
* Returns the parameters.
33
33
*
34
34
* @param string|null $key The name of the parameter to return or null to get them all
35
+ *
36
+ * @throws BadRequestException if the value is not an array
35
37
*/
36
38
public function all (?string $ key = null ): array
37
39
{
@@ -98,6 +100,8 @@ public function remove(string $key): void
98
100
99
101
/**
100
102
* Returns the alphabetic characters of the parameter value.
103
+ *
104
+ * @throws UnexpectedValueException if the value cannot be converted to string
101
105
*/
102
106
public function getAlpha (string $ key , string $ default = '' ): string
103
107
{
@@ -106,6 +110,8 @@ public function getAlpha(string $key, string $default = ''): string
106
110
107
111
/**
108
112
* Returns the alphabetic characters and digits of the parameter value.
113
+ *
114
+ * @throws UnexpectedValueException if the value cannot be converted to string
109
115
*/
110
116
public function getAlnum (string $ key , string $ default = '' ): string
111
117
{
@@ -114,6 +120,8 @@ public function getAlnum(string $key, string $default = ''): string
114
120
115
121
/**
116
122
* Returns the digits of the parameter value.
123
+ *
124
+ * @throws UnexpectedValueException if the value cannot be converted to string
117
125
*/
118
126
public function getDigits (string $ key , string $ default = '' ): string
119
127
{
@@ -122,6 +130,8 @@ public function getDigits(string $key, string $default = ''): string
122
130
123
131
/**
124
132
* Returns the parameter as string.
133
+ *
134
+ * @throws UnexpectedValueException if the value cannot be converted to string
125
135
*/
126
136
public function getString (string $ key , string $ default = '' ): string
127
137
{
@@ -135,6 +145,8 @@ public function getString(string $key, string $default = ''): string
135
145
136
146
/**
137
147
* Returns the parameter value converted to integer.
148
+ *
149
+ * @throws UnexpectedValueException if the value cannot be converted to integer
138
150
*/
139
151
public function getInt (string $ key , int $ default = 0 ): int
140
152
{
@@ -143,6 +155,8 @@ public function getInt(string $key, int $default = 0): int
143
155
144
156
/**
145
157
* Returns the parameter value converted to boolean.
158
+ *
159
+ * @throws UnexpectedValueException if the value cannot be converted to a boolean
146
160
*/
147
161
public function getBoolean (string $ key , bool $ default = false ): bool
148
162
{
@@ -160,6 +174,8 @@ public function getBoolean(string $key, bool $default = false): bool
160
174
* @return ?T
161
175
*
162
176
* @psalm-return ($default is null ? T|null : T)
177
+ *
178
+ * @throws UnexpectedValueException if the parameter value cannot be converted to an enum
163
179
*/
164
180
public function getEnum (string $ key , string $ class , ?\BackedEnum $ default = null ): ?\BackedEnum
165
181
{
@@ -183,6 +199,9 @@ public function getEnum(string $key, string $class, ?\BackedEnum $default = null
183
199
* @param int|array{flags?: int, options?: array} $options Flags from FILTER_* constants
184
200
*
185
201
* @see https://php.net/filter-var
202
+ *
203
+ * @throws UnexpectedValueException if the parameter value is a non-stringable object
204
+ * @throws UnexpectedValueException if the parameter value is invalid and \FILTER_NULL_ON_FAILURE is not set
186
205
*/
187
206
public function filter (string $ key , mixed $ default = null , int $ filter = \FILTER_DEFAULT , mixed $ options = []): mixed
188
207
{
0 commit comments