<?xml version="1.0"?>
<ruleset name="SimpleSAMLphp ruleset">
    <config name="ignore_warnings_on_exit" value="1"/>

    <description>
        By default it is less stringent about long lines than other coding standards
    </description>

    <file>bin</file>
    <file>config</file>
    <file>metadata</file>
    <file>modules</file>
    <file>public</file>
    <file>src</file>
    <file>tests</file>

    <exclude-pattern>modules/adfs/*</exclude-pattern>
    <exclude-pattern>public/assets/*</exclude-pattern>

    <!-- This is the rule we inherit from. If you want to exclude some specific rules, see the docs on how to do that -->
    <rule ref="PSR12"/>
    <rule ref="vendor/simplesamlphp/simplesamlphp-test-framework/phpcs-simplesamlphp.xml"/>

    <!-- Require the file to start with a declare(strict_types=1); -->
    <rule ref="Generic.PHP.RequireStrictTypes">
      <exclude-pattern>*/attributemap/*</exclude-pattern>
      <exclude-pattern>*/config/*</exclude-pattern>
      <exclude-pattern>*/metadata/*</exclude-pattern>
    </rule>

    <!-- Lines can be a little bit longer before they break the build -->
    <rule ref="Generic.Files.LineLength">
        <properties>
            <property name="lineLimit" value="120"/>
            <property name="absoluteLineLimit" value="130"/>
        </properties>

        <!-- Exclude files with long lines that we cannot immediately fix -->
        <exclude-pattern>tests/src/SimpleSAML/Metadata/MetaDataStorageSourceTest.php</exclude-pattern>
        <exclude-pattern>tests/src/SimpleSAML/Metadata/SAMLParserTest.php</exclude-pattern>
        <exclude-pattern>tests/modules/saml/src/Controller/ServiceProviderTest.php</exclude-pattern>
    </rule>

    <!-- Ignore files with side effects that we cannot fix -->
    <rule ref="PSR1.Files.SideEffects">
        <exclude-pattern>bin/*</exclude-pattern>
        <exclude-pattern>public/_include.php</exclude-pattern>
        <exclude-pattern>src/_autoload_modules.php</exclude-pattern>
        <exclude-pattern>tests/_autoload_modules.php</exclude-pattern>
    </rule>
</ruleset>