Skip to content

Commit

Permalink
Fix #163: Rename FilterableDataInterface::withFilterHandlers() to Fil…
Browse files Browse the repository at this point in the history
…terableDataInterface::withAddedFilterHandlers() (#192)
  • Loading branch information
samdark authored Sep 8, 2024
1 parent d77f8ff commit 9c31209
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- New #176: Add `OrderHelper` (@vjik)
- New #173, #184: Add `$caseSensitive` parameter to `Like` filter to control whether the search must be case-sensitive
or not (@arogachev)
- Chg #163: Rename `FilterableDataInterface::withFilterHandlers()` to `FilterableDataInterface::withAddedFilterHandlers()` (@samdark)

## 1.0.1 January 25, 2023

Expand Down
2 changes: 1 addition & 1 deletion src/Reader/FilterableDataInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ public function withFilter(FilterInterface $filter): static;
* @return static New instance.
* @psalm-return $this
*/
public function withFilterHandlers(FilterHandlerInterface ...$filterHandlers): static;
public function withAddedFilterHandlers(FilterHandlerInterface ...$filterHandlers): static;
}
2 changes: 1 addition & 1 deletion src/Reader/Iterable/IterableDataReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function __construct(private iterable $data)
/**
* @psalm-return $this
*/
public function withFilterHandlers(FilterHandlerInterface ...$filterHandlers): static
public function withAddedFilterHandlers(FilterHandlerInterface ...$filterHandlers): static
{
$new = clone $this;
$new->iterableFilterHandlers = array_merge(
Expand Down
4 changes: 2 additions & 2 deletions tests/Paginator/KeysetPaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function withFilter(FilterInterface $filter): static
return clone $this;
}

public function withFilterHandlers(FilterHandlerInterface ...$filterHandlers): static
public function withAddedFilterHandlers(FilterHandlerInterface ...$filterHandlers): static
{
return clone $this;
}
Expand Down Expand Up @@ -603,7 +603,7 @@ public function withFilter(FilterInterface $filter): static
return clone $this;
}

public function withFilterHandlers(FilterHandlerInterface ...$filterHandlers): static
public function withAddedFilterHandlers(FilterHandlerInterface ...$filterHandlers): static
{
return clone $this;
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Reader/Iterable/IterableDataReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testImmutability(): void
{
$reader = new IterableDataReader([]);

$this->assertNotSame($reader, $reader->withFilterHandlers());
$this->assertNotSame($reader, $reader->withAddedFilterHandlers());
$this->assertNotSame($reader, $reader->withFilter(null));
$this->assertNotSame($reader, $reader->withSort(null));
$this->assertNotSame($reader, $reader->withOffset(1));
Expand All @@ -91,7 +91,7 @@ public function getFilterClass(): string
);
$this->expectExceptionMessage($message);

(new IterableDataReader([]))->withFilterHandlers($nonIterableFilterHandler);
(new IterableDataReader([]))->withAddedFilterHandlers($nonIterableFilterHandler);
}

public function testWithLimitFailForNegativeValues(): void
Expand Down Expand Up @@ -383,7 +383,7 @@ public function testGeneratorAsDataSet(): void
public function testCustomFilter(): void
{
$reader = (new IterableDataReader(self::DEFAULT_DATASET))
->withFilterHandlers(new DigitalHandler())
->withAddedFilterHandlers(new DigitalHandler())
->withFilter(
new All(new GreaterThan('id', 0), new Digital('name'))
);
Expand All @@ -398,7 +398,7 @@ public function testCustomEqualsProcessor(): void

$dataReader = (new IterableDataReader(self::DEFAULT_DATASET))
->withSort($sort)
->withFilterHandlers(
->withAddedFilterHandlers(
new class () implements IterableFilterHandlerInterface {
public function getFilterClass(): string
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Support/MutationDataReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public function withFilter(FilterInterface $filter): static
return $new;
}

public function withFilterHandlers(FilterHandlerInterface ...$filterHandlers): static
public function withAddedFilterHandlers(FilterHandlerInterface ...$filterHandlers): static
{
$new = clone $this;
$new->decorated = $this->decorated->withFilterHandlers(...$filterHandlers);
$new->decorated = $this->decorated->withAddedFilterHandlers(...$filterHandlers);
return $new;
}

Expand Down

0 comments on commit 9c31209

Please sign in to comment.