symfony/symfony — pull request #10173 by gigablah (2014-02-01 12:31:08+00:00)
Title: [HttpFoundation] Implement Countable interface for RequestStack

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a

This PR makes it possible to obtain the number of requests currently in `RequestStack` with `count()`.

An example use case for this is keeping separate states in a listener for each level of subrequest. I initially tried differentiating between the request objects, but this doesn't work if the same request is reused for the subrequest.

I've also added test cases for `RequestStack`.