Browse Source

merged branch beberlei/GH-4491 (PR #4493)

Commits
-------

4938080 MethodNotImplementedException -> MethodArgumentValueNotImplementedException
789fc14 Accept calling setLenient(false)

Discussion
----------

GH-4491 - Move patch from master to 2.0

A patch in PR-4469 fixed an issue with setLenient() and not having intl. This was only merged into master, although the original issue was created in the 2.0 branch. This PR cherry-picked the patches against 2.0 again.

---------------------------------------------------------------------------

by travisbot at 2012-06-06T15:29:19Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1527145) (merged 49380804 into 9a5e6c90).

---------------------------------------------------------------------------

by kbond at 2012-06-06T17:42:40Z

fixes #4491
Fabien Potencier 13 năm trước cách đây
mục cha
commit
15b5aa4f7c

+ 4 - 2
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 MethodArgumentValueNotImplementedException When $lenient is true
      */
     public function setLenient($lenient)
     {
-        throw new MethodNotImplementedException(__METHOD__);
+        if ($lenient) {
+            throw new MethodArgumentValueNotImplementedException(__METHOD__, 'lenient', $lenient, 'Only the strict parser is supported');
+        }
     }
 
     /**

+ 1 - 1
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()
     {