Skip to content

Overriding rulesets

Nate Devereux edited this page Sep 3, 2023 · 4 revisions

We strongly advise against doing this, but there may be situations where you will need to.

This can be done by creating a phpcs.xml in your project directory with the following structure

<?xml version="1.0"?>
<ruleset name="{project-name}-coding-standards">
    <description>Coding standards for {project-name} - using the Silverstripe Bespoke Coding Standard</description>


    <!--
        The aim of the Silverstripe Bespoke Coding standard is to keep consistency between projects.
        If you are adding a custom rule below, please consider raising a PR to add it to the standard at:
        https://github.com/silverstripeltd/bespoke-standards
     -->

    <rule ref="./vendor/silverstripeltd/bespoke-standards/ruleset.xml">
        <!-- Exclude anything you need to at a project level here -->

    </rule>

    <!-- Any further additional project-specific additions can go here if needed -->
    <!-- Do note: rule > properties > property notation does not merge, you have to define the full details -->

</ruleset>

Consider when you're thinking about overriding something, why? Is it a new slevomat sniff that's turned up? Should the Silverstripe Bespoke Coding Standards update and handle this?

Open an issue to discuss or PR to fix it

Clone this wiki locally