@@ -18,13 +18,15 @@ public function enterNode(Node $node): ?Node
1818 if ($ node instanceof Node \Expr \FuncCall && !$ node ->isFirstClassCallable ()) {
1919 $ attributes = $ node ->getAttributes ();
2020 $ origPipeAttributes = $ attributes [PipeTransformerVisitor::ORIGINAL_PIPE_ATTRIBUTE_NAME ] ?? [];
21+ $ origVariadicPlaceholderAttributes = $ attributes [PipeTransformerVisitor::ORIGINAL_VARIADIC_PLACEHOLDER_ATTRIBUTE_NAME ] ?? [];
2122 if ($ origPipeAttributes !== [] && count ($ node ->getArgs ()) === 1 ) {
2223 $ origPipeAttributes [self ::ARG_ATTRIBUTES_NAME ] = $ node ->getArgs ()[0 ]->getAttributes ();
2324 if ($ node ->name instanceof Node \Name) {
2425 unset($ attributes [PipeTransformerVisitor::ORIGINAL_PIPE_ATTRIBUTE_NAME ]);
26+ unset($ attributes [PipeTransformerVisitor::ORIGINAL_VARIADIC_PLACEHOLDER_ATTRIBUTE_NAME ]);
2527 return new Node \Expr \BinaryOp \Pipe (
2628 $ node ->getArgs ()[0 ]->value ,
27- new Node \Expr \FuncCall ($ node ->name , [new Node \VariadicPlaceholder ()], attributes: $ attributes ),
29+ new Node \Expr \FuncCall ($ node ->name , [new Node \VariadicPlaceholder ($ origVariadicPlaceholderAttributes )], attributes: $ attributes ),
2830 attributes: $ origPipeAttributes ,
2931 );
3032 }
@@ -40,12 +42,14 @@ public function enterNode(Node $node): ?Node
4042 if ($ node instanceof Node \Expr \MethodCall && !$ node ->isFirstClassCallable ()) {
4143 $ attributes = $ node ->getAttributes ();
4244 $ origPipeAttributes = $ attributes [PipeTransformerVisitor::ORIGINAL_PIPE_ATTRIBUTE_NAME ] ?? [];
45+ $ origVariadicPlaceholderAttributes = $ attributes [PipeTransformerVisitor::ORIGINAL_VARIADIC_PLACEHOLDER_ATTRIBUTE_NAME ] ?? [];
4346 if ($ origPipeAttributes !== [] && count ($ node ->getArgs ()) === 1 ) {
4447 $ origPipeAttributes [self ::ARG_ATTRIBUTES_NAME ] = $ node ->getArgs ()[0 ]->getAttributes ();
4548 unset($ attributes [PipeTransformerVisitor::ORIGINAL_PIPE_ATTRIBUTE_NAME ]);
49+ unset($ attributes [PipeTransformerVisitor::ORIGINAL_VARIADIC_PLACEHOLDER_ATTRIBUTE_NAME ]);
4650 return new Node \Expr \BinaryOp \Pipe (
4751 $ node ->getArgs ()[0 ]->value ,
48- new Node \Expr \MethodCall ($ node ->var , $ node ->name , [new Node \VariadicPlaceholder ()], attributes: $ attributes ),
52+ new Node \Expr \MethodCall ($ node ->var , $ node ->name , [new Node \VariadicPlaceholder ($ origVariadicPlaceholderAttributes )], attributes: $ attributes ),
4953 attributes: $ origPipeAttributes ,
5054 );
5155 }
@@ -54,12 +58,14 @@ public function enterNode(Node $node): ?Node
5458 if ($ node instanceof Node \Expr \StaticCall && !$ node ->isFirstClassCallable ()) {
5559 $ attributes = $ node ->getAttributes ();
5660 $ origPipeAttributes = $ attributes [PipeTransformerVisitor::ORIGINAL_PIPE_ATTRIBUTE_NAME ] ?? [];
61+ $ origVariadicPlaceholderAttributes = $ attributes [PipeTransformerVisitor::ORIGINAL_VARIADIC_PLACEHOLDER_ATTRIBUTE_NAME ] ?? [];
5762 if ($ origPipeAttributes !== [] && count ($ node ->getArgs ()) === 1 ) {
5863 $ origPipeAttributes [self ::ARG_ATTRIBUTES_NAME ] = $ node ->getArgs ()[0 ]->getAttributes ();
5964 unset($ attributes [PipeTransformerVisitor::ORIGINAL_PIPE_ATTRIBUTE_NAME ]);
65+ unset($ attributes [PipeTransformerVisitor::ORIGINAL_VARIADIC_PLACEHOLDER_ATTRIBUTE_NAME ]);
6066 return new Node \Expr \BinaryOp \Pipe (
6167 $ node ->getArgs ()[0 ]->value ,
62- new Node \Expr \StaticCall ($ node ->class , $ node ->name , [new Node \VariadicPlaceholder ()], attributes: $ attributes ),
68+ new Node \Expr \StaticCall ($ node ->class , $ node ->name , [new Node \VariadicPlaceholder ($ origVariadicPlaceholderAttributes )], attributes: $ attributes ),
6369 attributes: $ origPipeAttributes ,
6470 );
6571 }
0 commit comments