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

Cast total results to int before returning #214

Merged
merged 1 commit into from
May 14, 2023

Conversation

craigpotter
Copy link
Contributor

This PR forces the results of the totalResults method on the paginator to return an int.

The method already has return type of int however some API don't follow conventions and actually supply this value as a string.

{
	"ResultInfo": {
		"page": "1",
		"per_page": "20",
		"total_count": "47"
	},
}

Without this PR, this results in an error due to a mismatch in the return type.

@what-the-diff
Copy link

what-the-diff bot commented May 13, 2023

PR Summary 🌟

  • Change in totalResults() method
    The method now makes sure that the $total variable is always an integer. This improves the code reliability and ensures smooth functioning. Keep up the great work! 😃

Copy link
Member

@Sammyjo20 Sammyjo20 left a comment

Choose a reason for hiding this comment

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

Thanks @craigpotter 🦸‍♂️

@Sammyjo20 Sammyjo20 merged commit 8d53814 into saloonphp:v2 May 14, 2023
@craigpotter craigpotter deleted the fix/cast-totalResults-to-int branch May 15, 2023 08:43
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.

2 participants