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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Illuminate/Cache/RateLimiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ public function __construct(Cache $cache)
*
* @param string $key
* @param int $maxAttempts
* @param float|int $decayMinutes
* @return bool
*/
public function tooManyAttempts($key, $maxAttempts, $decayMinutes = 1)
public function tooManyAttempts($key, $maxAttempts)
{
if ($this->attempts($key) >= $maxAttempts) {
if ($this->cache->has($key.':timer')) {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Auth/ThrottlesLogins.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait ThrottlesLogins
protected function hasTooManyLoginAttempts(Request $request)
{
return $this->limiter()->tooManyAttempts(
$this->throttleKey($request), $this->maxAttempts(), $this->decayMinutes()
$this->throttleKey($request), $this->maxAttempts()
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/Middleware/ThrottleRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes

$maxAttempts = $this->resolveMaxAttempts($request, $maxAttempts);

if ($this->limiter->tooManyAttempts($key, $maxAttempts, $decayMinutes)) {
if ($this->limiter->tooManyAttempts($key, $maxAttempts)) {
throw $this->buildException($key, $maxAttempts);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Cache/CacheRateLimiterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testTooManyAttemptsReturnTrueIfAlreadyLockedOut()
$cache->shouldReceive('add')->never();
$rateLimiter = new RateLimiter($cache);

$this->assertTrue($rateLimiter->tooManyAttempts('key', 1, 1));
$this->assertTrue($rateLimiter->tooManyAttempts('key', 1));
}

public function testHitProperlyIncrementsAttemptCount()
Expand Down