From 8541b26c531d194fe1c1fb6dc55ecaf7d2912988 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 30 Oct 2023 09:45:51 +0100 Subject: [PATCH] fix code after merge --- src/Plugin/Filtering/Builder/Reject.php | 2 +- src/Plugin/Filtering/DTO/Exclusion.php | 3 ++- src/Plugin/Filtering/Factory/Reject.php | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Plugin/Filtering/Builder/Reject.php b/src/Plugin/Filtering/Builder/Reject.php index e62d069b..eda64e74 100644 --- a/src/Plugin/Filtering/Builder/Reject.php +++ b/src/Plugin/Filtering/Builder/Reject.php @@ -72,7 +72,7 @@ private function buildExclusions(Exclusion ...$exclusions): array new Node\Expr\New_( $exclusion->reason ? new Node\Name\FullyQualified(RejectionWithReasonResultBucket::class) : new Node\Name\FullyQualified(RejectionResultBucket::class), [ - null !== $this->rejection_serializer ? new Node\Arg($this->rejection_serializer) : new Node\Arg(new Node\Expr\Variable('input')), + $exclusion->rejectionSerializer ? new Node\Arg($exclusion->rejectionSerializer) : new Node\Arg(new Node\Expr\Variable('input')), $exclusion->reason ? new Node\Arg($exclusion->reason) : new Node\Arg( new Node\Expr\ConstFetch( new Node\Name(null) diff --git a/src/Plugin/Filtering/DTO/Exclusion.php b/src/Plugin/Filtering/DTO/Exclusion.php index 7dfc1af5..7c0f2eda 100644 --- a/src/Plugin/Filtering/DTO/Exclusion.php +++ b/src/Plugin/Filtering/DTO/Exclusion.php @@ -10,6 +10,7 @@ class Exclusion { public function __construct( public Expr $when, - public ?Expr $reason = null + public ?Expr $reason = null, + public ?Expr $rejectionSerializer = null ){} } diff --git a/src/Plugin/Filtering/Factory/Reject.php b/src/Plugin/Filtering/Factory/Reject.php index e4f118b3..296525ba 100644 --- a/src/Plugin/Filtering/Factory/Reject.php +++ b/src/Plugin/Filtering/Factory/Reject.php @@ -73,11 +73,9 @@ public function compile(array $config): Repository\Reject new Filtering\DTO\Exclusion( compileExpression($interpreter, $condition['when']), compileValueWhenExpression($interpreter, $condition['reason']) ?: null, + compileExpression($interpreter, $condition['rejection_serializer']) ?: null ), ); - if (\array_key_exists('rejection_serializer', $condition)) { - $builder->withRejectionSerializer(compileExpression($interpreter, $condition['rejection_serializer'])); - } } return $repository;