aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornedia <aiden@nedia.dev>2023-09-27 16:42:29 +1300
committerGitHub <noreply@github.com>2023-09-26 20:42:29 -0700
commite691ecaf41139a68ccb79fde824cb534ca11abd2 (patch)
treeec6fc517b74e5b0d4901c75f153c5382505c1843
parent9e1fcd5cafc42b5dfbe2e942ddbece0dada4e1d0 (diff)
feat: Add support for php-cs-fixer (#78)
* feat(php-cs-fixer): Add support for php-cs-fixer * chore: Update README * fix(php-cs-fixer): Include meta * fix(php-cs-fixer): And include type annotation * fix(php-cs-fixer): Use find_executable instead of path_or
-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,
+}