Baseline Gruntfile para desenvolvimento de PHP

Estas são minhas dependências padrão e gruntfile para desenvolvimento de PHP.

gruntfile.js

grunt.initConfig({
pkg
: grunt.file.readJSON('package.json'),
phpcs
: {
application
: {
dir
: ['src']
},
options
: {
bin
: 'vendor/bin/phpcs',
standard
: 'PSR2'
}
},
phpcpd
: {
application
: {
dir
: 'src'
},
options
: {
bin
: 'vendor/bin/phpcpd',
quiet
: true
}
},
phpmd
: {
application
: {
dir
: 'src'
},
options
: {
bin
: 'vendor/bin/phpmd',
reportFormat
: 'text'
}
},
phpunit
: {
tests
: {
dir
: 'tests'
},
options
: {
bin
: 'vendor/bin/phpunit',
colors
: true
}
},
watch
: {
src
: {
files
: [ 'src/**/*.php' ],
tasks
: [ 'clear', 'tests', 'quality' ],
options
: {
atBegin
: true,
}
},
tests
: {
files
: [ 'tests/**/*.php' ],
tasks
: [ 'clear', 'tests' ]
}
}
});

grunt
.loadNpmTasks('grunt-clear');
grunt
.loadNpmTasks('grunt-contrib-watch');
grunt
.loadNpmTasks('grunt-notify');
grunt
.loadNpmTasks('grunt-phpcs');
grunt
.loadNpmTasks('grunt-phpcpd');
grunt
.loadNpmTasks('grunt-phpmd');
grunt
.loadNpmTasks('grunt-phpunit');

grunt
.registerTask('tests', [
'phpunit'
]);

grunt
.registerTask('quality', [
'phpcs',
'phpcpd',
'phpmd'
]);

grunt
.registerTask('default', [
'clear',
'tests',
'quality'
]);

package.json

"devDependencies": {
"grunt": "~0.4.4",
"grunt-clear": "~0.2.1",
"grunt-contrib-watch": "~0.6.0",
"grunt-notify": "~0.2.20",
"grunt-phpcs": "~0.2.2",
"grunt-phpcpd": "~0.1.3",
"grunt-phpmd": "~0.1.0",
"grunt-phpunit": "~0.3.3"
}

composer.json

Importante: Remova os espaços após o @ (é um problema de remarcação)

"require-dev": {
"phpmd/phpmd": "2.0.*@ dev",
"phpunit/phpunit": "4.1.*@ dev",
"sebastian/phpcpd": "2.0.*@ dev",
"squizlabs/php_codesniffer": "2.0.*@ dev"
}