Skip to content

Commit 042406a

Browse files
schulerj89Joshua Schuler
andauthored
Fix param type for hasAny() in Illuminate\Support\MessageBag (#43841)
* fix param type for MessageBag hasAny() * add has any with key null test Co-authored-by: Joshua Schuler <[email protected]>
1 parent f4468c1 commit 042406a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Illuminate/Support/MessageBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function has($key)
139139
/**
140140
* Determine if messages exist for any of the given keys.
141141
*
142-
* @param array|string $keys
142+
* @param array|string|null $keys
143143
* @return bool
144144
*/
145145
public function hasAny($keys = [])

tests/Support/SupportMessageBagTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,14 @@ public function testHasAnyIndicatesExistence()
151151
$this->assertFalse($container->hasAny('baz', 'biz'));
152152
}
153153

154+
public function testHasAnyWithKeyNull()
155+
{
156+
$container = new MessageBag;
157+
$container->setFormat(':message');
158+
$container->add('foo', 'bar');
159+
$this->assertTrue($container->hasAny(null));
160+
}
161+
154162
public function testHasIndicatesExistenceOfAllKeys()
155163
{
156164
$container = new MessageBag;

0 commit comments

Comments
 (0)