<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="extendify-sdk" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">

	<description>WP Plugin checks</description>

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

	<exclude-pattern>/cypress/*</exclude-pattern>
	<exclude-pattern>/.github/*</exclude-pattern>
	<exclude-pattern>/tests/*</exclude-pattern>
	<exclude-pattern>/public/*</exclude-pattern>
	<exclude-pattern>/wpcs/*</exclude-pattern>

	<!-- Exclude the Node Modules directory. -->
	<exclude-pattern>/node_modules/*</exclude-pattern>

	<!-- Exclude CSS and Javascript files. -->
	<exclude-pattern>*.css</exclude-pattern>
	<exclude-pattern>*.js</exclude-pattern>

	<!-- Include the WordPress-Extra standard. -->
	<rule ref="WordPress-Extra">
		<!--
		We may want a middle ground though. The best way to do this is add the
		entire ruleset, then rule by rule, remove ones that don't suit a project.
		We can do this by running `phpcs` with the '-s' flag, which allows us to
		see the names of the sniffs reporting errors.
		Once we know the sniff names, we can opt to exclude sniffs which don't
		suit our project like so.

		The below two examples just show how you can exclude rules.
		They are not intended as advice about which sniffs to exclude.
		-->

		<!--
		<exclude name="WordPress.WhiteSpace.ControlStructureSpacing"/>
		<exclude name="WordPress.Security.EscapeOutput"/>
		-->
	</rule>

    <rule ref="WordPress">
        <exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
        <exclude name="WordPress.Files.FileName.InvalidClassFileName" />
        <exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound" />
        <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis" />
        <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis" />
        <exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore" />
        <exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter" />
        <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceAfterCloseParenthesis" />
        <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceAfterArrayOpener" />
        <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceBeforeArrayCloser" />
        <exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
        <exclude name="WordPress.NamingConventions.ValidVariableName.PropertyNotSnakeCase" />
        <exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid" />
        <exclude name="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase" />
        <exclude name="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase" />
        <exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys" />
        <exclude name="WordPress.PHP.YodaConditions.NotYoda" />
        <exclude name="WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid" />
        <exclude name="WordPress.NamingConventions.ValidVariableName.InterpolatedVariableNotSnakeCase" />
    </rule>

    <rule ref="Generic">
        <exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
        <exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
        <exclude name="Generic.PHP.ClosingPHPTag.NotFound" />
        <exclude name="Generic.Files.LowercasedFilename.NotFound" />
        <exclude name="Generic.Formatting.SpaceAfterNot.Incorrect" />
        <exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine" />
        <exclude name="Generic.Files.EndFileNoNewline.Found" />
        <exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine" />
        <exclude name="Generic.Files.LineLength.TooLong" />
        <exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
        <exclude name="Generic.Commenting.Todo.TaskFound" />
        <exclude name="Generic.Formatting.NoSpaceAfterCast.SpaceFound" />
        <exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame" />
        <exclude name="Generic.PHP.RequireStrictTypes.MissingDeclaration" />
        <exclude name="Generic.PHP.UpperCaseConstant.Found" />
        <exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeOpen" />
        <exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose" />
        <exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterOpen" />
        <exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterClose" />
        <exclude name="Generic.PHP.ForbiddenFunctions.Found" />
        <exclude name="Generic.Files.InlineHTML.Found" />
    </rule>
    <rule ref="Squiz">
        <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen" />
        <exclude name="Squiz.ControlStructures.ElseIfDeclaration.NotAllowed" />
        <exclude name="Squiz.WhiteSpace.FunctionClosingBraceSpace.SpacingBeforeClose" />
        <exclude name="Squiz.WhiteSpace.FunctionSpacing.AfterLast" />
        <exclude name="Squiz.Files.FileExtension.ClassFound" />
        <exclude name="Squiz.Commenting.FileComment.MissingPackageTag" />
        <exclude name="Squiz.Operators.ComparisonOperatorUsage.NotAllowed" />
        <exclude name="Squiz.WhiteSpace.FunctionSpacing.BeforeFirst" />
        <exclude name="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue" />
        <exclude name="Squiz.WhiteSpace.FunctionSpacing.After" />
        <exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned" />
        <exclude name="Squiz.WhiteSpace.FunctionSpacing.Before" />
        <exclude name="Squiz.PHP.DisallowBooleanStatement.Found" />
        <exclude name="Squiz.ControlStructures.InlineIfDeclaration.NoBrackets" />
        <exclude name="Squiz.PHP.DisallowInlineIf.Found" />
        <exclude name="Squiz.PHP.DisallowComparisonAssignment.AssignedComparison" />
        <exclude name="Squiz.PHP.DiscouragedFunctions.Discouraged" />
        <exclude name="Squiz.Functions.GlobalFunction.Found" />
        <exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" />
    </rule>
    <rule ref="PEAR">
        <exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
        <exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket" />
        <exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket" />
        <exclude name="PEAR.Commenting.FileComment.MissingPackageTag" />
        <exclude name="PEAR.Commenting.FileComment.MissingAuthorTag" />
        <exclude name="PEAR.Commenting.FileComment.MissingCategoryTag" />
        <exclude name="PEAR.Commenting.FileComment.MissingLinkTag" />
        <exclude name="PEAR.Commenting.FileComment.MissingLicenseTag" />
        <exclude name="PEAR.Commenting.FileComment.MissingVersion" />
        <exclude name="PEAR.Commenting.ClassComment.MissingPackageTag" />
        <exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag" />
        <exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag" />
        <exclude name="PEAR.Commenting.ClassComment.MissingLinkTag" />
        <exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag" />
        <exclude name="PEAR.Commenting.ClassComment.MissingVersion" />
        <exclude name="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore" />
        <exclude name="PEAR.Commenting.FileComment.WrongStyle" />
        <exclude name="PEAR.Commenting.FileComment.Missing" />
        <exclude name="PEAR.WhiteSpace.ScopeIndent.IncorrectExact" />
    </rule>

	<!-- Let's also check that everything is properly documented. -->
	<rule ref="WordPress-Docs"/>

	<!-- Add in some extra rules from other standards. -->
	<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
	<!-- <rule ref="Generic.Commenting.Todo"/> -->

	<!-- Check for PHP cross-version compatibility. -->
	<!--
	To enable this, the PHPCompatibilityWP standard needs
	to be installed.
	See the readme for installation instructions:
	https://github.com/PHPCompatibility/PHPCompatibilityWP
	For more information, also see:
	https://github.com/PHPCompatibility/PHPCompatibility
	-->

	<config name="testVersion" value="5.6-"/>
	<rule ref="PHPCompatibilityWP"/>


	<!--
	To get the optimal benefits of using WPCS, we should add a couple of
	custom properties.
	Adjust the values of these properties to fit our needs.

	For information on additional custom properties available, check out
	the wiki:
	https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
	-->
	<config name="minimum_supported_wp_version" value="5.4"/>

	<rule ref="WordPress.WP.I18n">
		<properties>
			<property name="text_domain" type="array">
				<element value="extendify-sdk"/>
			</property>
		</properties>
	</rule>

	<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
		<properties>
			<property name="prefixes" type="array">
				<element value="extendifysdk"/>
			</property>
		</properties>
	</rule>


</ruleset>
