2016-08-23 64 views
1

我使用GrumPhp嗅我的承諾,我symfony項目:https://github.com/phpro/grumphp運行PHP CS定影液

這裏是我的配置:

parameters: 
    git_dir: . 
    bin_dir: vendor/bin 
    tasks: 
     phpcsfixer: 
      config_file: ~ 
      config: sf23 
      fixers: [psr2, symfony, indentation] 
      level: psr2 
      verbose: true 

我的問題是:

有一種方式Grumphp當我提交時自動運行php-cs-fixer

+2

如果運行./vendor/bin/grumphp運行,您的輸出是什麼? – Kanti

回答

1

是的! https://github.com/phpro/grumphp/blob/master/doc/tasks.md

由於您的文章有點老,這裏是新的更新文檔,但您仍然可以使用第一版! https://github.com/phpro/grumphp/blob/master/doc/tasks/php_cs_fixer2.md

你可以嘗試這種配置,但它phpcsfixer版本2 !:

# grumphp.yml 
parameters: 
    bin_dir: "./vendor/bin" 
    git_dir: "." 
    hooks_dir: ~ 
    hooks_preset: local 
    stop_on_failure: false 
    ignore_unstaged_changes: false 
    process_async_limit: 10 
    process_async_wait: 1000 
    process_timeout: 60 
    ascii: 
     failed: grumphp-grumpy.txt 
     succeeded: grumphp-happy.txt 
    tasks: 
     phpcsfixer2: 
     allow_risky: false 
     cache_file: ~ 
     config: ~ 
     rules: ['@Symfony'] 
     using_cache: true 
     path_mode: ~ 
     verbose: true 

你的配置看起來不錯,有什麼輸出? 您是否安裝了cs修補程序並將grumPHP配置配置爲CS修復程序的路徑? https://github.com/FriendsOfPHP/PHP-CS-Fixer#usage