[HttpFoundation] Deprecated count() and \Countable

This commit is contained in:
Drak 2012-12-20 17:42:47 +00:00
parent 43d056fb15
commit 0cf9fcb304
3 changed files with 5 additions and 1 deletions

View File

@ -8,6 +8,7 @@ CHANGELOG
* added Request::getRealMethod() to get the "real" HTTP method (getMethod() returns the "intended" HTTP method)
* disabled _method request parameter support by default (call Request::enableHttpMethodParameterOverride() to enable it)
* Request::splitHttpAcceptHeader() method is deprecated and will be removed in 2.3
* Deprecated Flashbag::count() and \Countable interface, will be removed in 2.3
2.1.0
-----

View File

@ -181,6 +181,8 @@ class FlashBag implements FlashBagInterface, \IteratorAggregate, \Countable
*/
public function count()
{
trigger_error(sprintf('%s() is deprecated since 2.2 and will be removed in 2.3', __METHOD__), E_USER_DEPRECATED);
return count($this->flashes);
}
}

View File

@ -135,6 +135,7 @@ class FlashBagTest extends \PHPUnit_Framework_TestCase
/**
* @covers Symfony\Component\HttpFoundation\Session\Flash\FlashBag::count
* @expectedException \PHPUnit_Framework_Error_Deprecated
*/
public function testCount()
{
@ -163,6 +164,6 @@ class FlashBagTest extends \PHPUnit_Framework_TestCase
}
$this->assertEquals(count($flashes), $i);
$this->assertEquals(0, count($this->bag));
$this->assertEquals(0, count($this->bag->all()));
}
}