zendframework/zf2 — pull request #735 by jtai (2012-01-15 19:44:55+00:00)
Title: Bugfixes for Zend\Di\Display\Console

When printing definitions, we should only print the classes, methods, and
parameters provided by the current definition. For example, if a DefinitionList
has two definitions -- a RuntimeDefinition and an ArrayDefinition loaded from
an out-of-date compiled definition -- we should print the good info under the
RuntimeDefinition and the stale info under the ArrayDefinition. Passing the
current definition into renderClassDefinition() makes this possible. The
current implementation (before this patch) ignores the current definition and
always queries the DefinitionList for the first definition that has the class
defined. In the earlier example, this would print the good info under the
ArrayDefinition, which is misleading.

This patch also fixes a subtle bug caused by nested calls to the
SplDoublyLinkedList iterator. In the current implementation, the render()
method iterates over the DefinitionList (which extends SplDoublyLinkedList). In
the loop, it calls renderClassDefinition(), which calls the DefinitionList's
getMethods() and getMethodParameters() methods. These methods also iterate over
the DefinitionList, resetting the current position and causing the outer loop
to lose its place. As a result, render() would fail to print all configured
definitions in some cases. This patch doesn't query the DefinitionList in
renderClassDefinition(), so the outer loop should behave as expected.