diff --git a/composer.json b/composer.json index 9660ee9..7166595 100644 --- a/composer.json +++ b/composer.json @@ -17,8 +17,7 @@ "psr/http-client-implementation": "^1", "psr/http-factory": "^1.0", "psr/http-factory-implementation": "^1", - "psr/http-message": "^1.0 || ^2.0", - "webmozart/assert": "^1.11" + "psr/http-message": "^1.0 || ^2.0" }, "require-dev": { "ergebnis/composer-normalize": "^2.52", @@ -29,7 +28,6 @@ "phpstan/phpstan": "^2.2", "phpstan/phpstan-phpunit": "^2.0", "phpstan/phpstan-strict-rules": "^2.0", - "phpstan/phpstan-webmozart-assert": "^2.0", "phpunit/phpunit": "^10.5", "rector/rector": "^2.0", "shipmonk/composer-dependency-analyser": "^1.8", diff --git a/src/Request/CollectionRequestOptions.php b/src/Request/CollectionRequestOptions.php index 4184532..ea4512e 100644 --- a/src/Request/CollectionRequestOptions.php +++ b/src/Request/CollectionRequestOptions.php @@ -4,8 +4,6 @@ namespace Setono\Quickpay\Request; -use Webmozart\Assert\Assert; - /** * Immutable options for a paginated list request: which page and how many entries per page. * @@ -19,13 +17,13 @@ public function __construct( public readonly int $page = 1, public readonly int $pageSize = 20, ) { - Assert::greaterThanEq($page, 1); - Assert::greaterThanEq($pageSize, 1); - } + if ($page < 1) { + throw new \InvalidArgumentException(sprintf('Expected $page to be at least 1, got %d.', $page)); + } - public static function new(): self - { - return new self(); + if ($pageSize < 1) { + throw new \InvalidArgumentException(sprintf('Expected $pageSize to be at least 1, got %d.', $pageSize)); + } } public function withPage(int $page): self diff --git a/tests/Request/CollectionRequestOptionsTest.php b/tests/Request/CollectionRequestOptionsTest.php index 966e6f4..eb26cb2 100644 --- a/tests/Request/CollectionRequestOptionsTest.php +++ b/tests/Request/CollectionRequestOptionsTest.php @@ -42,7 +42,7 @@ public function it_maps_to_the_page_and_page_size_query_params(): void #[Test] public function it_builds_modified_copies_immutably(): void { - $opts = CollectionRequestOptions::new(); + $opts = new CollectionRequestOptions(); self::assertSame(1, $opts->page); self::assertSame(20, $opts->pageSize);