-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a way to add a reason to filtering plugin rejects or drops
- Loading branch information
Showing
8 changed files
with
45 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ final class Drop implements StepBuilderInterface | |
private ?Node\Expr $rejection = null; | ||
private ?Node\Expr $state = null; | ||
/** @var list<?Node\Expr> */ | ||
private array $exclusions = []; | ||
private ?ExclusionsBuilder $exclusions = null; | ||
Check failure on line 17 in src/Plugin/Filtering/Builder/Drop.php GitHub Actions / phpstan
|
||
|
||
public function __construct() | ||
{ | ||
|
@@ -41,9 +41,9 @@ public function withState(Node\Expr $state): self | |
return $this; | ||
} | ||
|
||
public function withExclusions(Node\Expr ...$exclusions): self | ||
public function withExclusions(ExclusionsBuilder $builder): self | ||
{ | ||
array_push($this->exclusions, ...$exclusions); | ||
$this->exclusions = $builder; | ||
|
||
return $this; | ||
} | ||
|
@@ -113,24 +113,7 @@ class: new Node\Stmt\Class_(null, [ | |
new Node\Name('true'), | ||
), | ||
[ | ||
new Node\Stmt\If_( | ||
$this->buildExclusions(...$this->exclusions), | ||
[ | ||
'stmts' => [ | ||
new Node\Stmt\Expression( | ||
new Node\Expr\Assign( | ||
new Node\Expr\Variable('input'), | ||
new Node\Expr\Yield_( | ||
new Node\Expr\New_( | ||
new Node\Name\FullyQualified('Kiboko\\Component\\Bucket\\RejectionResultBucket'), | ||
), | ||
), | ||
), | ||
), | ||
new Node\Stmt\Continue_(), | ||
], | ||
] | ||
), | ||
...$this->exclusions->build(), | ||
new Node\Stmt\Expression( | ||
new Node\Expr\Assign( | ||
new Node\Expr\Variable('input'), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters