<?xml version="1.0"?>
<ruleset name="Krokedil Coding Standards">
    <description>WooCommerce dev PHP_CodeSniffer ruleset.</description>

    <!-- Exclude vendor and node_modules from all rules -->
    <exclude-pattern>*/node_modules/*</exclude-pattern>
    <exclude-pattern>*/vendor/*</exclude-pattern>
    <exclude-pattern>*/dependencies/*</exclude-pattern>

    <!-- Exclude the tests folder -->
    <exclude-pattern>tests/*</exclude-pattern>

    <config name="minimum_supported_wp_version" value="6.2" />
    <config name="testVersion" value="7.3-" />

    <!-- Use Wordpress Coding standards -->
    <rule ref="WordPress" />

    <!-- Enforce the correct text-domain -->
    <rule ref="WordPress.WP.I18n">
        <properties>
            <property name="text_domain" type="array">
                <element value="qliro-for-woocommerce" />
                <element value="woocommerce" />
            </property>
        </properties>
    </rule>

    <!--  Remove WordPress.Files.FileName.InvalidClassFileName checks to allow for PSR-4 naming convention -->
    <rule ref="WordPress.Files.FileName.InvalidClassFileName">
        <exclude-pattern>src/</exclude-pattern>
    </rule>

    <!-- Remove WordPress.Files.FileName.NotHyphenatedLowercase checks to allow for PSR-4 naming convention -->
    <rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
        <exclude-pattern>src/</exclude-pattern>
    </rule>

    <!-- Remove need for package tag in file block comments -->
    <rule ref="Squiz.Commenting.FileComment.MissingPackageTag">
        <exclude-pattern>src/</exclude-pattern>
    </rule>

    <!-- Remove need for file comment -->
    <rule ref="Squiz.Commenting.FileComment.Missing">
        <exclude-pattern>src/</exclude-pattern>
    </rule>

    <!-- Allow the usage of shorthand arrays -->
    <rule ref="Generic.Arrays.DisallowShortArraySyntax">
        <exclude-pattern>src/</exclude-pattern>
    </rule>

    <!-- Add custom capabilities that are added by WooCommerce. -->
    <rule ref="WordPress.WP.Capabilities">
    <properties>
        <property name="custom_capabilities" type="array">
            <element value="edit_shop_orders" />
            <element value="manage_woocommerce" />
        </property>
    </properties>
    </rule>
</ruleset>
