From 789fc1414555570b24606ab5b206847c8f25f09c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesc=20Ros=C3=A0s?= Date: Thu, 31 May 2012 04:28:05 +0300 Subject: [PATCH 1/2] Accept calling setLenient(false) --- src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php b/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php index a448a588e2..573f1a35ca 100644 --- a/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php +++ b/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php @@ -416,11 +416,13 @@ class StubIntlDateFormatter * * @see http://www.php.net/manual/en/intldateformatter.setlenient.php * - * @throws MethodNotImplementedException + * @throws MethodNotImplementedException When $lenient is true */ public function setLenient($lenient) { - throw new MethodNotImplementedException(__METHOD__); + if ($lenient) { + throw new MethodNotImplementedException(__METHOD__); + } } /** From 49380804224509d55f2fbc86d6ef10bebd5e328d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesc=20Ros=C3=A0s?= Date: Thu, 31 May 2012 05:04:03 +0200 Subject: [PATCH 2/2] MethodNotImplementedException -> MethodArgumentValueNotImplementedException --- src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php | 4 ++-- .../Tests/Component/Locale/Stub/StubIntlDateFormatterTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php b/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php index 573f1a35ca..d236fb7845 100644 --- a/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php +++ b/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php @@ -416,12 +416,12 @@ class StubIntlDateFormatter * * @see http://www.php.net/manual/en/intldateformatter.setlenient.php * - * @throws MethodNotImplementedException When $lenient is true + * @throws MethodArgumentValueNotImplementedException When $lenient is true */ public function setLenient($lenient) { if ($lenient) { - throw new MethodNotImplementedException(__METHOD__); + throw new MethodArgumentValueNotImplementedException(__METHOD__, 'lenient', $lenient, 'Only the strict parser is supported'); } } diff --git a/tests/Symfony/Tests/Component/Locale/Stub/StubIntlDateFormatterTest.php b/tests/Symfony/Tests/Component/Locale/Stub/StubIntlDateFormatterTest.php index 79bcd5299c..e289e92399 100644 --- a/tests/Symfony/Tests/Component/Locale/Stub/StubIntlDateFormatterTest.php +++ b/tests/Symfony/Tests/Component/Locale/Stub/StubIntlDateFormatterTest.php @@ -908,7 +908,7 @@ class StubIntlDateFormatterTest extends LocaleTestCase } /** - * @expectedException Symfony\Component\Locale\Exception\MethodNotImplementedException + * @expectedException Symfony\Component\Locale\Exception\MethodArgumentValueNotImplementedException */ public function testSetLenient() {