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

Fix bug concerning null ApiRateLimit instance in RateLimitHandler #11

Merged
merged 2 commits into from
Jul 15, 2019
Merged

Fix bug concerning null ApiRateLimit instance in RateLimitHandler #11

merged 2 commits into from
Jul 15, 2019

Conversation

baudev
Copy link
Contributor

@baudev baudev commented Jul 9, 2019

When using the master version, the following error occurs:

Argument 2 passed to Indragunawan\\ApiRateLimitBundle\\Service\\RateLimitHandler::getThrottle() must be an instance of Indragunawan\\ApiRateLimitBundle\\Annotation\\ApiRateLimit, null given, called in /var/www/html/vendor/indragunawan/api-rate-limit-bundle/Service/RateLimitHandler.php on line 157

The responsible lines are:

if (null !== $annotation) {
$this->enabled = $annotation->enabled;
}
list($key, $limit, $period) = $this->getThrottle($request, $annotation);

Indeed, if $annotation is null, the getThrottle method fails. It's why creating a new instance of ApiRateLimit is required if this case.

Copy link
Owner

@IndraGunawan IndraGunawan left a comment

Choose a reason for hiding this comment

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

Hi @baudev, thanks for your PR.
just simple request changes about indentation, you can use php-cs-fixer to fix it

@baudev
Copy link
Contributor Author

baudev commented Jul 10, 2019

By the way, it could be great adding friendsofphp/php-cs-fixer in the composer.json.

@IndraGunawan IndraGunawan merged commit 8811924 into IndraGunawan:master Jul 15, 2019
@IndraGunawan
Copy link
Owner

thanks @baudev !

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

2 participants