@@ -27,13 +27,14 @@ protected function toPage(mixed $value, bool $onlyNumerics = true): string|int|n
27
27
is_numeric ($ value ) => (int ) $ value ,
28
28
!is_string ($ value ) || $ value === '' => null ,
29
29
!$ this ->isEndpoint ($ value ) => $ onlyNumerics ? null : $ value ,
30
- default => $ this ->pageFromParsedUri (parse_url ($ value ), $ onlyNumerics ),
30
+ default => $ this ->pageFromParsedUri (parse_url ($ value ), $ onlyNumerics ), /** @phpstan-ignore-line */
31
31
};
32
32
}
33
33
34
34
/**
35
35
* Retrieve the page from the given parsed URI.
36
36
*
37
+ * @param array{path?: string, query?: string} $parsedUri
37
38
* @return ($onlyNumerics is true ? int|null : string|int|null)
38
39
*/
39
40
protected function pageFromParsedUri (array $ parsedUri , bool $ onlyNumerics = true ): string |int |null
@@ -55,7 +56,9 @@ protected function pageFromParsedUri(array $parsedUri, bool $onlyNumerics = true
55
56
protected function uriForPage (UriInterface $ uri , string $ page ): UriInterface
56
57
{
57
58
if ($ key = $ this ->config ->offsetKey ) {
58
- return Uri::withQueryValue ($ uri , $ key , strval (($ page - $ this ->config ->firstPage ) * $ this ->itemsPerPage ));
59
+ $ value = (intval ($ page ) - $ this ->config ->firstPage ) * $ this ->itemsPerPage ;
60
+
61
+ return Uri::withQueryValue ($ uri , $ key , strval ($ value ));
59
62
}
60
63
61
64
if (!$ pattern = $ this ->config ->pageInPath ) {
0 commit comments