Skip to content

Commit 14ec6a7

Browse files
taylorotwellchalasr
authored andcommitted
[HttpFoundation] Allow null in InputBag@set
1 parent bf2fb93 commit 14ec6a7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Symfony/Component/HttpFoundation/InputBag.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ public function add(array $inputs = [])
7272
/**
7373
* Sets an input by name.
7474
*
75-
* @param string|array $value
75+
* @param string|array|null $value
7676
*/
7777
public function set(string $key, $value)
7878
{
79-
if (!is_scalar($value) && !\is_array($value) && !method_exists($value, '__toString')) {
80-
trigger_deprecation('symfony/http-foundation', '5.1', 'Passing "%s" as a 2nd Argument to "%s()" is deprecated, pass a string or an array instead.', get_debug_type($value), __METHOD__);
79+
if (null !== $value && !is_scalar($value) && !\is_array($value) && !method_exists($value, '__toString')) {
80+
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__);
8181
}
8282

8383
$this->parameters[$key] = $value;

src/Symfony/Component/HttpFoundation/Tests/InputBagTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testFilterArray()
5151
public function testSetWithNonStringishOrArrayIsDeprecated()
5252
{
5353
$bag = new InputBag();
54-
$this->expectDeprecation('Since symfony/http-foundation 5.1: Passing "Symfony\Component\HttpFoundation\InputBag" as a 2nd Argument to "Symfony\Component\HttpFoundation\InputBag::set()" is deprecated, pass a string or an array instead.');
54+
$this->expectDeprecation('Since symfony/http-foundation 5.1: Passing "Symfony\Component\HttpFoundation\InputBag" as a 2nd Argument to "Symfony\Component\HttpFoundation\InputBag::set()" is deprecated, pass a string, array, or null instead.');
5555
$bag->set('foo', new InputBag());
5656
}
5757

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy