<?xml version="1.0"?>
<ruleset name="STEMMechanics Standards">
  <description>STEMMechanics Coding Standards</description>

  <file>app</file>
  <file>config</file>
  <file>resources</file>
  <file>routes</file>
  <file>tests</file>

  <exclude-pattern>*/database/*</exclude-pattern>
  <exclude-pattern>*/cache/*</exclude-pattern>
  <exclude-pattern>*/lang/*</exclude-pattern>
  <exclude-pattern>*/*.js</exclude-pattern>
  <exclude-pattern>*/*.css</exclude-pattern>
  <exclude-pattern>*/*.xml</exclude-pattern>
  <exclude-pattern>*/*.blade.php</exclude-pattern>
  <exclude-pattern>*/autoload.php</exclude-pattern>
  <exclude-pattern>*/storage/*</exclude-pattern>
  <exclude-pattern>*/docs/*</exclude-pattern>
  <exclude-pattern>*/vendor/*</exclude-pattern>
  <exclude-pattern>*/migrations/*</exclude-pattern>
  <exclude-pattern>public/index.php</exclude-pattern>

  <arg name="colors" />
  <arg value="p" />

  <ini name="memory_limit" value="128M" />

  <!-- Use PSR12 -->
  <rule ref="PSR12">
    <exclude name="PSR12.Files.FileHeader.SpacingInsideBlock" />
  </rule>
  <rule ref="PSR1.Methods.CamelCapsMethodName">
    <exclude-pattern>*/tests/*</exclude-pattern>
    <exclude-pattern>*/data/*</exclude-pattern>
  </rule>

  <!-- Ban some functions -->
  <rule ref="Generic.PHP.ForbiddenFunctions">
    <properties>
      <property name="forbiddenFunctions" type="array">
        <element key="sizeof" value="count" />
        <element key="delete" value="unset" />
        <element key="print" value="echo" />
        <element key="is_null" value="null" />
        <element key="create_function" value="null" />
      </property>
    </properties>
  </rule>

  <!-- Private methods MUST not be prefixed with an underscore -->
  <rule ref="PSR2.Methods.MethodDeclaration.Underscore">
    <type>error</type>
  </rule>

  <!-- Private properties MUST not be prefixed with an underscore -->
  <rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
    <type>error</type>
  </rule>

  <!-- We use custom indent rules for arrays -->
  <rule ref="Generic.Arrays.ArrayIndent" />
  <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
    <severity>0</severity>
  </rule>
  <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
    <severity>0</severity>
  </rule>
  <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
    <severity>0</severity>
  </rule>
  <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine">
    <severity>0</severity>
  </rule>

  <!-- Include some sniffs from other standards that don't conflict with PEAR -->
  <rule ref="Squiz.Arrays.ArrayBracketSpacing" />
  <rule ref="Squiz.Arrays.ArrayDeclaration" />
  <!-- <rule ref="Squiz.Commenting.ClosingDeclarationComment" /> -->
  <rule ref="Squiz.ControlStructures.ControlSignature" />
  <!-- <rule ref="Squiz.ControlStructures.ElseIfDeclaration" /> -->
  <!-- <rule ref="Squiz.Commenting.BlockComment" /> -->
  <rule ref="Squiz.Commenting.DocCommentAlignment" />
  <rule ref="Squiz.Commenting.EmptyCatchComment" />
  <!-- <rule ref="Squiz.Commenting.InlineComment" /> -->
  <rule ref="Squiz.Commenting.LongConditionClosingComment" />
  <!-- <rule ref="Squiz.Commenting.PostStatementComment" /> -->
  <rule ref="Squiz.Commenting.VariableComment" />
  <rule ref="Squiz.Commenting.FunctionComment" />
  <rule ref="Squiz.Formatting.OperatorBracket" />
  <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing" />
  <rule ref="Squiz.Operators.ComparisonOperatorUsage" />
  <!-- <rule ref="Squiz.PHP.DisallowInlineIf" /> -->
  <rule ref="Squiz.Scope.MethodScope" />
  <!-- <rule ref="Squiz.Strings.ConcatenationSpacing" /> -->
  <rule ref="Squiz.WhiteSpace.ControlStructureSpacing" />
  <!-- <rule ref="Squiz.WhiteSpace.FunctionClosingBraceSpace" /> -->
  <rule ref="Squiz.WhiteSpace.FunctionSpacing.Before" />
  <!-- <rule ref="Squiz.WhiteSpace.MemberVarSpacing" /> -->
  <rule ref="Squiz.WhiteSpace.OperatorSpacing" />
  <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />
  <rule ref="Generic.Arrays.DisallowLongArraySyntax" />
  <rule ref="Generic.Commenting.Todo" />
  <rule ref="Generic.Commenting.Fixme" />
  <rule ref="Generic.ControlStructures.DisallowYodaConditions" />
  <rule ref="Generic.ControlStructures.InlineControlStructure" />
  <rule ref="Generic.Formatting.DisallowMultipleStatements" />
  <rule ref="Generic.Formatting.SpaceAfterCast" />
  <rule ref="Generic.NamingConventions.ConstructorName" />
  <rule ref="Generic.PHP.DeprecatedFunctions" />
  <rule ref="Generic.PHP.LowerCaseKeyword" />
  <rule ref="Generic.Strings.UnnecessaryStringConcat" />
  <rule ref="Generic.WhiteSpace.IncrementDecrementSpacing" />
  <rule ref="PSR2.Classes.PropertyDeclaration" />
  <rule ref="PSR2.Methods.MethodDeclaration" />
  <!-- <rule ref="PSR2.Files.EndFileNewline" /> -->
  <rule ref="Zend.Files.ClosingTag" />
</ruleset>