<?xml version="1.0"?>
<ruleset name="PHPCS Coding Standards for PHPCompatibility">
	<description>Check the code of the PHPCompatibility standard itself.</description>

	<arg value="sp"/>
	<arg name="extensions" value="php"/>

	<!-- Exclude test case code. -->
	<exclude-pattern>/Tests/sniff-examples/*</exclude-pattern>

	<!-- Exclude Composer vendor directory. -->
	<exclude-pattern>*/vendor/*</exclude-pattern>

	<!--
		PHP cross version compatibility ;-).
	-->
	<config name="testVersion" value="5.1-99.0"/>
	<rule ref="PHPCompatibility"/>

	<!-- Verified correct usage. -->
	<rule ref="PHPCompatibility.PHP.DeprecatedIniDirectives.asp_tagsRemoved">
		<exclude-pattern>*/RemovedAlternativePHPTags*.php</exclude-pattern>
	</rule>

	<!-- Verified correct usage: PHPUnit 6 compatibility layer. -->
	<rule ref="PHPCompatibility.PHP.NewLanguageConstructs.t_ns_separatorFound">
		<exclude-pattern>/Tests/PHPUnit6Compat.php</exclude-pattern>
	</rule>
	<rule ref="PHPCompatibility.PHP.NewFunctions.class_aliasFound">
		<exclude-pattern>/Tests/PHPUnit6Compat.php</exclude-pattern>
	</rule>

	<!--
		Minimal code style check.
	-->
	<rule ref="PSR2">
		<!-- To address at a later point in time. -->
		<exclude name="Generic.Files.LineLength.TooLong"/>

		<!-- These will be addressed when making the repo compatible with PHPCS 3.x. -->
		<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
		<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>

		<!-- Ignoring a number of whitespace issues around blank lines. -->
		<exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody"/>
		<exclude name="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose"/>
		<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/>
		<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
		<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/>
	</rule>

	<rule ref="Squiz.Arrays.ArrayDeclaration">
		<!-- Ignoring the Squiz indentation rules as normalized arrays are preferred.
		     Unfortunately there is currently no upstream sniff to check for this. -->
		<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/>
		<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/>
		<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>

		<!-- Single and multi-line arrays are both allowed. -->
		<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"/>
		<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed"/>
	</rule>

	<!--
		Inline Documentation check.
	-->
	<rule ref="Generic.Commenting.DocComment">
		<!-- Having a @see or @internal tag before the @param tags is fine. -->
		<exclude name="Generic.Commenting.DocComment.ParamNotFirst"/>
	</rule>

	<!-- No need to be as strict about comment punctuation for the unit tests. -->
	<rule ref="Generic.Commenting.DocComment.ShortNotCapital">
		<exclude-pattern>/Tests/*.php</exclude-pattern>
	</rule>


	<rule ref="PEAR.Commenting">
		<!-- Exclude PEAR specific tag requirements. -->
		<exclude name="PEAR.Commenting.FileComment.MissingVersion" />
		<exclude name="PEAR.Commenting.FileComment.MissingLinkTag" />
		<exclude name="PEAR.Commenting.FileComment.MissingLicenseTag" />
		<exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag" />
		<exclude name="PEAR.Commenting.ClassComment.MissingLinkTag" />

		<!-- Having a @see or @internal tag before the @category tag is fine. -->
		<exclude name="PEAR.Commenting.ClassComment.CategoryTagOrder"/>
	</rule>

	<!-- No need to be as strict about file and class comment tags for the unit tests. -->
	<rule ref="PEAR.Commenting.FileComment.MissingCategoryTag">
		<exclude-pattern>/Tests/*.php</exclude-pattern>
	</rule>
	<rule ref="PEAR.Commenting.FileComment.MissingAuthorTag">
		<exclude-pattern>/Tests/*.php</exclude-pattern>
	</rule>
	<rule ref="PEAR.Commenting.ClassComment.MissingCategoryTag">
		<exclude-pattern>/Tests/*.php</exclude-pattern>
	</rule>

</ruleset>
