Bug 497266 - Code formatter doesn't allow for new line before closing parenthesis
Summary: Code formatter doesn't allow for new line before closing parenthesis
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-04 15:17 EDT by Samuel Sol CLA
Modified: 2021-01-25 10:38 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Sol CLA 2016-07-04 15:17:01 EDT
Greetings everyone,

The PHP Code Formatter doesn't allow you to force a new line before the closing parenthesis of a function/method call, although it allows you to do that on array initializers. If you get for example, the PSR-2 code style, it says that, on multi-line function calls, the closing parenthesis must be on its on line, indented to the opening call. So for example:

CORRECT
-------
$this->funcCall(
    $val1, $val2
);


WRONG
-------
$this->funcCall(
    $val1, $val2);

Unfortunately the formatter doesn't allow you to add the new line on method calls, although it has that option for array initializers.
Comment 1 Samuel Sol CLA 2016-07-18 22:28:12 EDT
As a related post, this is a bug fix for the same issue on the Java Formatter. It was fixed recently, but the options created are not part of the PDT Formatter.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=370540
Comment 2 Antoine GALLET CLA 2021-01-25 10:38:33 EST
Whiteout this fixed the formatter is useless.
I've been using eclipse PDT for years now and never use formatter because of this single issue.
An option should be added for the formatter to resolve this issue.
It should be present for function calls Arguments and for Object allocation arguments.
Those options have been added to the java formatter years ago and I am shocked it has not been fixed yet for PDT.