symfony/symfony — pull request #2816 by kriswallsmith (2011-12-08 16:55:37+00:00)
Title: [Security] added SecurityContextInterface::getUser()

This changes helps the common use case of fetching the current user and better complies with the [Law of Demeter][1].

Before (still works):

$token = $context->getToken();
$user = $token ? $token->getUser() : null;

After:

$user = $context->getUser();

The fine print:

```
Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: ~
Todo: ~
```

[1]: http://en.wikipedia.org/wiki/Law_of_Demeter