merged branch drak/flashcountpt2 (PR #6443)

This PR was merged into the master branch.

Commits
-------

0cf9fcb [HttpFoundation] Deprecated count() and \Countable

Discussion
----------

[HttpFoundation] Deprecated count() and \Countable

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #6408
Todo: -
License of the code: MIT
Documentation PR: -

The docblock is done in #6423 so will be merged up.

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

by stloyd at 2013-01-07T11:19:20Z

@fabpot ping

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

by drak at 2013-01-07T11:22:54Z

This should be OK for merge as the solution was agreed with @fabpot before making the PR.

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

by fabpot at 2013-01-07T11:24:50Z

@drak Can you add an entry in the CHANGELOG stating that this is a BC break?

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

by drak at 2013-01-07T15:31:21Z

@fabpot - There doesnt seem to be a CHANGELOG-2.2 in the master branch... where should I place the information?

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

by Tobion at 2013-01-07T15:46:25Z

@drak just in the CHANGELOG under the 2.2. header

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

by fabpot at 2013-01-07T15:48:43Z

Here: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/CHANGELOG.md

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

by drak at 2013-01-07T15:48:45Z

@Tobion - thanks, I forgot it's in the package root, not the repo root. :)

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

by drak at 2013-01-07T15:52:37Z

@fabpot - updated changelog, squashed  and rebased.
This commit is contained in:
Fabien Potencier 2013-01-07 16:55:41 +01:00
commit c4a2a2ba2b
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()));
}
}