From b90ca2eeaf3e94a962e242498a8af28b537029ae Mon Sep 17 00:00:00 2001 From: crynobone Date: Thu, 21 Jul 2016 19:59:18 +0800 Subject: [PATCH] [5.2] Avoid introducing breaking backward compatibility on patch release. Closes #14396 Signed-off-by: crynobone --- src/Illuminate/Support/MessageBag.php | 4 ++++ tests/Support/SupportMessageBagTest.php | 1 + 2 files changed, 5 insertions(+) diff --git a/src/Illuminate/Support/MessageBag.php b/src/Illuminate/Support/MessageBag.php index ad422ebdb56a..575b8d1937b9 100755 --- a/src/Illuminate/Support/MessageBag.php +++ b/src/Illuminate/Support/MessageBag.php @@ -103,6 +103,10 @@ protected function isUnique($key, $message) */ public function has($key = null) { + if (is_null($key)) { + return $this->any(); + } + $keys = is_array($key) ? $key : func_get_args(); foreach ($keys as $key) { diff --git a/tests/Support/SupportMessageBagTest.php b/tests/Support/SupportMessageBagTest.php index 45611a2dfa96..7536c93b0ab6 100755 --- a/tests/Support/SupportMessageBagTest.php +++ b/tests/Support/SupportMessageBagTest.php @@ -72,6 +72,7 @@ public function testHasIndicatesExistence() $container->add('foo', 'bar'); $this->assertTrue($container->has('foo')); $this->assertFalse($container->has('bar')); + $this->assertTrue($container->has()); } public function testHasAnyIndicatesExistence()