<?xml version="1.0"?>
<ruleset>
	<!-- This rule set includes all rules from the MediaWiki rule set, see
		https://github.com/wikimedia/mediawiki-tools-codesniffer/blob/master/MediaWiki/ruleset.xml
		-->
	<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">

		<!-- The function comment sniff is way to rigorous about way to many details that need
			exceptions:
			* It complains about missing documentation on fully self-explanatory function headers
			  with strict type hints.
			* It complains about missing documentation if there is a proper @see tag.
			* It complains about duplicate spaces in "@param <type>  $<var>", but removing these
			  doesn't make the code easier to read.
			* It does not understand "@param <type> [$optional,…]. -->
		<exclude name="MediaWiki.Commenting.FunctionComment" />

		<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
		<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />

		<!-- We disagree with the idea of certain characters making comments "illegal" and blocking
			patches from being merged. This behaves especially bad on code examples. -->
		<exclude name="MediaWiki.Commenting.IllegalSingleLineComment" />

		<!-- Starting a function's body with an empty line can be helpful after a very large header.
			The code is not guaranteed to be easier to read if this is disallowed. -->
		<exclude name="MediaWiki.WhiteSpace.DisallowEmptyLineFunctions" />

		<!-- Even if we encourage to use a space in "function ()", we don't think this sniff should
			block patches from being merged. -->
		<exclude name="MediaWiki.WhiteSpace.SpaceAfterClosure" />

		<!-- Even if we encourage to use spaces in comments, we don't think this sniff should block
			patches from being merged. -->
		<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment" />

		<exclude name="Generic.Arrays.DisallowLongArraySyntax" />
		<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName" />
	</rule>

	<rule ref="Generic.CodeAnalysis" />
	<rule ref="Generic.Files.LineLength">
		<properties>
			<property name="lineLimit" value="120" />
		</properties>
	</rule>

	<rule ref="Generic.Metrics.NestingLevel" />
	<rule ref="Generic.Metrics.CyclomaticComplexity" />

	<rule ref="PSR1.Files.SideEffects" />
	<rule ref="Squiz.Strings.DoubleQuoteUsage">
		<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar" />
	</rule>

	<file>.</file>
</ruleset>
