Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
14 changes: 6 additions & 8 deletions src/Request/CollectionRequestOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/Request/CollectionRequestOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading