Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #163: Rename FilterableDataInterface::withFilterHandlers() to FilterableDataInterface::withAddedFilterHandlers() #192

Merged
merged 1 commit into from
Sep 8, 2024
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
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
Loading