From c8bc4ec044a0d8c96291426b5ce10f741d63e6b6 Mon Sep 17 00:00:00 2001 From: "Chad Wade Day, Jr" Date: Tue, 4 Sep 2018 17:27:05 -0700 Subject: [PATCH] Added phpcbf to the available PHP formatters (#187) --- README.md | 1 + autoload/neoformat/formatters/php.vim | 10 +++++++++- doc/neoformat.txt | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1623abd1..a7120ad5 100644 --- a/README.md +++ b/README.md @@ -314,6 +314,7 @@ that caused Neoformat to be invoked. - PHP - [`php_beautifier`](http://pear.php.net/package/PHP_Beautifier) - [`php-cs-fixer`](http://cs.sensiolabs.org/) + - [`phpcbf`](https://github.com/squizlabs/PHP_CodeSniffer) - Proto - [`clang-format`](http://clang.llvm.org/docs/ClangFormat.html) - Pug (formally Jade) diff --git a/autoload/neoformat/formatters/php.vim b/autoload/neoformat/formatters/php.vim index 6451cfe8..edf83c46 100644 --- a/autoload/neoformat/formatters/php.vim +++ b/autoload/neoformat/formatters/php.vim @@ -1,5 +1,5 @@ function! neoformat#formatters#php#enabled() abort - return ['phpbeautifier', 'phpcsfixer'] + return ['phpbeautifier', 'phpcsfixer', 'phpcbf'] endfunction function! neoformat#formatters#php#phpbeautifier() abort @@ -15,3 +15,11 @@ function! neoformat#formatters#php#phpcsfixer() abort \ 'replace': 1, \ } endfunction + +function! neoformat#formatters#php#phpcbf() abort + return { + \ 'exe': 'phpcbf', + \ 'stdin': 1, + \ 'valid_exit_codes': [0,1], + \ } +endfunction diff --git a/doc/neoformat.txt b/doc/neoformat.txt index be5c6854..c9158b99 100644 --- a/doc/neoformat.txt +++ b/doc/neoformat.txt @@ -308,6 +308,7 @@ SUPPORTED FILETYPES *neoformat-supported-filetypes* - PHP - [`php_beautifier`](http://pear.php.net/package/PHP_Beautifier) - [`php-cs-fixer`](http://cs.sensiolabs.org/) + - [`phpcbf`](https://github.com/squizlabs/PHP_CodeSniffer) - Proto - [`clang-format`](http://clang.llvm.org/docs/ClangFormat.html) - Pug (formally Jade)