In VSCode there's a function "Format document", when i work on a clientside code in TS/JS - prettier works awesome, it corrects indentation, string lines, semicolons. But i cannot find something similar for PHP. Can somebody advice a good plugins, if it does exists.
@janosk wait, is php inteliphense does the same work as php cs fixer? I have installed them both, but none of them does the job as prettier, for example, if i omit semicolon, then formatting a document won't put a semicolon there.
It does a lot more than php cs fixer, but in my opinion it has decent format capabilites. You weren't that specific about the semicolon before :) and to be honest i never used it for exactly that, therefore sadly i can't confirm if it has that ability at the moment.
Install the Prettier extension for VSCode.
Asuming you have nodejs installed, in your project run npm install --save-dev prettier @prettier/plugin-php.
Enjoy.
I've got a bunch of mangled code from using php_cs_fixer, I have PHPIntelliphense installed and it seems to be correcting these issues, but of course one page at a time.
Is there a way to run this on my entire app directory in one go? I'd also probably use husky and lint-staged moving forward to keep it formatted before it gets pushed. But for now I need to clean up an entire app.