<?xml version="1.0"?>
<ruleset name="wp-studiometa">
  <arg name="extensions" value="php"/>
  <arg name="colors" />
  <arg name="cache" />
  <arg value="sp" />

  <!-- Define file and folders to lint -->
  <file>./web/wp-content/themes/studiometa/</file>
  <file>./web/wp-content/mu-plugins/studiometa-plugin-disabler/</file>
  <!-- <file>./web/wp-content/plugins/studiometa-.../</file> -->
  <!-- <file>./web/wp-content/mu-plugins/studiometa-.../</file> -->

  <!-- Skip seed data -->
  <exclude-pattern>/data/</exclude-pattern>

  <!-- Skip LocalValetDriver -->
  <exclude-pattern>LocalValetDriver.php</exclude-pattern>

  <!-- 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" />
  </rule>

  <!-- Disable class-classname.php file naming for app folder -->
  <rule ref="WordPress.Files.FileName.InvalidClassFileName">
    <exclude-pattern>/app/</exclude-pattern>
    <exclude-pattern>/studiometa-plugin-disabler/studiometa-plugin-disabler.php</exclude-pattern>
  </rule>

  <!-- Allow UpperCaseClasses file names in app folder -->
  <rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
    <exclude-pattern>/app/</exclude-pattern>
  </rule>

  <!-- Run against the PHPCompatibilityWP ruleset -->
  <rule ref="PHPCompatibilityWP" />

  <!-- Check for cross-version support for PHP 7.3 and higher -->
  <config name="testVersion" value="7.3-"/>

  <!-- Allow usage of `{@inheritdoc}` in doc blocks -->
  <rule ref="Squiz.Commenting.FunctionComment">
    <properties>
      <property name="skipIfInheritdoc" value="true" />
    </properties>
  </rule>
</ruleset>
