<ruleset>
  <arg name="extensions" value="php,inc,module,install,theme,profile,engine,yml"/>
  <file>.</file>
  <exclude-pattern>*/vendor/*</exclude-pattern>
  <exclude-pattern>*/node_modules/*</exclude-pattern>
  <exclude-pattern>*/.gitlab-ci-local/*</exclude-pattern>

  <!-- Default rules. -->
  <rule ref="Drupal"/>
  <rule ref="DrupalPractice"/>

  <!-- Require a strict types declaration in every PHP file. -->
  <!-- Enabled under the initiative https://www.drupal.org/project/drupal/issues/3250827 -->
  <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing">
    <severity>10</severity>
  </rule>

  <!-- Require nullable types to be declared as such. -->
  <rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>

  <!-- Forbid annotations that are not part of the Drupal coding standard but are often added by IDEs. -->
  <rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
    <properties>
      <property name="forbiddenAnnotations" type="array">
        <element value="@author"/>
        <element value="@created"/>
        <element value="@copyright"/>
        <element value="@license"/>
        <element value="@package"/>
        <element value="@version"/>
      </property>
    </properties>
  </rule>

  <!-- Forbid auto-generated documentation by IDEs that does not comply with Drupal documentation standards. -->
  <rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments">
    <properties>
      <property name="forbiddenCommentPatterns" type="array">
        <element value="/@inheritDoc/"/>
        <element value="/^Class [a-zA-z]*\.$/"/>
        <element value="/^Interface [a-zA-z]*\.$/"/>
        <element value="/^[a-zA-z]* constructor\.$/"/>
      </property>
    </properties>
  </rule>

  <!-- Enforce correct formatting of return type hints. -->
  <rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>

  <!-- Enforce the use of single quotes for strings. -->
  <rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired"/>

  <!-- Enforce strict comparisons. -->
  <rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
</ruleset>
