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: |
| `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `cs_fixer_path` | :white_check_mark: | :x: | :x: |
| `fixers` | :white_check_mark: | :x: | :x: |
| `level` | :white_check_mark: | :x: | :x: |
| `rules` | :white_check_mark: | :x: | :x: |
| `phpcbf_path` | :white_check_mark: | :x: | :x: |
| `standard` | :white_check_mark: | :white_check_mark: | :x: |
@ -9523,7 +9522,7 @@ Automatically beautify PHP files on save
**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**
@ -9535,11 +9534,11 @@ Path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer)
}
```
##### [Fixers](#fixers)
##### [Rules](#rules)
**Namespace**: `php`
**Key**: `fixers`
**Key**: `rules`
**Type**: `string`
@ -9547,38 +9546,14 @@ Path to the `php-cs-fixer` CLI executable (Supported by PHP-CS-Fixer)
**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**
```json
{
"php": {
"fixers": ""
}
}
```
##### [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": ""
"rules": ""
}
}
```

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')
phpCsFixerOptions = [
"fix"
"--level=#{options.level}" if options.level
"--fixers=#{options.fixers}" if options.fixers
"--config-file=#{configFile}" if configFile
"--rules=#{options.rules}" if options.rules
"--config=#{configFile}" if configFile
"--using-cache=no"
]
runOptions = {
ignoreReturnCode: true

View File

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