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

[5.6] Parameter has no usage inside the method. So we better remove it. #22202

Conversation

khanrn
Copy link
Contributor

@khanrn khanrn commented Nov 24, 2017

$decayMinutes = 1 parameter has no usage inside the method. So we better remove it.

@khanrn
Copy link
Contributor Author

khanrn commented Nov 24, 2017

@m1guelpf I'm kinda curious about your down vote. Would you please explain it a little bit ? I'm very interested to learn. :)

@jmarcher
Copy link
Contributor

Probably because this PR is incomplete, tooManyAttempts is used in a few places, eliminating this parameter would break those parts.

Check:

return $this->limiter()->tooManyAttempts(
and
if ($this->limiter->tooManyAttempts($key, $maxAttempts, $decayMinutes)) {

@khanrn
Copy link
Contributor Author

khanrn commented Nov 24, 2017

Well @jmarcher I don't think this will break anything. Cause passing more arguments than expected to a method is supported from PHP 4. So changing to tooManyAttempts methods parameter will not harm anything.

Beside, this $decayMinutes parameter is doing nothing inside tooManyAttempts method. So, if a parameter is doing nothing then how it can harm anything.

@jmarcher
Copy link
Contributor

So you make a PR deleting one unused parameter but still want to leave unused parameters to this very same method calls?

@tillkruss tillkruss changed the title Parameter has no usage inside the method. So we better remove it. [5.6] Parameter has no usage inside the method. So we better remove it. Nov 24, 2017
@khanrn
Copy link
Contributor Author

khanrn commented Nov 24, 2017

Uha.. I never said that @jmarcher. That's different thing and I'm working on that. My point is it wouldn't break anything. But better to clear it everywhere and that's what I'm doing right now. Anyway, thanks for pointing that out and make it clear.

@sisve
Copy link
Contributor

sisve commented Nov 24, 2017

We cannot remove the calls that sends in a $decayMinutes argument; that would be weird for everyone that has a custom RateLimiter that actually uses the parameter. Are we sure that this isn't a bug where we actually should be using $decayMinutes in the tooManyAttempts() method?

@laurencei
Copy link
Contributor

Are we sure that this isn't a bug where we actually should be using $decayMinutes in the tooManyAttempts() method?

It was made redunant when @themsaid did this PR: #20759

So looks intentional.

@taylorotwell
Copy link
Member

@themsaid can you review this?

Copy link
Member

@themsaid themsaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally left the parameter to avoid having a breaking change with people using a custom limiter that extends this one, the change was only 5 days before the release so it made sense back then.

For 5.6 I think it's safe to remove the parameter as it's not used in this method anymore.

@jmarcher
Copy link
Contributor

I know this may slow down the Framework development speed but I think we should first Deprecate method/parameters/attributes in the first release and remove in the second one.

Like discussed here: laravel/ideas#383

This type of changes do take a lot of effort for package developers or people customizing the core for their needs.

@taylorotwell taylorotwell merged commit c2bb45c into laravel:master Nov 29, 2017
@khanrn khanrn deleted the tooManyAttempts-method-of-RateLimiter-class-parameter-fix branch April 19, 2018 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants