Skip to content

Commit

Permalink
IterableProcessorInterface extend FilterProcessorInterface (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Dec 29, 2022
1 parent d458436 commit ff32287
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Reader/Iterable/IterableDataReader.php
Expand Up @@ -51,7 +51,7 @@ class IterableDataReader implements DataReaderInterface
private int $offset = 0;

/**
* @psalm-var array<string, FilterProcessorInterface&IterableProcessorInterface>
* @psalm-var array<string, IterableProcessorInterface>
*/
private array $filterProcessors = [];

Expand Down
3 changes: 1 addition & 2 deletions src/Reader/Iterable/Processor/Between.php
Expand Up @@ -7,12 +7,11 @@
use DateTimeInterface;
use InvalidArgumentException;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Data\Reader\Filter\FilterProcessorInterface;
use Yiisoft\Data\Reader\FilterDataValidationHelper;

use function count;

final class Between implements IterableProcessorInterface, FilterProcessorInterface
final class Between implements IterableProcessorInterface
{
public function getOperator(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Reader/Iterable/Processor/CompareProcessor.php
Expand Up @@ -6,12 +6,11 @@

use InvalidArgumentException;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Data\Reader\Filter\FilterProcessorInterface;
use Yiisoft\Data\Reader\FilterDataValidationHelper;

use function count;

abstract class CompareProcessor implements IterableProcessorInterface, FilterProcessorInterface
abstract class CompareProcessor implements IterableProcessorInterface
{
/**
* @param mixed $itemValue
Expand Down
3 changes: 1 addition & 2 deletions src/Reader/Iterable/Processor/EqualsEmpty.php
Expand Up @@ -5,12 +5,11 @@
namespace Yiisoft\Data\Reader\Iterable\Processor;

use InvalidArgumentException;
use Yiisoft\Data\Reader\Filter\FilterProcessorInterface;
use Yiisoft\Data\Reader\FilterDataValidationHelper;

use function count;

final class EqualsEmpty implements IterableProcessorInterface, FilterProcessorInterface
final class EqualsEmpty implements IterableProcessorInterface
{
public function getOperator(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Reader/Iterable/Processor/EqualsNull.php
Expand Up @@ -6,12 +6,11 @@

use InvalidArgumentException;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Data\Reader\Filter\FilterProcessorInterface;
use Yiisoft\Data\Reader\FilterDataValidationHelper;

use function count;

final class EqualsNull implements IterableProcessorInterface, FilterProcessorInterface
final class EqualsNull implements IterableProcessorInterface
{
public function getOperator(): string
{
Expand Down
4 changes: 1 addition & 3 deletions src/Reader/Iterable/Processor/GroupProcessor.php
Expand Up @@ -5,7 +5,6 @@
namespace Yiisoft\Data\Reader\Iterable\Processor;

use InvalidArgumentException;
use Yiisoft\Data\Reader\Filter\FilterProcessorInterface;
use Yiisoft\Data\Reader\FilterDataValidationHelper;

use function array_shift;
Expand All @@ -14,7 +13,7 @@
use function is_string;
use function sprintf;

abstract class GroupProcessor implements IterableProcessorInterface, FilterProcessorInterface
abstract class GroupProcessor implements IterableProcessorInterface
{
abstract protected function checkResults(array $results): bool;

Expand Down Expand Up @@ -60,7 +59,6 @@ public function match(array|object $item, array $arguments, array $filterProcess
throw new InvalidArgumentException('The operator string cannot be empty.');
}

/** @var IterableProcessorInterface|null $filterProcessor */
$filterProcessor = $filterProcessors[$operator] ?? null;

if ($filterProcessor === null) {
Expand Down
4 changes: 3 additions & 1 deletion src/Reader/Iterable/Processor/IterableProcessorInterface.php
Expand Up @@ -4,7 +4,9 @@

namespace Yiisoft\Data\Reader\Iterable\Processor;

interface IterableProcessorInterface
use Yiisoft\Data\Reader\Filter\FilterProcessorInterface;

interface IterableProcessorInterface extends FilterProcessorInterface
{
public function match(array|object $item, array $arguments, array $filterProcessors): bool;
}
4 changes: 1 addition & 3 deletions src/Reader/Iterable/Processor/Not.php
Expand Up @@ -5,7 +5,6 @@
namespace Yiisoft\Data\Reader\Iterable\Processor;

use InvalidArgumentException;
use Yiisoft\Data\Reader\Filter\FilterProcessorInterface;
use Yiisoft\Data\Reader\FilterDataValidationHelper;

use function array_shift;
Expand All @@ -14,7 +13,7 @@
use function is_string;
use function sprintf;

final class Not implements IterableProcessorInterface, FilterProcessorInterface
final class Not implements IterableProcessorInterface
{
public function getOperator(): string
{
Expand Down Expand Up @@ -53,7 +52,6 @@ public function match(array|object $item, array $arguments, array $filterProcess
throw new InvalidArgumentException('The operator string cannot be empty.');
}

/** @var IterableProcessorInterface|null $filterProcessor */
$filterProcessor = $filterProcessors[$operator] ?? null;

if ($filterProcessor === null) {
Expand Down

0 comments on commit ff32287

Please sign in to comment.