From what I read clang-format is for c/c++/obj-c.
Which tool like clang-format would you recommend to automatically format/reformat PHP/HTML code in a consistent way? And why?
The use case would be to check code formatting in CI (continuous integration) when submitted through a ‘pull request’ for example.
If there is no such tool, how can we do this with clang-format?
Advertisement
Answer
I can recommend PHP-CS-Fixer which is both a code standards checker. You can create your own ruleset or use existing rules. It can fix basic issues for you(locally) and can also be used in a CI to indicate rule violations. Here is an example of a github pipeline and config: https://gist.github.com/sixlive/2862a2185c76988838acaa45687a575c