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 4ffe14c

Browse filesBrowse files
committed
[HttpFoundation] Remove deprecated class method parameter
1 parent 4d2ea16 commit 4ffe14c
Copy full SHA for 4ffe14c

File tree

Expand file treeCollapse file tree

2 files changed

+19
-25
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+19
-25
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/ParameterBag.php
+12-18Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -128,88 +128,82 @@ 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, $deep, FILTER_SANITIZE_NUMBER_INT));
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, $deep, FILTER_VALIDATE_BOOLEAN);
189+
return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN);
195190
}
196191

197192
/**
198193
* Filter key.
199194
*
200195
* @param string $key Key.
201196
* @param mixed $default Default = null.
202-
* @param bool $deep Default = false.
203197
* @param int $filter FILTER_* constant.
204198
* @param mixed $options Filter options.
205199
*
206200
* @see http://php.net/manual/en/function.filter-var.php
207201
*
208202
* @return mixed
209203
*/
210-
public function filter($key, $default = null, $deep = false, $filter = FILTER_DEFAULT, $options = array())
204+
public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = array())
211205
{
212-
$value = $this->get($key, $default, $deep);
206+
$value = $this->get($key, $default);
213207

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

‎src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,26 +137,26 @@ public function testFilter()
137137

138138
$this->assertEmpty($bag->filter('nokey'), '->filter() should return empty by default if no key is found');
139139

140-
$this->assertEquals('0123', $bag->filter('digits', '', false, FILTER_SANITIZE_NUMBER_INT), '->filter() gets a value of parameter as integer filtering out invalid characters');
140+
$this->assertEquals('0123', $bag->filter('digits', '', FILTER_SANITIZE_NUMBER_INT), '->filter() gets a value of parameter as integer filtering out invalid characters');
141141

142-
$this->assertEquals('example@example.com', $bag->filter('email', '', false, FILTER_VALIDATE_EMAIL), '->filter() gets a value of parameter as email');
142+
$this->assertEquals('example@example.com', $bag->filter('email', '', FILTER_VALIDATE_EMAIL), '->filter() gets a value of parameter as email');
143143

144-
$this->assertEquals('http://example.com/foo', $bag->filter('url', '', false, FILTER_VALIDATE_URL, array('flags' => FILTER_FLAG_PATH_REQUIRED)), '->filter() gets a value of parameter as URL with a path');
144+
$this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, array('flags' => FILTER_FLAG_PATH_REQUIRED)), '->filter() gets a value of parameter as URL with a path');
145145

146146
// This test is repeated for code-coverage
147-
$this->assertEquals('http://example.com/foo', $bag->filter('url', '', false, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as URL with a path');
147+
$this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as URL with a path');
148148

149-
$this->assertFalse($bag->filter('dec', '', false, FILTER_VALIDATE_INT, array(
149+
$this->assertFalse($bag->filter('dec', '', FILTER_VALIDATE_INT, array(
150150
'flags' => FILTER_FLAG_ALLOW_HEX,
151151
'options' => array('min_range' => 1, 'max_range' => 0xff),
152152
)), '->filter() gets a value of parameter as integer between boundaries');
153153

154-
$this->assertFalse($bag->filter('hex', '', false, FILTER_VALIDATE_INT, array(
154+
$this->assertFalse($bag->filter('hex', '', FILTER_VALIDATE_INT, array(
155155
'flags' => FILTER_FLAG_ALLOW_HEX,
156156
'options' => array('min_range' => 1, 'max_range' => 0xff),
157157
)), '->filter() gets a value of parameter as integer between boundaries');
158158

159-
$this->assertEquals(array('bang'), $bag->filter('array', '', false), '->filter() gets a value of parameter as an array');
159+
$this->assertEquals(array('bang'), $bag->filter('array', ''), '->filter() gets a value of parameter as an array');
160160
}
161161

162162
public function testGetIterator()

0 commit comments

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