@@ -13,6 +13,9 @@ final class Drop implements StepBuilderInterface
1313 private ?Node \Expr $ logger = null ;
1414 private ?Node \Expr $ rejection = null ;
1515 private ?Node \Expr $ state = null ;
16+
17+ private ?string $ reason = null ;
18+
1619 /** @var list<?Node\Expr> */
1720 private array $ exclusions = [];
1821
@@ -48,6 +51,13 @@ public function withExclusions(Node\Expr ...$exclusions): self
4851 return $ this ;
4952 }
5053
54+ public function withReason (string $ reason ): self
55+ {
56+ $ this ->reason = $ reason ;
57+
58+ return $ this ;
59+ }
60+
5161 private function buildExclusions (Node \Expr ...$ exclusions ): Node \Expr
5262 {
5363 if (\count ($ exclusions ) > 3 ) {
@@ -122,16 +132,15 @@ class: new Node\Stmt\Class_(null, [
122132 new Node \Expr \Variable ('input ' ),
123133 new Node \Expr \Yield_ (
124134 new Node \Expr \New_ (
125- class: new Node \Name \FullyQualified ('Kiboko \\Component \\Bucket \\RejectionResultBucket ' ),
135+ class: new Node \Name \FullyQualified (
136+ \Kiboko \Component \Bucket \RejectionResultBucket::class
137+ ),
126138 args: [
127139 new Node \Arg (
128- new Node \Expr \MethodCall (
129- new Node \Expr \Variable ('exception ' ),
130- 'getMessage '
131- ),
140+ new Node \Scalar \String_ ($ this ->reason ),
132141 ),
133142 new Node \Arg (
134- new Node \Expr \Variable ( ' exception ' ),
143+ new Node \Expr \ConstFetch ( new Node \ Name ( ' null ' ) ),
135144 ),
136145 new Node \Arg (
137146 new Node \Expr \Variable ('input ' ),
0 commit comments