juliangut / grunt-php-cs-fixer

Grunt plugin for PHP Coding Standards Fixer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grunt-php-cs-fixer

Grunt plugin for running PHP Coding Standards Fixer.

Installation

  1. Install grunt-php-cs-fixer
npm install grunt-php-cs-fixer --save-dev
  1. Install PHP Coding Standards Fixer

  2. Include the task in your Gruntfile with a line like this

grunt.loadNpmTasks('grunt-php-cs-fixer');

Usage Example

To be included in your Grunt initConfig.

phpcsfixer: {
	app: {
		dir: 'app' // or ['src/models', 'src/lib']
	},
	options: {
		bin: 'vendor/bin/php-cs-fixer',
		ignoreExitCode: true,
		level: 'all',
		quiet: true
	}
}

This task is a multi task so any targets, files and options should be specified accordingly.

Target Properties

dir

Type: String || Array

The file(s) or directory(s) to fix.

###Options

bin

Type: String Default: 'php-cs-fixer'

The path to php-cs-fixer.
(For composer, use vendor/bin/php-cs-fixer).

ignoreExitCode

Type: Boolean Default: false

Don't fail even if we get a non-zero return.

verbose

Type: Boolean Default: false

Output full info including warnings and a list of changes.

diff

Type: Boolean Default: false

Show a diff for the proposed changes.

dryRun

Type: Boolean Default: false

Don't effect the proposed changes (useful when combined with --verbose and --diff).

level

Type: String Default: all

Chooses preset list of fixers, options are psr0, psr1, psr2, all.

fixers

Type: String|Array Default: null

framework

Type: String Default: default

Chooses option customizes the files to analyse, based on some well-known frameworks directory structures, options are magento, sf20, sf21.

Comma-separated string, or array of fixers to use.
@see https://github.com/fabpot/PHP-CS-Fixer.

About

Grunt plugin for PHP Coding Standards Fixer

License:MIT License


Languages

Language:JavaScript 81.7%Language:PHP 18.3%