<?xml version="1.0"?>
<ruleset name="studiometa-wp-toolkit">
  <!-- Define file and folders to lint -->
  <file>./src/</file>
  <file>./tests/</file>

  <!-- Don't check composer dependencies -->
  <exclude-pattern>/vendor/</exclude-pattern>

  <!--
    Ending tags '?>' can be really painful to debug.
    Just disallow them in the end of the file
  -->
  <rule ref="PSR2.Files.ClosingTag.NotAllowed"/>

  <!-- <?php tags and constants (true,false,null) need to be lowercase  -->
  <rule ref="Generic.PHP.LowerCaseKeyword"/>
  <rule ref="Generic.PHP.LowerCaseConstant"/>

  <rule ref="WordPress">
    <!-- There are numerous cases where we want to override WP globals -->
    <exclude name="WordPress.WP.GlobalVariablesOverride" />
    <!-- WordPress filenames are not compatible with autoload -->
    <exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"></exclude>
    <exclude name="WordPress.Files.FileName.InvalidClassFileName"></exclude>
  </rule>

  <rule ref="Squiz.Commenting.FileComment.Missing">
    <exclude-pattern>*/tests/*</exclude-pattern>
  </rule>

  <rule ref="Squiz.Commenting.FunctionComment.Missing">
    <exclude-pattern>*/tests/*</exclude-pattern>
  </rule>

  <rule ref="Generic.Files.OneObjectStructurePerFile.MultipleFound">
    <exclude-pattern>*/tests/*</exclude-pattern>
  </rule>
</ruleset>
