fabpot/Silex — pull request #792 by cspray (2013-09-18 01:39:00+00:00)
Title: Allowing Traversable objects as Application and Provider configurations

## Overview

This pull request lifts the restrictions on arrays being passed as configuration values to `Application::__construct()` and `Application:;register()` In its place we check for whether or not the value passed can be iterated over with foreach without causing a warning. If the configuration value is not traversable (see new private method below) an `InvalidArgumentException` is thrown stating that a traversable value must be passed to the appropriate method.

### Use Cases

The primary use case for this would be utilizing an immutable object as a configuration store.

### Added Methods

`Application::isTraversable($var)` is a private method that determines whether or not the value can be iterated over by checking if the value is (1) an array OR (2) it is of type Traversable OR (3) it is of type stdClass.

---

As far as I can tell this introduces no backwards compatibility breaks.

Let me know if I need to add some test cases for the check for stdClass or if there's something else I can do to get this merged in.

Thanks for creating a project that's easy to contribute to.
`
`