Shouldn't the key be $type instead? Right now the following won't work well:

```php
$request->session->flash('Good job');
$request->session->flash('Nope', 'error');
```

I would expect both messages to be stored separately.