diff --git a/service_container/tags.rst b/service_container/tags.rst index 6783ef06d4e..76d4cb9792e 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -798,7 +798,7 @@ array element. For example, to retrieve the ``handler_two`` handler:: { public function __construct(iterable $handlers) { - $handlers = iterator_to_array($handlers); + $handlers = $handlers instanceof \Traversable ? iterator_to_array($handlers) : $handlers; $handlerTwo = $handlers['handler_two']; }