<?xml version="1.0"?>
<ruleset name="Inpsyde Coding Standard">

    <description>PHP 7+ coding standards for Inpsyde WordPress projects.</description>

    <autoload>./PhpcsHelpers.php</autoload>
    <autoload>./PHPCSAliases.php</autoload>

    <!--
    PHP 7.0 and higher.
    -->
    <config name="testVersion" value="7.0-"/>

    <!--
	Arguments: colors, show progress and show sniff name.
	-->
    <arg name="colors"/>
    <arg value="sp"/>

    <!--
    PSR 2 Code style.
    See http://www.php-fig.org/psr/psr-2/
    -->
    <rule ref="PSR2">
        <exclude name="Generic.Files.LineLength.TooLong"/>
    </rule>

    <!--
    Neutron standard are quality tools for PHP7 development from Automattic.
    See https://github.com/Automattic/phpcs-neutron-standard
    -->
    <rule ref="NeutronStandard.Arrays.DisallowLongformArray">
        <type>warning</type>
    </rule>
    <rule ref="NeutronStandard.AssignAlign.DisallowAssignAlign">
        <type>warning</type>
    </rule>
    <rule ref="NeutronStandard.Extract.DisallowExtract">
        <type>warning</type>
    </rule>
    <rule ref="NeutronStandard.Functions.DisallowCallUserFunc">
        <type>warning</type>
    </rule>
    <rule ref="NeutronStandard.Globals.DisallowGlobalFunctions">
        <type>warning</type>
    </rule>
    <rule ref="NeutronStandard.MagicMethods.DisallowMagicSerialize">
        <type>warning</type>
    </rule>
    <rule ref="NeutronStandard.StrictTypes.RequireStrictTypes">
        <type>warning</type>
    </rule>
    <rule ref="NeutronStandard.Whitespace.DisallowMultipleNewlines">
        <type>warning</type>
    </rule>
    <rule ref="NeutronStandard.Whitespace.RequireNewlineBetweenFunctions">
        <type>warning</type>
    </rule>

    <!--
    Some WordPress specific rules.
    See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
    -->
    <rule ref="WordPress.VIP.SessionVariableUsage"/>
    <rule ref="WordPress.VIP.SessionFunctionsUsage"/>
    <rule ref="WordPress.VIP.SuperGlobalInputUsage"/>
    <rule ref="WordPress.VIP.ValidatedSanitizedInput"/>
    <rule ref="WordPress.XSS.EscapeOutput"/>
    <rule ref="WordPress.CSRF.NonceVerification"/>
    <rule ref="WordPress.WP.AlternativeFunctions.curl"/>
    <rule ref="WordPress.WP.DiscouragedConstants"/>
    <rule ref="WordPress.WP.I18n"/>
    <rule ref="WordPress.Arrays.CommaAfterArrayItem"/>
    <rule ref="WordPress.PHP.StrictComparisons"/>
    <rule ref="WordPress.PHP.StrictInArray"/>
    <rule ref="WordPress.PHP.POSIXFunctions"/>
    <rule ref="WordPress.PHP.RestrictedPHPFunctions"/>
    <rule ref="WordPress.PHP.DiscouragedPHPFunctions">
        <properties>
            <property name="exclude" value="serialize"/>
            <property name="exclude" value="urlencode"/>
            <property name="exclude" value="obfuscation"/>
        </properties>
    </rule>
    <rule ref="WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration">
        <type>error</type>
    </rule>
    <rule ref="WordPress.PHP.DevelopmentFunctions"/>
    <rule ref="WordPress.PHP.DevelopmentFunctions.error_log">
        <type>error</type>
    </rule>
    <rule ref="WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure">
        <type>error</type>
    </rule>

    <!--
    Generic
    -->
    <rule ref="Generic.Metrics.CyclomaticComplexity">
        <properties>
            <property name="absoluteComplexity" value="50"/>
        </properties>
    </rule>
    <rule ref="Generic.Metrics.NestingLevel">
        <properties>
            <property name="nestingLevel" value="2"/>
            <property name="absoluteNestingLevel" value="4"/>
        </properties>
    </rule>
    <rule ref="Generic.NamingConventions.ConstructorName"/>
    <rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
    <rule ref="Generic.PHP.LowerCaseConstant"/>
    <rule ref="Squiz.Classes.LowercaseClassKeywords"/>
    <rule ref="Squiz.PHP.CommentedOutCode">
        <properties>
            <property name="maxPercentage" value="45"/>
        </properties>
    </rule>
    <rule ref="Squiz.PHP.Eval"/>
    <rule ref="Squiz.PHP.InnerFunctions"/>
    <rule ref="Squiz.PHP.LowercasePHPFunctions"/>
    <rule ref="Squiz.PHP.NonExecutableCode"/>
    <rule ref="Squiz.Scope.MemberVarScope"/>
    <rule ref="Squiz.Scope.StaticThisUsage"/>

</ruleset>
