codeguy/Slim — pull request #303 by michael-h (2012-05-23 15:14:37+00:00)
Title: Slim_View::appendData: Remove array type hint for greater flexibility when subclassing

This is a very small change. `Slim_View::appendData` just accepts arrays. In certain circumstances, it would be desirable to allow objects as input.

(I've run into this when I tried to make Mustache lambdas work in PHP 5.2. It is easy, but you need to pass in an object rather than an array because in PHP 5.2, arrays can't yet contain functions.)

Removing the type hint would provide just that flexibility when subclassing `Slim_View`.

Code is attached. For a bit of pseudo type safety, I've added a run-time check to the `Slim_View` base class, throwing an exception if the parameter is not an array. There's also a test for that case.

Now that's a lot of words for a two-line change ;)