diff --git a/src/Config/FiltersConfig.php b/src/Config/FiltersConfig.php index 5155385..82f724e 100644 --- a/src/Config/FiltersConfig.php +++ b/src/Config/FiltersConfig.php @@ -4,9 +4,7 @@ namespace Spiral\Filters\Config; -use Spiral\Core\CoreInterceptorInterface; use Spiral\Core\InjectableConfig; -use Spiral\Interceptors\InterceptorInterface; final class FiltersConfig extends InjectableConfig { @@ -16,9 +14,6 @@ final class FiltersConfig extends InjectableConfig 'interceptors' => [], ]; - /** - * @return array> - */ public function getInterceptors(): array { return (array)($this->config['interceptors'] ?? []); diff --git a/src/Model/FilterProvider.php b/src/Model/FilterProvider.php index f8f7b47..65022e9 100644 --- a/src/Model/FilterProvider.php +++ b/src/Model/FilterProvider.php @@ -11,9 +11,6 @@ use Spiral\Filters\Model\Schema\Builder; use Spiral\Filters\Model\Schema\InputMapper; use Spiral\Filters\InputInterface; -use Spiral\Interceptors\Context\CallContext; -use Spiral\Interceptors\Context\Target; -use Spiral\Interceptors\HandlerInterface; use Spiral\Models\SchematicEntity; /** @@ -22,13 +19,11 @@ */ final class FilterProvider implements FilterProviderInterface { - private readonly bool $isLegacy; public function __construct( private readonly ContainerInterface $container, private readonly ResolverInterface $resolver, - private readonly HandlerInterface|CoreInterface $core + private readonly CoreInterface $core ) { - $this->isLegacy = !$core instanceof HandlerInterface; } public function createFilter(string $name, InputInterface $input): FilterInterface @@ -61,12 +56,9 @@ public function createFilter(string $name, InputInterface $input): FilterInterfa $errors = \array_merge($errors, $inputErrors); $entity = new SchematicEntity($data, $schema); - $args = [ + return $this->core->callAction($name, 'handle', [ 'filterBag' => new FilterBag($filter, $entity, $schema, $errors), - ]; - return $this->isLegacy - ? $this->core->callAction($name, 'handle', $args) - : $this->core->handle(new CallContext(Target::fromPair($name, 'handle'), $args)); + ]); } private function createFilterInstance(string $name): FilterInterface diff --git a/src/Model/Interceptor/Core.php b/src/Model/Interceptor/Core.php index 61afa62..8ce26fa 100644 --- a/src/Model/Interceptor/Core.php +++ b/src/Model/Interceptor/Core.php @@ -7,13 +7,11 @@ use Spiral\Core\CoreInterface; use Spiral\Filters\Model\FilterBag; use Spiral\Filters\Model\FilterInterface; -use Spiral\Interceptors\Context\CallContext; -use Spiral\Interceptors\HandlerInterface; /** * @psalm-type TParameters = array{filterBag: FilterBag} */ -final class Core implements CoreInterface, HandlerInterface +final class Core implements CoreInterface { /** * @param-assert TParameters $parameters @@ -24,12 +22,4 @@ public function callAction(string $controller, string $action, array $parameters return $parameters['filterBag']->filter; } - - public function handle(CallContext $context): FilterInterface - { - $args = $context->getArguments(); - \assert($args['filterBag'] instanceof FilterBag); - - return $args['filterBag']->filter; - } }