<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Maintenance Switch Plugin Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
    
    <description>WordPress Coding Standards for Maintenance Switch Plugin</description>
    
    <!-- What to scan -->
    <file>.</file>
    
    <!-- How to scan -->
    <arg value="sp"/> <!-- Show sniff and progress -->
    <arg name="basepath" value="./"/> <!-- Strip the file paths down to the relevant bit -->
    <arg name="colors"/>
    <arg name="extensions" value="php"/>
    <arg name="parallel" value="50"/> <!-- Enables parallel processing when available -->
    
    <!-- Rules: Check for cross-version compatibility to PHP 8.1 -->
    <config name="testVersion" value="8.1-"/>
    
    <!-- Rules: WordPress Coding Standards -->
    <!-- https://github.com/WordPress/WordPress-Coding-Standards -->
    <!-- https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
    <rule ref="WordPress-Extra">
        <!-- We don't want to prohibit short array syntax -->
        <exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
        
        <!-- Allow short ternary operator -->
        <exclude name="WordPress.PHP.DisallowShortTernary"/>
        
        <!-- Allow multiple assignments -->
        <exclude name="Squiz.PHP.DisallowMultipleAssignments"/>
        
        <!-- Allow inline comments -->
        <exclude name="Squiz.Commenting.InlineComment"/>
    </rule>

    <!-- Let's also check that everything is properly documented -->
    <rule ref="WordPress-Docs"/>
    
    <!-- Add in some extra rules from other standards -->
    <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
    <rule ref="Generic.Commenting.Todo"/>
    
    <!-- Check for proper text domain usage -->
    <rule ref="WordPress.WP.I18n">
        <properties>
            <property name="text_domain" type="array">
                <element value="maintenance-switch"/>
            </property>
        </properties>
    </rule>
    
    <!-- Allow for theme specific exceptions to file name rules based on the theme hierarchy -->
    <rule ref="WordPress.Files.FileName">
        <properties>
            <property name="strict_class_file_names" value="false"/>
        </properties>
    </rule>

    <!-- Minimum supported WordPress version -->
    <config name="minimum_supported_wp_version" value="5.0"/>

    <!-- Exclude patterns -->
    <exclude-pattern>/vendor/*</exclude-pattern>
    <exclude-pattern>/node_modules/*</exclude-pattern>
    <exclude-pattern>*.min.js</exclude-pattern>
    <exclude-pattern>*.min.css</exclude-pattern>
    <exclude-pattern>/assets/js/lib/*</exclude-pattern>
    
    <!-- Exclude specific files -->
    <exclude-pattern>gulpfile.js</exclude-pattern>
    <exclude-pattern>webpack.config.js</exclude-pattern>
    
</ruleset>