From 2bc18dd601db59f0a473b215909180c9da9945c2 Mon Sep 17 00:00:00 2001 From: Ra100 Date: Wed, 13 Jan 2016 17:05:57 +0100 Subject: [PATCH] PHPCBF support --- docs/options.md | 125 +++++++++++++++++++++++++++++++++- src/beautifiers/phpcbf.coffee | 2 + src/languages/php.coffee | 2 +- 3 files changed, 127 insertions(+), 2 deletions(-) diff --git a/docs/options.md b/docs/options.md index c57fabe..5f25324 100644 --- a/docs/options.md +++ b/docs/options.md @@ -1691,6 +1691,54 @@ By default, all PSR-2 fixers and some additional ones are run. (Supported by PHP } ``` +#### [PHP - PHPCBF Path](#php---phpcbf-path) + +**Namespace**: `php` + +**Key**: `phpcbf_path` + +**Type**: `string` + +**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) + +**Description**: + +Path to the `phpcbf` CLI executable (Supported by PHP-CS-Fixer) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "php": { + "phpcbf_path": "" + } +} +``` + +#### [PHP - PHPCBF Standard](#php---phpcbf-standard) + +**Namespace**: `php` + +**Key**: `standard` + +**Type**: `string` + +**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) [`PHPCBF`](#phpcbf) + +**Description**: + +Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules (Supported by PHP-CS-Fixer, PHPCBF) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "php": { + "standard": "" + } +} +``` + #### [Python - Max line length](#python---max-line-length) **Namespace**: `python` @@ -3568,7 +3616,7 @@ Disable PHP Beautification **Type**: `string` -**Enum**: `PHP-CS-Fixer` +**Enum**: `PHP-CS-Fixer` `PHPCBF` **Description**: @@ -6500,6 +6548,81 @@ By default, all PSR-2 fixers and some additional ones are run. (Supported by PHP } ``` +#### [PHP - PHPCBF Path](#php---phpcbf-path) + +**Namespace**: `php` + +**Key**: `phpcbf_path` + +**Type**: `string` + +**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) + +**Description**: + +Path to the `phpcbf` CLI executable (Supported by PHP-CS-Fixer) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "php": { + "phpcbf_path": "" + } +} +``` + +#### [PHP - PHPCBF Standard](#php---phpcbf-standard) + +**Namespace**: `php` + +**Key**: `standard` + +**Type**: `string` + +**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) [`PHPCBF`](#phpcbf) + +**Description**: + +Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules (Supported by PHP-CS-Fixer, PHPCBF) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "php": { + "standard": "" + } +} +``` + + +### PHPCBF + +#### [PHP - PHPCBF Standard](#php---phpcbf-standard) + +**Namespace**: `php` + +**Key**: `standard` + +**Type**: `string` + +**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) [`PHPCBF`](#phpcbf) + +**Description**: + +Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules (Supported by PHP-CS-Fixer, PHPCBF) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "php": { + "standard": "" + } +} +``` + ### autopep8 diff --git a/src/beautifiers/phpcbf.coffee b/src/beautifiers/phpcbf.coffee index d18c95f..1f88c27 100644 --- a/src/beautifiers/phpcbf.coffee +++ b/src/beautifiers/phpcbf.coffee @@ -39,6 +39,7 @@ module.exports = class PHPCBF extends Beautifier # Found phpcbf path @run("php", [ phpcbfPath + "--no-patch" "--standard=#{options.standard}" if options.standard tempFile = @tempFile("temp", text) ], { @@ -64,6 +65,7 @@ module.exports = class PHPCBF extends Beautifier ) else @run("phpcbf", [ + "--no-patch" "--standard=#{options.standard}" if options.standard tempFile = @tempFile("temp", text) ], { diff --git a/src/languages/php.coffee b/src/languages/php.coffee index 1542611..c50aa8a 100644 --- a/src/languages/php.coffee +++ b/src/languages/php.coffee @@ -42,6 +42,6 @@ module.exports = { title: "PHPCBF Standard" type: 'string' default: "", - description: "Standard name PEAR, PSR-1, PSR-2, Symphony... or path to CS rules" + description: "Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS rules" }