aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lua/conform/formatters/php_cs_fixer.lua15
2 files changed, 16 insertions, 0 deletions
diff --git a/README.md b/README.md
index 873f0ba..1f79cb1 100644
--- a/README.md
+++ b/README.md
@@ -203,6 +203,7 @@ To view configured and available formatters, as well as to see the log file, run
- [perlimports](https://github.com/perl-ide/App-perlimports) - Make implicit Perl imports explicit
- [perltidy](https://github.com/perltidy/perltidy) - Perl::Tidy, a source code formatter for Perl
- [pg_format](https://github.com/darold/pgFormatter) - PostgreSQL SQL syntax beautifier.
+- [php_cs_fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) - The PHP Coding Standards Fixer.
- [prettier](https://github.com/prettier/prettier) - Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
- [prettierd](https://github.com/fsouza/prettierd) - prettier, as a daemon, for ludicrous formatting speed.
- [rubocop](https://github.com/rubocop/rubocop) - Ruby static code analyzer and formatter, based on the community Ruby style guide.
diff --git a/lua/conform/formatters/php_cs_fixer.lua b/lua/conform/formatters/php_cs_fixer.lua
new file mode 100644
index 0000000..e63ec42
--- /dev/null
+++ b/lua/conform/formatters/php_cs_fixer.lua
@@ -0,0 +1,15 @@
+local util = require("conform.util")
+
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer",
+ description = "The PHP Coding Standards Fixer.",
+ },
+ command = util.find_executable({
+ "tools/php-cs-fixer/vendor/bin/php-cs-fixer",
+ "vendor/bin/php-cs-fixer",
+ }, "php-cs-fixer"),
+ args = { "fix", "$FILENAME" },
+ stdin = false,
+}