<?xml version="1.0"?>
<ruleset name="Bongoto WooCommerce Theme">
	<description>
		PHPCS ruleset for the Bongoto WooCommerce theme.
		Uses WordPress Coding Standards (WPCS) and PHPCompatibility.
	</description>

	<!-- Scan all PHP-like sources at repo root -->
	<file>./</file>

	<!-- Exclude non-source and build artifacts -->
	<exclude-pattern>*/vendor/*</exclude-pattern>
	<exclude-pattern>*/node_modules/*</exclude-pattern>
	<exclude-pattern>*/assets/*</exclude-pattern>
	<exclude-pattern>*/languages/*</exclude-pattern>
	<exclude-pattern>*/tests/*</exclude-pattern>
	<exclude-pattern>*.pot</exclude-pattern>
	<exclude-pattern>*.po</exclude-pattern>
	<exclude-pattern>*.mo</exclude-pattern>
	<exclude-pattern>*.css</exclude-pattern>
	<exclude-pattern>*.scss</exclude-pattern>
	<exclude-pattern>*.min.*</exclude-pattern>

	<!-- Recognized file extensions -->
	<arg name="extensions" value="php,inc,php.dist"/>

	<!-- Output & UX -->
	<arg name="report-width" value="120"/>
	<arg name="parallel" value="8"/>
	<arg name="colors"/>
	<arg value="p"/> <!-- show progress -->
	<arg value="s"/> <!-- show sniff codes -->
	<arg name="cache"/>

	<!-- Indentation & line length -->
	<arg name="tab-width" value="4"/>
	<config name="lineLength" value="120"/>

	<!-- Base WPCS rules (Extra already includes Core + Docs) -->
	<rule ref="WordPress-Extra"/>

	<!-- Optional: stricter docs -->
	<rule ref="WordPress-Docs"/>

	<!-- Enforce short array syntax -->
	<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>

	<!-- PHPCompatibility (via PHPCompatibilityWP) -->
	<!-- Ensure you've installed: dealerdirect/phpcodesniffer-composer-installer, phpcompatibility/php-compatibility, phpcompatibility/phpcompatibility-wp -->
	<rule ref="PHPCompatibilityWP"/>
	<!-- Theme requires PHP 7.4+ -->
	<config name="testVersion" value="7.4-"/>

	<!-- WordPress version context (affects deprecations) -->
	<!-- Bump when you raise your minimum supported WP version -->
	<config name="minimum_supported_wp_version" value="6.3"/>

	<!-- Internationalization: enforce theme text domain -->
	<rule ref="WordPress.WP.I18n">
		<properties>
			<!-- Only allow these text domains in translation functions -->
			<property name="text_domain" type="array">
				<element value="bongoto-woocommerce"/>
			</property>
			<!-- Allow empty text domain in esc_html__ etc? keep default (false) -->
		</properties>
	</rule>

	<!-- File name constraints: relax for template parts & Woo overrides -->
	<rule ref="WordPress.Files.FileName">
		<exclude-pattern>template-parts/*</exclude-pattern>
		<exclude-pattern>woocommerce/*</exclude-pattern>
	</rule>

	<!-- Disallow error suppression unless justified -->
	<rule ref="Generic.PHP.NoSilencedErrors"/>

	<!-- Encourage strict comparisons -->
	<rule ref="WordPress.PHP.StrictComparisons"/>

	<!-- Theme specifics: allow long lines in arrays (keep global 120 cap) -->
	<rule ref="Generic.Files.LineLength">
		<properties>
			<property name="lineLimit" value="120"/>
			<property name="absoluteLineLimit" value="0"/>
			<property name="ignoreComments" value="true"/>
		</properties>
	</rule>

	<!-- Ignore vendor-prefixed globals inside Woo templates -->
	<rule ref="WordPress.NamingConventions.ValidVariableName">
		<exclude-pattern>woocommerce/*</exclude-pattern>
	</rule>

	<!-- Optional: allow snake_case in array keys from 3rd-party hooks -->
	<rule ref="WordPress.NamingConventions.ValidHookName">
		<exclude-pattern>inc/compatibility/*</exclude-pattern>
		<exclude-pattern>woocommerce/*</exclude-pattern>
	</rule>
</ruleset>
