fabpot/Pimple — pull request #106 by divsmith (2014-01-27 09:34:41+00:00)
Title: Instance parameter/object overloading

Adds the ability to set a different parameter or object to be returned from the container for a given key the next time it is resolved, similar to Laravel's App::instance() function.

```PHP
$pimple = new Pimple();
$pimple['foo'] = function() {
return new Foo();
};
$bar = $pimple['foo']; // Foo()
```

This lets tests specify a mock dependency to be resolved once into the class being tested...

```PHP
$pimple->instance('foo', function() {
return new MockFoo();
};
$bar = $pimple['foo']; // MockFoo()
```

... without altering behavior outside the test. All subsequent resolutions for the key return the original value.

```PHP
$bar = $pimple['foo']; // Foo()
```