You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -61,7 +61,7 @@ <h2>No config<a class="headerlink" href="#no-config" title="Permalink to this he
61
61
</div>
62
62
<p>While it is possible to provide command line options to configure rules,
63
63
it’s recommended to save the project configuration in a <codeclass="docutils literal notranslate"><spanclass="pre">.php-cs-fixer.dist.php</span></code> file in the root directory of your project.
64
-
The file must return an instance of <aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.2/src/ConfigInterface.php">PhpCsFixer\ConfigInterface</a>,
64
+
The file must return an instance of <aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.3/src/ConfigInterface.php">PhpCsFixer\ConfigInterface</a>,
65
65
which lets you configure the rules, finder (the files and directories that
66
66
need to be analysed), select output format and even configure path to <codeclass="docutils literal notranslate"><spanclass="pre">PHP</span></code>.</p>
67
67
<p>You may also create <codeclass="docutils literal notranslate"><spanclass="pre">.php-cs-fixer.php</span></code> file, which is
@@ -66,8 +66,8 @@ <h2>Background<a class="headerlink" href="#background" title="Permalink to this
66
66
discouraged - it is meant only to give more people more chance to
67
67
contribute, and to detect bugs (<aclass="reference external" href="https://en.wikipedia.org/wiki/Linus%27s_Law">Linus’s Law</a>).</p>
68
68
<p>If possible, try to get acquainted with the public interface for the
69
-
<aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.2/src/Tokenizer/Tokens.php">PhpCsFixer\Tokenizer\Tokens</a> and
<aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.3/src/Tokenizer/Tokens.php">PhpCsFixer\Tokenizer\Tokens</a> and
<h2>Assumptions<aclass="headerlink" href="#assumptions" title="Permalink to this heading">¶</a></h2>
@@ -81,8 +81,8 @@ <h2>Assumptions<a class="headerlink" href="#assumptions" title="Permalink to thi
81
81
</ul>
82
82
<p>In case you want to create a custom fixer for your own use, you can
83
83
follow this guide as well, but you will need to apply some changes on the go,
84
-
for example use <aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.2/src/Fixer/FixerInterface.php">PhpCsFixer\Fixer\FixerInterface</a>
85
-
instead of <aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.2/src/AbstractFixer.php">PhpCsFixer\AbstractFixer</a> (which is internal
84
+
for example use <aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.3/src/Fixer/FixerInterface.php">PhpCsFixer\Fixer\FixerInterface</a>
85
+
instead of <aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.3/src/AbstractFixer.php">PhpCsFixer\AbstractFixer</a> (which is internal
<p>Note how the class and file name match. Also keep in mind that all
140
-
fixers must implement <aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.2/src/Fixer/FixerInterface.php">PhpCsFixer\Fixer\FixerInterface</a>. In this case, the fixer is
141
-
inheriting from <aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.2/src/AbstractFixer.php">PhpCsFixer\AbstractFixer</a>, which fulfills the interface with some
140
+
fixers must implement <aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.3/src/Fixer/FixerInterface.php">PhpCsFixer\Fixer\FixerInterface</a>. In this case, the fixer is
141
+
inheriting from <aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.3/src/AbstractFixer.php">PhpCsFixer\AbstractFixer</a>, which fulfills the interface with some
142
142
default behaviour.</p>
143
143
<p>Now let us create the test file at
144
144
<codeclass="docutils literal notranslate"><spanclass="pre">tests/Fixer/Comment/RemoveCommentsFixerTest.php</span></code>. Put this content inside:</p>
<p>If you need to enforce some specific code style rules, you can implement your
56
56
own fixers. There is a <aclass="reference internal" href="cookbook_fixers.html"><spanclass="doc">cookbook</span></a> with basic instructions on how to build a new fixer.</p>
57
57
<p>For each rule you want to add, create a class that implements
<p>There are several interfaces that your fixers can also implement if needed:</p>
80
80
<ulclass="simple">
81
-
<li><p><aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.2/src/Fixer/WhitespacesAwareFixerInterface.php">PhpCsFixer\Fixer\WhitespacesAwareFixerInterface</a>: for fixers that need to know the configured indentation and line endings;</p></li>
82
-
<li><p><aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.2/src/Fixer/ConfigurableFixerInterface.php">PhpCsFixer\Fixer\ConfigurableFixerInterface</a>: to create a configurable fixer;</p></li>
83
-
<li><p><aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.2/src/Fixer/DeprecatedFixerInterface.php">PhpCsFixer\Fixer\DeprecatedFixerInterface</a>: to deprecate a fixer.</p></li>
81
+
<li><p><aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.3/src/Fixer/WhitespacesAwareFixerInterface.php">PhpCsFixer\Fixer\WhitespacesAwareFixerInterface</a>: for fixers that need to know the configured indentation and line endings;</p></li>
82
+
<li><p><aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.3/src/Fixer/ConfigurableFixerInterface.php">PhpCsFixer\Fixer\ConfigurableFixerInterface</a>: to create a configurable fixer;</p></li>
83
+
<li><p><aclass="reference external" href="https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.91.3/src/Fixer/DeprecatedFixerInterface.php">PhpCsFixer\Fixer\DeprecatedFixerInterface</a>: to deprecate a fixer.</p></li>
0 commit comments