3

The .php_cs file can be found on the root of the Magento installation. I'd like to know how can I use it as well.

6

The PHP Coding Standards Fixer tool fixes most issues in your code when you want to follow the PHP coding standards as defined in the PSR-1 and PSR-2 documents and many more.

If you are already using a linter to identify coding standards problems in your code, you know that fixing them by hand is tedious, especially on large projects. This tool does not only detect them, but also fixes them for you.

You can see how to use using this command below on the root of your installation:

php -f vendor/bin/static-review.php

You will see this screen:

Static Review

You can setup in your project using this command below, then when you use a command git it'll be executed.

php -f vendor/bin/static-review.php hook:install dev/tools/Magento/Tools/StaticReview/pre-commit .git/hooks/pre-commit

Sample

Git hook static check

References:

https://www.sitepoint.com/writing-php-git-hooks-with-static-review/

https://mage2.pro/t/topic/506

https://github.com/FriendsOfPHP/PHP-CS-Fixer

  • 1
    that is seems nice answer:) – Amit Bera May 16 '17 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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