From edff01ec2ddb03e30876ddf5d581eee9de1c7d13 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sun, 28 Mar 2021 23:42:18 +0200 Subject: [PATCH] Fix InputBag deprecation --- src/Symfony/Component/HttpFoundation/InputBag.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/InputBag.php b/src/Symfony/Component/HttpFoundation/InputBag.php index 2c21748e08c7d..4520b246656e0 100644 --- a/src/Symfony/Component/HttpFoundation/InputBag.php +++ b/src/Symfony/Component/HttpFoundation/InputBag.php @@ -23,20 +23,20 @@ final class InputBag extends ParameterBag /** * Returns a string input value by name. * - * @param string|null $default The default value if the input key does not exist + * @param string|int|float|bool|null $default The default value if the input key does not exist * - * @return string|null + * @return string|int|float|bool|null */ public function get(string $key, $default = null) { if (null !== $default && !is_scalar($default) && !(\is_object($default) && method_exists($default, '__toString'))) { - trigger_deprecation('symfony/http-foundation', '5.1', 'Passing a non-string value as 2nd argument to "%s()" is deprecated, pass a string or null instead.', __METHOD__); + trigger_deprecation('symfony/http-foundation', '5.1', 'Passing a non-scalar value as 2nd argument to "%s()" is deprecated, pass a scalar or null instead.', __METHOD__); } $value = parent::get($key, $this); if (null !== $value && $this !== $value && !is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { - trigger_deprecation('symfony/http-foundation', '5.1', 'Retrieving a non-string value from "%s()" is deprecated, and will throw a "%s" exception in Symfony 6.0, use "%s::all($key)" instead.', __METHOD__, BadRequestException::class, __CLASS__); + trigger_deprecation('symfony/http-foundation', '5.1', 'Retrieving a non-scalar value from "%s()" is deprecated, and will throw a "%s" exception in Symfony 6.0, use "%s::all($key)" instead.', __METHOD__, BadRequestException::class, __CLASS__); } return $this === $value ? $default : $value; @@ -72,12 +72,12 @@ public function add(array $inputs = []) /** * Sets an input by name. * - * @param string|array|null $value + * @param string|int|float|bool|array|null $value */ public function set(string $key, $value) { if (null !== $value && !is_scalar($value) && !\is_array($value) && !method_exists($value, '__toString')) { - trigger_deprecation('symfony/http-foundation', '5.1', 'Passing "%s" as a 2nd Argument to "%s()" is deprecated, pass a string, array, or null instead.', get_debug_type($value), __METHOD__); + trigger_deprecation('symfony/http-foundation', '5.1', 'Passing "%s" as a 2nd Argument to "%s()" is deprecated, pass a scalar, array, or null instead.', get_debug_type($value), __METHOD__); } $this->parameters[$key] = $value;