<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards">
	<description>A custom set of code standard rules to check for WordPress themes and plugins.</description>

	<file>.</file>

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

	<exclude-pattern>dist</exclude-pattern>
	<exclude-pattern>node_modules</exclude-pattern>
	<exclude-pattern>vendor</exclude-pattern>
	<exclude-pattern>\.lando</exclude-pattern>
	<exclude-pattern>\.wordpress</exclude-pattern>

	<!-- Basic -->
	<rule ref="PHPCompatibility" />
	<config name="testVersion" value="7.4-" />

	<!-- Include the WordPress ruleset, with exclusions. -->
	<rule ref="WordPress">
		<exclude name="Generic.Commenting.DocComment.MissingShort"/>
		<exclude name="Generic.Functions.CallTimePassByReference" />

		<exclude name="Squiz.Commenting.ClassComment.Missing" />
		<exclude name="Squiz.Commenting.FileComment.Missing" />
		<exclude name="Squiz.Commenting.FileComment.MissingPackageTag" />
		<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment" />
		<exclude name="Squiz.Commenting.FileComment.SpacingAfterOpen" />
		<exclude name="Squiz.Commenting.FileComment.WrongStyle" />
		<exclude name="Squiz.Commenting.FunctionComment.Missing" />
		<exclude name="Squiz.Commenting.FunctionComment.WrongStyle" />
		<exclude name="Squiz.Commenting.FunctionCommentThrowTag.WrongNumber" />
		<exclude name="Squiz.Commenting.VariableComment.Missing" />

		<exclude name="WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode" />
		<exclude name="WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode" />
	</rule>

	<!-- Restore some WordPress exclusions -->
	<rule ref="WordPress.Files.FileName.InvalidClassFileName">
		<exclude-pattern>lib/nelio/zod</exclude-pattern>
		<exclude-pattern>php-stubs/\*</exclude-pattern>
		<severity>5</severity>
	</rule>

	<rule ref="WordPress.Files.FileName">
		<exclude-pattern>phpstan.dynamic.neon.php</exclude-pattern>
	</rule>

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

	<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
		<properties>
			<property name="prefixes" type="array">
				<element value="nelio_content"/>
				<element value="nelio_content_premium"/>
			</property>
		</properties>
		<exclude-pattern>phpstan.dynamic.neon.php</exclude-pattern>
		<exclude-pattern>php-stubs/*</exclude-pattern>
	</rule>

	<rule ref="WordPressVIPMinimum.Performance.WPQueryParams" />

	<!--
	Prevent errors caused by WordPress Coding Standards not supporting PHP 8.0+.
	See https://github.com/WordPress/WordPress-Coding-Standards/issues/2035
	-->
	<ini name="error_reporting" value="E_ALL &#38; ~E_DEPRECATED" />

	<!-- Prevent warnings in stubs -->
	<rule ref="Generic.Files.OneObjectStructurePerFile.MultipleFound">
		<exclude-pattern>php-stubs/\*</exclude-pattern>
	</rule>
	<rule ref="Squiz.Commenting.FunctionComment.InvalidNoReturn">
		<exclude-pattern>php-stubs/\*</exclude-pattern>
	</rule>
	<rule ref="Universal.Namespaces.DisallowCurlyBraceSyntax.Forbidden">
		<exclude-pattern>php-stubs/\*</exclude-pattern>
	</rule>
	<rule ref="Universal.Namespaces.OneDeclarationPerFile.MultipleFound">
		<exclude-pattern>php-stubs/\*</exclude-pattern>
	</rule>
	<rule ref="Universal.Files.SeparateFunctionsFromOO.Mixed">
		<exclude-pattern>php-stubs/*</exclude-pattern>
	</rule>
	<rule ref="WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid">
		<exclude-pattern>php-stubs/*</exclude-pattern>
	</rule>
	<rule ref="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase">
		<exclude-pattern>php-stubs/*</exclude-pattern>
	</rule>

</ruleset>
