Merge pull request #1511 from onigra/correspondence-to-php-cs-fixer-v2

Correspondence to PHP-CS-Fixer v2
This commit is contained in:
Glavin Wiechert 2017-04-15 03:25:34 -03:00 committed by GitHub
commit 3ea44935e5
3 changed files with 13 additions and 42 deletions

View File

@ -9447,8 +9447,7 @@ Specify a configuration file which will override the default name of .perltidyrc
| `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `cs_fixer_path` | :white_check_mark: | :x: | :x: | | `cs_fixer_path` | :white_check_mark: | :x: | :x: |
| `fixers` | :white_check_mark: | :x: | :x: | | `rules` | :white_check_mark: | :x: | :x: |
| `level` | :white_check_mark: | :x: | :x: |
| `phpcbf_path` | :white_check_mark: | :x: | :x: | | `phpcbf_path` | :white_check_mark: | :x: | :x: |
| `standard` | :white_check_mark: | :white_check_mark: | :x: | | `standard` | :white_check_mark: | :white_check_mark: | :x: |
@ -9523,7 +9522,7 @@ Automatically beautify PHP files on save
**Description**: **Description**:
Path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer) Absolute path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer)
**Example `.jsbeautifyrc` Configuration** **Example `.jsbeautifyrc` Configuration**
@ -9535,50 +9534,26 @@ Path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer)
} }
``` ```
##### [Fixers](#fixers) ##### [Rules](#rules)
**Namespace**: `php` **Namespace**: `php`
**Key**: `fixers` **Key**: `rules`
**Type**: `string` **Type**: `string`
**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) **Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer)
**Description**: **Description**:
Add fixer(s). i.e. linefeed,-short_tag,indentation (Supported by PHP-CS-Fixer) Add rule(s). i.e. line_ending,-full_opening_tag,@PSR2 (Supported by PHP-CS-Fixer)
**Example `.jsbeautifyrc` Configuration** **Example `.jsbeautifyrc` Configuration**
```json ```json
{ {
"php": { "php": {
"fixers": "" "rules": ""
}
}
```
##### [Level](#level)
**Namespace**: `php`
**Key**: `level`
**Type**: `string`
**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer)
**Description**:
By default, all PSR-2 fixers and some additional ones are run. (Supported by PHP-CS-Fixer)
**Example `.jsbeautifyrc` Configuration**
```json
{
"php": {
"level": ""
} }
} }
``` ```

View File

@ -21,9 +21,9 @@ module.exports = class PHPCSFixer extends Beautifier
configFile = if context? and context.filePath? then @findFile(path.dirname(context.filePath), '.php_cs') configFile = if context? and context.filePath? then @findFile(path.dirname(context.filePath), '.php_cs')
phpCsFixerOptions = [ phpCsFixerOptions = [
"fix" "fix"
"--level=#{options.level}" if options.level "--rules=#{options.rules}" if options.rules
"--fixers=#{options.fixers}" if options.fixers "--config=#{configFile}" if configFile
"--config-file=#{configFile}" if configFile "--using-cache=no"
] ]
runOptions = { runOptions = {
ignoreReturnCode: true ignoreReturnCode: true

View File

@ -26,15 +26,11 @@ module.exports = {
title: "PHP-CS-Fixer Path" title: "PHP-CS-Fixer Path"
type: 'string' type: 'string'
default: "" default: ""
description: "Path to the `php-cs-fixer` CLI executable" description: "Absolute path to the `php-cs-fixer` CLI executable"
fixers: rules:
type: 'string' type: 'string'
default: "" default: ""
description: "Add fixer(s). i.e. linefeed,-short_tag,indentation" description: "Add rule(s). i.e. line_ending,-full_opening_tag,@PSR2"
level:
type: 'string'
default: ""
description: "By default, all PSR-2 fixers and some additional ones are run."
phpcbf_path: phpcbf_path:
title: "PHPCBF Path" title: "PHPCBF Path"
type: 'string' type: 'string'