minor #23047 [Security] explain that a role can be an instance of Role (xabbuh)

This PR was merged into the 3.3 branch.

Discussion
----------

[Security] explain that a role can be an instance of Role

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Only mentioning the RoleInterface seems to be confusing as it is
deprecated since Symfony 3.3.

Commits
-------

0068968 explain that a role can be an instance of Role
This commit is contained in:
Nicolas Grekas 2017-06-03 10:38:50 +02:00
commit 9deef61700

View File

@ -43,7 +43,7 @@ abstract class AbstractToken implements TokenInterface
if (is_string($role)) {
$role = new Role($role);
} elseif (!$role instanceof RoleInterface) {
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, or RoleInterface instances, but got %s.', gettype($role)));
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, Role instances or RoleInterface instances, but got %s.', gettype($role)));
}
$this->roles[] = $role;