-
Notifications
You must be signed in to change notification settings - Fork 882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP wrong format indentation #7462
Comments
I've noted that the problem is the use of implode()
|
I can't reproduce it. |
I've modified the first post adding the info about formatting (screenshots + format setting export) + what I would expect. |
Could you attach an example project as a zip file?
|
Your idea about using Project properties > Formatting > Use project specific options (that I didn't even know it existed :-) ) was the key to start comparing the global with the specific settings (that was not affected by such problem). Actually not even the default is good because it causes this problem The best is And this solves the problem. I'm gonna set it in the global option as well! Doesn't split unless I do and if I do it wraps well. |
Please attach your example project. |
For unknown reason I wasn't able to have back the exact bad behaviour mentioned before. It's almost the same though. The only difference is that before the problem was only on the |
Reproducible. Thanks! |
Thanks to you, you're doing a great job! |
Apache NetBeans version
Apache NetBeans 22
What happened
The code inside a function influences how is formatted the code into another function when making use of ALT+Shift+F
I already filed this bug that is a similar problemi for JS (#7243) but this one I think it's even worse.
Language / Project Type / NetBeans Component
PHP project
How to reproduce
(1) Comment the line
$res = ['test1' => 1, 'test2' => 2, 'test3' => implode(',', $test4)];
and press ALT Shift+F
You'll see "Array(" in the function stuff() moving in the right position.
(2)
Remove the comment from
$res = ['test1' => 1, 'test2' => 2, 'test3' => implode(',', $test4)];
and "array(" will move again in the bad position.
(3)
In the line
$res = ['test1' => 1, 'test2' => 2, 'test3' => implode(',', $test4)];
change "test3" with "test33333333333333333333" and you'll see "array(" moving further right.
I haven't found any workaround to solve this problem.
I'd like "array(" in the return of stuff() to stay on the first line, like this
or something like this
But that's not the point: regardless of what I expect to see, the problem is that "array(" moves right according to the length of
$res = ['test1' => 1, 'test2' => 2, 'test3' => implode(',', $test4)];
in the other function. That's quite weird.
PS: If this could help, I format all my code with tabs, not spaces.
Did this work correctly in an earlier version?
No / Don't know
Operating System
Debian Bookworm (12)
JDK
Java: 17.0.11; OpenJDK 64-Bit Server VM 17.0.11+9-Debian-1deb12u1 - Runtime: OpenJDK Runtime Environment 17.0.11+9-Debian-1deb12u1
Apache NetBeans packaging
Apache NetBeans binary zip
Anything else
No response
Are you willing to submit a pull request?
No
Attached
Screenshot of the editor formatting options


zip with export of formatting options
format.zip
The text was updated successfully, but these errors were encountered: