updated-packages
This commit is contained in:
31
vendor/symfony/http-foundation/ParameterBag.php
vendored
31
vendor/symfony/http-foundation/ParameterBag.php
vendored
@@ -23,10 +23,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
/**
|
||||
* @param array $parameters An array of parameters
|
||||
*/
|
||||
public function __construct(array $parameters = array())
|
||||
public function __construct(array $parameters = [])
|
||||
{
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
@@ -53,20 +50,16 @@ class ParameterBag implements \IteratorAggregate, \Countable
|
||||
|
||||
/**
|
||||
* Replaces the current parameters by a new set.
|
||||
*
|
||||
* @param array $parameters An array of parameters
|
||||
*/
|
||||
public function replace(array $parameters = array())
|
||||
public function replace(array $parameters = [])
|
||||
{
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds parameters.
|
||||
*
|
||||
* @param array $parameters An array of parameters
|
||||
*/
|
||||
public function add(array $parameters = array())
|
||||
public function add(array $parameters = [])
|
||||
{
|
||||
$this->parameters = array_replace($this->parameters, $parameters);
|
||||
}
|
||||
@@ -81,7 +74,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default;
|
||||
return \array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +97,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function has($key)
|
||||
{
|
||||
return array_key_exists($key, $this->parameters);
|
||||
return \array_key_exists($key, $this->parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,7 +147,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
|
||||
public function getDigits($key, $default = '')
|
||||
{
|
||||
// we need to remove - and + because they're allowed in the filter
|
||||
return str_replace(array('-', '+'), '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT));
|
||||
return str_replace(['-', '+'], '', $this->filter($key, $default, \FILTER_SANITIZE_NUMBER_INT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,7 +173,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function getBoolean($key, $default = false)
|
||||
{
|
||||
return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN);
|
||||
return $this->filter($key, $default, \FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,22 +184,22 @@ class ParameterBag implements \IteratorAggregate, \Countable
|
||||
* @param int $filter FILTER_* constant
|
||||
* @param mixed $options Filter options
|
||||
*
|
||||
* @see http://php.net/manual/en/function.filter-var.php
|
||||
* @see https://php.net/filter-var
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = array())
|
||||
public function filter($key, $default = null, $filter = \FILTER_DEFAULT, $options = [])
|
||||
{
|
||||
$value = $this->get($key, $default);
|
||||
|
||||
// Always turn $options into an array - this allows filter_var option shortcuts.
|
||||
if (!\is_array($options) && $options) {
|
||||
$options = array('flags' => $options);
|
||||
$options = ['flags' => $options];
|
||||
}
|
||||
|
||||
// Add a convenience check for arrays.
|
||||
if (\is_array($value) && !isset($options['flags'])) {
|
||||
$options['flags'] = FILTER_REQUIRE_ARRAY;
|
||||
$options['flags'] = \FILTER_REQUIRE_ARRAY;
|
||||
}
|
||||
|
||||
return filter_var($value, $filter, $options);
|
||||
@@ -217,6 +210,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @return \ArrayIterator An \ArrayIterator instance
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->parameters);
|
||||
@@ -227,6 +221,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @return int The number of parameters
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return \count($this->parameters);
|
||||
|
Reference in New Issue
Block a user