Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4603e64

Browse filesBrowse files
feature #16629 [HttpFoundation] Remove deprecated class method parameter (belka-ew)
This PR was merged into the 3.0-dev branch. Discussion ---------- [HttpFoundation] Remove deprecated class method parameter | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | yes | Deprecations? | yes | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | $deep argument in Symfony\Component\HttpFoundation\BagParameter::get was deprecated in 2.8 and removed in master, but it is still used in the code of the class (and in the filter() method) Commits ------- 4ffe14c [HttpFoundation] Remove deprecated class method parameter
2 parents aa4bc47 + 4ffe14c commit 4603e64
Copy full SHA for 4603e64

File tree

1 file changed

+12
-33
lines changed
Filter options

1 file changed

+12
-33
lines changed

‎src/Symfony/Component/HttpFoundation/ParameterBag.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/ParameterBag.php
+12-33Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -128,70 +128,65 @@ public function remove($key)
128128
*
129129
* @param string $key The parameter key
130130
* @param string $default The default value if the parameter key does not exist
131-
* @param bool $deep If true, a path like foo[bar] will find deeper items
132131
*
133132
* @return string The filtered value
134133
*/
135-
public function getAlpha($key, $default = '', $deep = false)
134+
public function getAlpha($key, $default = '')
136135
{
137-
return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default, $deep));
136+
return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default));
138137
}
139138

140139
/**
141140
* Returns the alphabetic characters and digits of the parameter value.
142141
*
143142
* @param string $key The parameter key
144143
* @param string $default The default value if the parameter key does not exist
145-
* @param bool $deep If true, a path like foo[bar] will find deeper items
146144
*
147145
* @return string The filtered value
148146
*/
149-
public function getAlnum($key, $default = '', $deep = false)
147+
public function getAlnum($key, $default = '')
150148
{
151-
return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default, $deep));
149+
return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default));
152150
}
153151

154152
/**
155153
* Returns the digits of the parameter value.
156154
*
157155
* @param string $key The parameter key
158156
* @param string $default The default value if the parameter key does not exist
159-
* @param bool $deep If true, a path like foo[bar] will find deeper items
160157
*
161158
* @return string The filtered value
162159
*/
163-
public function getDigits($key, $default = '', $deep = false)
160+
public function getDigits($key, $default = '')
164161
{
165162
// we need to remove - and + because they're allowed in the filter
166-
return str_replace(array('-', '+'), '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT, array(), $deep));
163+
return str_replace(array('-', '+'), '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT));
167164
}
168165

169166
/**
170167
* Returns the parameter value converted to integer.
171168
*
172169
* @param string $key The parameter key
173170
* @param int $default The default value if the parameter key does not exist
174-
* @param bool $deep If true, a path like foo[bar] will find deeper items
175171
*
176172
* @return int The filtered value
177173
*/
178-
public function getInt($key, $default = 0, $deep = false)
174+
public function getInt($key, $default = 0)
179175
{
180-
return (int) $this->get($key, $default, $deep);
176+
return (int) $this->get($key, $default);
181177
}
182178

183179
/**
184180
* Returns the parameter value converted to boolean.
185181
*
186182
* @param string $key The parameter key
187183
* @param mixed $default The default value if the parameter key does not exist
188-
* @param bool $deep If true, a path like foo[bar] will find deeper items
189184
*
190185
* @return bool The filtered value
191186
*/
192-
public function getBoolean($key, $default = false, $deep = false)
187+
public function getBoolean($key, $default = false)
193188
{
194-
return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN, array(), $deep);
189+
return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN);
195190
}
196191

197192
/**
@@ -201,30 +196,14 @@ public function getBoolean($key, $default = false, $deep = false)
201196
* @param mixed $default Default = null.
202197
* @param int $filter FILTER_* constant.
203198
* @param mixed $options Filter options.
204-
* @param bool $deep Default = false.
205199
*
206200
* @see http://php.net/manual/en/function.filter-var.php
207201
*
208202
* @return mixed
209203
*/
210-
public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = array(), $deep = false)
204+
public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = array())
211205
{
212-
static $filters = null;
213-
214-
if (null === $filters) {
215-
foreach (filter_list() as $tmp) {
216-
$filters[filter_id($tmp)] = 1;
217-
}
218-
}
219-
if (is_bool($filter) || !isset($filters[$filter]) || is_array($deep)) {
220-
@trigger_error('Passing the $deep boolean as 3rd argument to the '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Remove it altogether as the $deep argument will be removed in 3.0.', E_USER_ERROR);
221-
$tmp = $deep;
222-
$deep = $filter;
223-
$filter = $options;
224-
$options = $tmp;
225-
}
226-
227-
$value = $this->get($key, $default, $deep);
206+
$value = $this->get($key, $default);
228207

229208
// Always turn $options into an array - this allows filter_var option shortcuts.
230209
if (!is_array($options) && $options) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.