The Wayback Machine - https://web.archive.org/web/20210705012600/https://github.com/symfony/symfony/pull/41787
Skip to content
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

[Security] Implement fluent interface on RememberMeBadge::disable() #41787

Merged
merged 1 commit into from Jun 22, 2021

Conversation

@derrabus
Copy link
Member

@derrabus derrabus commented Jun 22, 2021

Q A
Branch? 5.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

I was a bit puzzled when a I saw that RememberMeBadge::enable() implements a fluent interface while its counterpart disable() does not. This PR fixes this inconsistency.

The class is flagged as @final, so this change should not violate the BC promise.

Signed-off-by: Alexander M. Turek <me@derrabus.de>
@wouterj
Copy link
Member

@wouterj wouterj commented Jun 22, 2021

While I'm OK with merging, is there a real use-case for disable being fluent? I mean, $badge->disabled()->isEnabled() doesn't make much sense, and there aren't any other methods in the badge?

The reason btw for enabled() being fluent is because the default is disabled. I like doing (new RememberMeBadge())->enabled() instead of having to use a variable.

@derrabus
Copy link
Member Author

@derrabus derrabus commented Jun 22, 2021

I made this PR mainly to create a consistent behavior. The only use-case I can think of is a function that mutates and returns the badge, e.g.

return $badge->disable();

instead of

$badge->disable();

return $badge;
Copy link
Member

@wouterj wouterj left a comment

Makes sense!

@derrabus derrabus merged commit 8dfdd89 into symfony:5.3 Jun 22, 2021
11 checks passed
11 checks passed
@github-actions
Verify
Details
@github-actions
Psalm
Details
@github-actions
Integration (7.2)
Details
@github-actions
Integration (7.2)
Details
@github-actions
Integration (8.0)
Details
@github-actions
Integration (8.0)
Details
@github-actions
PHPUnit on PHP nightly PHPUnit on PHP nightly
Details
@github-actions
PHPUnit on PHP nightly PHPUnit on PHP nightly
Details
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
fabbot.io Your code looks good.
Details
@fabpot fabpot mentioned this pull request Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.