Code formatter conflicts with phpfixer?

Hi
Does phpstorm disable the built-in formatter when PHP CS Fixer formatting is enabled? I think they do conflict.
Upload id: 2024_01_29_SH87wK7PK6Ls9WqFTZNEo8 (file: CleanShot 2024-01-29 at 10.14.15.mp4)
Is this an issue on phpstorm or am I doing something wrong?
Thank you
Please sign in to leave a comment.
The real issue is when I try to commit
Recording:
https://cln.sh/62cKlsMC
I think it's because when the IDE reformats the file, it “resets” it to the initial state, then it sees no change and fails to commit.
Maybe the IDE is not waiting for the external formatter?
Hi,
No, it does not and it leads to several problems.
However, it will be possible to disable a built-in formatter when an external is configured in PhpStorm 2024.1:
https://youtrack.jetbrains.com/issue/WI-71860/Option-to-only-apply-External-Formatter-on-Reformat-Code-or-a-separate-action-to-trigger-it#focus=Comments-27-8372989.0-0
This option should be already available in the current 2024.1 EAP build, feel free to try:
https://www.jetbrains.com/phpstorm/nextversion/
Thank you for your reply
I'm fine with two formatters running, but it resulted in a commit issue, can you check my second message? Thank you
What version are you using?
There were several bugs with commit on external formatter fixed in the latest build.
But I guess that running two formatters at once still can be an issue. If you decide to try EAP 2024.1, I would suggest waiting for the next cycle (should be available later this week) as there is will be a fix for a problem with this new feature and ironically, commits:
https://youtrack.jetbrains.com/issue/WI-75383/External-formatter-invoked-on-commit-is-being-applied-after-commit
I have this version. I will try the EAP but can it be possible for the IDE to wait for external formatters before comitting?
Thank you!
There are still several sorts of issues with external formatters, so I am wondering if this is something new or you are experiencing one of the unfixed bugs. It seems a bit different but in this case, “Optimize imports” cause the problem:
https://youtrack.jetbrains.com/issue/WI-75740/Using-External-Formatter-causes-File-Change-Conflict-when-Optimise-imports-option-enabled
Would it be possible to untick this option on commit and check if anything changes?
If it is still reproducible, I would suggest to submit a YouTrack ticket with logs (and if possible, one of the affected files), so we could take a closer look:
https://youtrack.jetbrains.com/newIssue
Before reproducing the issue and collecting logs, I would suggest enabling an extended log level first. It is simple, just add the following line to the “Help > Diagnostic Tools > Debug Log Settings”:
com.jetbrains.php
Afterwards, logs can be collected as usual with the “Help > Collect Logs” menu option.
I disabled Optimize import for now to avoid the problem, thank you
I will follow the youtrack issue
Thank you for your support
Best regards
Just to confirm that I understand it correctly, did it actually help?
Yes. the commit worked fine when I unticked “Optimize imports”
Thank you
Cool, thank you!
Then it must be WI-75740. Hopefully, it will be fixed in nearest builds.