File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 44
55use InvalidArgumentException as PhpInvalidArgumentException ;
66
7- final class InvalidArgumentException extends PhpInvalidArgumentException implements PaginationException
7+ final class ArgumentWasInvalid extends PhpInvalidArgumentException implements PaginationException
88{
99}
Original file line number Diff line number Diff line change 22
33namespace Tempest \Support \Paginator ;
44
5- use Tempest \Support \Paginator \Exceptions \InvalidArgumentException ;
5+ use Tempest \Support \Paginator \Exceptions \ArgumentWasInvalid ;
66
77final class Paginator
88{
@@ -13,19 +13,19 @@ public function __construct(
1313 private(set) int $ maxLinks = 10 ,
1414 ) {
1515 if ($ this ->totalItems < 0 ) {
16- throw new InvalidArgumentException ('Total items cannot be negative ' );
16+ throw new ArgumentWasInvalid ('Total items cannot be negative ' );
1717 }
1818
1919 if ($ this ->itemsPerPage <= 0 ) {
20- throw new InvalidArgumentException ('Items per page must be positive ' );
20+ throw new ArgumentWasInvalid ('Items per page must be positive ' );
2121 }
2222
2323 if ($ this ->currentPage <= 0 ) {
24- throw new InvalidArgumentException ('Current page must be positive ' );
24+ throw new ArgumentWasInvalid ('Current page must be positive ' );
2525 }
2626
2727 if ($ this ->maxLinks <= 0 ) {
28- throw new InvalidArgumentException ('Max links must be positive ' );
28+ throw new ArgumentWasInvalid ('Max links must be positive ' );
2929 }
3030
3131 $ this ->currentPage = min (max (1 , $ this ->currentPage ), $ this ->totalPages );
Original file line number Diff line number Diff line change 55use PHPUnit \Framework \Attributes \DataProvider ;
66use PHPUnit \Framework \Attributes \Test ;
77use PHPUnit \Framework \TestCase ;
8- use Tempest \Support \Paginator \Exceptions \InvalidArgumentException ;
8+ use Tempest \Support \Paginator \Exceptions \ArgumentWasInvalid ;
99use Tempest \Support \Paginator \PaginatedData ;
1010use Tempest \Support \Paginator \Paginator ;
1111
@@ -116,7 +116,7 @@ public function test_it_constrains_current_page_to_valid_range(): void
116116
117117 $ this ->assertSame (5 , $ paginator ->currentPage ); // Should be capped at max page
118118
119- $ this ->expectException (InvalidArgumentException ::class);
119+ $ this ->expectException (ArgumentWasInvalid ::class);
120120 $ this ->createPaginator (currentPage: 0 );
121121 }
122122
You can’t perform that action at this time.
0 commit comments