Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: config file - provide better link to Finder docs #6992

Merged
merged 9 commits into from
Oct 29, 2023
8 changes: 4 additions & 4 deletions doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ The example below will add two rules to the default list of PSR12 set rules:
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('somedir')
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
->in(__DIR__)
->exclude(['dir_a', 'dir_b'])
->notPath(['foo.php', 'dir_c/bar.php'])
keradus marked this conversation as resolved.
Show resolved Hide resolved
;

$config = new PhpCsFixer\Config();
Expand All @@ -33,10 +33,10 @@ The example below will add two rules to the default list of PSR12 set rules:
->setFinder($finder)
;

**NOTE**: ``exclude`` will work only for directories, so if you need to exclude file, try ``notPath``.
**NOTE**: ``exclude`` will work only for directories, so if you need to exclude file, use ``notPath``.
keradus marked this conversation as resolved.
Show resolved Hide resolved
Both ``exclude`` and ``notPath`` methods accept only relative paths to the ones defined with the ``in`` method.
keradus marked this conversation as resolved.
Show resolved Hide resolved

See `Symfony\\Finder <https://symfony.com/doc/current/components/finder.html>`_
See `Symfony\\Finder <https://symfony.com/doc/current/components/finder.html#location>`_
online documentation for other `Finder` methods.

You may also use an exclude list for the rules instead of the above shown include approach.
Expand Down