minor #29955 [Security] use final annotation to allow mocking the class (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[Security] use final annotation to allow mocking the class

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

When the class was initially marked as `final`, it did only contain constants. Since #24337 the `Security` class also contains useful shortcut methods so allowing developers to mock the class in tests looks reasonable to me.

Commits
-------

1da00db247 use final annotation to allow mocking the class
This commit is contained in:
Robin Chalas 2019-01-23 12:22:36 +01:00
commit 47b739cba2
1 changed files with 3 additions and 1 deletions

View File

@ -17,8 +17,10 @@ use Symfony\Component\Security\Core\User\UserInterface;
/**
* Helper class for commonly-needed security tasks.
*
* @final
*/
final class Security
class Security
{
const ACCESS_DENIED_ERROR = '_security.403_error';
const AUTHENTICATION_ERROR = '_security.last_error';