Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ 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 not only detects them, but also fixes them for you.

PHP CS Fixer has built-in rule sets, whether you want to follow PHP coding standards as defined by `PHP-FIG's PER Coding Style <https://www.php-fig.org/per/coding-style/>`__,
a wide community like the `Symfony <https://symfony.com/doc/current/contributing/code/standards.html>`__,
or `our opinionated one <./doc/ruleSets/PhpCsFixer.rst>`__.
PHP CS Fixer has built-in rule sets, whether you want to follow PHP coding standards as defined by `PHP-FIG's PER Coding Style <https://www.php-fig.org/per/coding-style/>`__ - `@PER-CS <./doc/ruleSets/PER-CS.rst>`__,
a wide community like the `Symfony <https://symfony.com/doc/current/contributing/code/standards.html>`__ - `@Symfony <./doc/ruleSets/Symfony.rst>`__,
or our opinionated one - `@PhpCsFixer <./doc/ruleSets/PhpCsFixer.rst>`__.
You can also define your (team's) style through the `configuration file <./doc/config.rst>`__.

PHP CS Fixer can not only unify the style of your code, but also help to modernize your codebase towards
newer PHP (e.g. `@autoPHPMigration <./doc/ruleSets/AutoPHPMigration.rst>`__) and newer PHPUnit (e.g. `@autoPHPUnitMigration:risky <./doc/ruleSets/AutoPHPUnitMigrationRisky.rst>`__).
PHP CS Fixer can not only unify the style of your code, but also help to modernise your codebase towards
newer PHP (e.g. `@autoPHPMigration <./doc/ruleSets/AutoPHPMigration.rst>`__ and `@autoPHPMigration:risky <./doc/ruleSets/AutoPHPMigrationRisky.rst>`__) and newer PHPUnit (e.g. `@autoPHPUnitMigration:risky <./doc/ruleSets/AutoPHPUnitMigrationRisky.rst>`__).

Supported PHP Versions
----------------------
Expand Down Expand Up @@ -41,17 +41,24 @@ For more details and other installation methods (also with Docker or behind CI),
Usage
~~~~~

Assuming you installed PHP CS Fixer as instructed above, you can run
the following command to fix the files PHP files in the ``src`` directory:
Assuming you installed PHP CS Fixer as instructed above, you can
initialise base config for your project by using following command:

.. code:: sh

$ ./vendor/bin/php-cs-fixer fix src
$ ./vendor/bin/php-cs-fixer init

To automatically fix your project, or only check against the need of changes, run:

.. code:: sh

$ ./vendor/bin/php-cs-fixer fix
$ ./vendor/bin/php-cs-fixer check

See `usage <./doc/usage.rst>`__, list of `built-in rules <./doc/rules/index.rst>`__, list of `rule sets <./doc/ruleSets/index.rst>`__ and `configuration file <./doc/config.rst>`__ documentation for more
details.

If you need to apply code styles that are not supported by the tool, you can `create custom rules <./doc/custom_rules.rst>`__.
If you need to apply code styles that are not built-in into the tool, you can `create custom rules <./doc/custom_rules.rst>`__.

Editor Integration
------------------
Expand Down