diff --git a/CHANGELOG.md b/CHANGELOG.md index b7f1dd8b..8e7f9fed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ not found (@vjik) - Enh #161: Add more specified psalm annotations to `CountableDataInterface::count()`, `PaginatorInterface::getCurrentPageSize()` and `OffsetPaginator::getTotalItems()` (@vjik) +- Chg #166: Remove `EqualsEmpty` filter (@vjik) ## 1.0.1 January 25, 2023 diff --git a/README.md b/README.md index d5bfc58a..0f459ac1 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,6 @@ Filter could be composed with: - `Any` - `Between` - `Equals` -- `EqualsEmpty` - `EqualsNull` - `GreaterThan` - `GreaterThanOrEqual` diff --git a/src/Reader/Filter/EqualsEmpty.php b/src/Reader/Filter/EqualsEmpty.php deleted file mode 100644 index 5ed330ff..00000000 --- a/src/Reader/Filter/EqualsEmpty.php +++ /dev/null @@ -1,30 +0,0 @@ -field]; - } - - public static function getOperator(): string - { - return 'empty'; - } -} diff --git a/src/Reader/Iterable/FilterHandler/EqualsEmptyHandler.php b/src/Reader/Iterable/FilterHandler/EqualsEmptyHandler.php deleted file mode 100644 index 948ee976..00000000 --- a/src/Reader/Iterable/FilterHandler/EqualsEmptyHandler.php +++ /dev/null @@ -1,36 +0,0 @@ -assertSame(['empty', 'test'], $filter->toCriteriaArray()); - } -} diff --git a/tests/Reader/IterableHandler/EqualsEmptyTest.php b/tests/Reader/IterableHandler/EqualsEmptyTest.php deleted file mode 100644 index 37b32358..00000000 --- a/tests/Reader/IterableHandler/EqualsEmptyTest.php +++ /dev/null @@ -1,64 +0,0 @@ - null]], - [true, ['value' => false]], - [true, ['value' => 0]], - [true, ['value' => 0.0]], - [true, ['value' => '0']], - [true, ['value' => '']], - [false, ['value' => 42]], - [false, ['value' => '1']], - [false, ['value' => true]], - ]; - } - - #[DataProvider('matchDataProvider')] - public function testMatch(bool $expected, array $item): void - { - $this->assertSame($expected, (new EqualsEmptyHandler())->match($item, ['value'], [])); - } - - public static function invalidCountArgumentsDataProvider(): array - { - return [ - 'zero' => [[]], - 'two' => [[1, 2]], - 'three' => [[1, 2, 3]], - 'four' => [[1, 2, 3, 4]], - ]; - } - - #[DataProvider('invalidCountArgumentsDataProvider')] - public function testMatchFailForInvalidCountArguments($arguments): void - { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('$arguments should contain exactly one element.'); - - (new EqualsEmptyHandler())->match(['id' => 1], $arguments, []); - } - - #[DataProvider('invalidStringValueDataProvider')] - public function testMatchFailForInvalidFieldValue($field): void - { - $type = get_debug_type($field); - - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage("The field should be string. The $type is received."); - - (new EqualsEmptyHandler())->match(['id' => 1], [$field], []); - } -}