laravel/framework — pull request #2925 by stristr (2013-12-12 22:11:01+00:00)
Title: Type casting paginator current and last pages

I noticed that when I invoke Paginator::getLastPage(), the return value is a float (not an int).

This came up when I was writing an API responder that automatically handles paginated data and tells the caller where the next resource list is:

$current_page = $paginator->getCurrentPage();
$last_page = $paginator->getLastPage();

$next_endpoint = ($current_page !== $last_page) ? $paginator->getUrl($current_page + 1) : null;

The strict equality check fails because calculateCurrentAndLastPages sends us a float for lastPage and an int for currentPage.