Skip to content

Commit bc07f76

Browse files
committed
[Refactor] Enhance newline handling for fluent calls in BetterStandardPrinter
1 parent 659a165 commit bc07f76

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/PhpParser/Printer/BetterStandardPrinter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,10 @@ protected function pExpr_MethodCall(MethodCall $methodCall): string
375375
return parent::pExpr_MethodCall($methodCall);
376376
}
377377

378-
if (SimpleParameterProvider::provideBoolParameter(Option::NEW_LINE_ON_FLUENT_CALL) === false) {
378+
$globalFlag = SimpleParameterProvider::provideBoolParameter(Option::NEW_LINE_ON_FLUENT_CALL);
379+
$perNodeFlag = (bool) $methodCall->getAttribute(AttributeKey::NEWLINE_ON_FLUENT_CALL, false);
380+
381+
if ($globalFlag === false && $perNodeFlag === false) {
379382
return parent::pExpr_MethodCall($methodCall);
380383
}
381384

0 commit comments

Comments
 (0)