10000 [Security] use final annotation to allow mocking the class by xabbuh · Pull Request #29955 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] use final annotation to allow mocking the class #29955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2019

Conversation

xabbuh
Copy link
Member
@xabbuh xabbuh commented Jan 22, 2019
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.

@Kocal
Copy link
Member
Kocal commented Jan 22, 2019

Thanks, that will be really useful when using phpspec! (ping @tristanbes)

@raress96
Copy link

Can this be made also for Symfony 4, 4.1 and up?

@xabbuh
Copy link
Member Author
xabbuh commented Jan 23, 2019

@raresserban The 3.4 branch is merged up to all other maintained branches regularly. So if this is accepted, it will be present in all other maintained Symfony versions too.

< 8000 p class="text-center mt-3" data-hide-on-error>

@chalasr
Copy link
Member
chalasr commented Jan 23, 2019

Thank you @xabbuh.

@chalasr chalasr merged commit 1da00db into symfony:3.4 Jan 23, 2019
chalasr pushed a commit that referenced this pull request Jan 23, 2019
…ss (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
-------

1da00db use final annotation to allow mocking the class
@xabbuh xabbuh deleted the issue-29946 branch January 23, 2019 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0