I would like to use GrumPHP with my Magento 2, to be able to run simple verifications during my development, how can I do that?

I created this basic tutorial about how to install and use in your Magento 2 project, but to start without a lot of errors I recommend to use this method below.

1 - Run in your Magento 2 root folder via terminal:

composer require symfony/dependency-injection ~3.3.0
composer require symfony/yaml ~3.3.0
composer require --dev phpro/grumphp
composer require --dev jakub-onderka/php-parallel-lint
composer update -vvvv

2 - Create this file in your root folder:

parameters:
  magento_dir: .
  bin_dir: ./vendor/bin
  hide_circumvention_tip: true
  process_timeout: 120
  tasks:
    composer:
      file: ./composer.json
      no_check_all: true
      no_check_lock: true
      no_check_publish: false
      with_dependencies: false
      strict: false
    git_blacklist:
      keywords:
      - "die("
      - "var_dump("
      - "exit;"
      - "console.log("
      - "ObjectManager::getInstance"
      triggered_by: ['php', 'phtml', 'js']
    #phpcs:
    #  standard: "./dev/tests/static/framework/Magento"
    #  tab_width: 4
    #phpmd:
    #  ruleset: [./dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml]
    #phpcsfixer: ~
    #phpcsfixer2: ~
    #phpcpd: ~
    phplint:
      exclude: []
      jobs: ~
      triggered_by: ['php', 'phtml']
    securitychecker: ~
    xmllint: ~

References: Integer-net tutorial

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.