silexphp/Silex — pull request #1083 by marcusesa (2014-12-25 16:25:32+00:00)
Title: Inject app in function or object that handler error.

Inject $app in function or object that handler error.
When we use a object like:
```php
$app->error(new ErrorHandler);
```
or a array like:
```php
$app->error(array('ErrorHandler', 'myMethod'));
```
we cant use $app inside the class. Now we can do it:
```php
class ErrorHandler
{
public function __invoke(\Exception $exception, $request, $app, $code)
{
if ($app['debug']) {
return;
}

$app['monolog']->addError(sprintf('An error occurred: %s', $exception->getMessage()));
}
}
```
or
```php
class ErrorHandler
{
public function myMethod(\Exception $exception, $request, $app, $code)
{
if ($app['debug']) {
return;
}

$app['monolog']->addError(sprintf('An error occurred: %s', $exception->getMessage()));
}
}
```