<?xml version="1.0"?>
<!-- PHP_CodeSniffer ruleset file -->
<!-- Example: https://github.com/squizlabs/PHP_CodeSniffer/blob/master/phpcs.xml.dist -->
<ruleset name="PHP_CodeSniffer">
	<description>PHP coding standard for Composr CMS</description>

	<file>sources</file>
	<file>sources_custom</file>

	<!-- Exclude third-party code -->
	<exclude-pattern>sources/diff.php</exclude-pattern>
	<exclude-pattern>sources/firephp.php</exclude-pattern>
	<exclude-pattern>sources/jsmin.php</exclude-pattern>
	<exclude-pattern>sources/lang_stemmer_EN.php</exclude-pattern>
	
	<exclude-pattern>sources_custom/aws</exclude-pattern>
	<exclude-pattern>sources_custom/Cloudinary</exclude-pattern>
	<exclude-pattern>sources_custom/composr_mobile_sdk/ios</exclude-pattern>
	<exclude-pattern>sources_custom/facebook</exclude-pattern>
	<exclude-pattern>sources_custom/geshi</exclude-pattern>
	<exclude-pattern>sources_custom/getid3</exclude-pattern>
	<exclude-pattern>sources_custom/ILess</exclude-pattern>
	<exclude-pattern>sources_custom/photobucket</exclude-pattern>
	<exclude-pattern>sources_custom/programe</exclude-pattern>
	<exclude-pattern>sources_custom/sabredav</exclude-pattern>
	<exclude-pattern>sources_custom/spout</exclude-pattern>
	<exclude-pattern>sources_custom/sugar_crm_lib.php</exclude-pattern>
	<exclude-pattern>sources_custom/swift_mailer</exclude-pattern>
	<exclude-pattern>sources_custom/Transliterator</exclude-pattern>
	<exclude-pattern>sources_custom/twitter.php</exclude-pattern>
	
	<!-- Include the PSR2 standard (https://www.php-fig.org/psr/psr-2/) -->
	<!-- We only partially follow it: https://compo.sr/tracker/view.php?id=1568 -->
	<rule ref="PSR2">
		<!-- Excludes with the generated error messages mentioned: -->
		<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
		<!-- ^ "Method name [...] is not in camel caps format" -->
		<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
		<!-- ^ "Each class must be in a namespace of at least one level (a top-level vendor name)" -->
		<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
		<!-- ^ "Method name should not be prefixed with an underscore to indicate visibility" -->
		<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
		<!-- ^ "Property name [...] should not be prefixed with an underscore to indicate visibility" -->
		<exclude name="Generic.Files.LineLength.TooLong" />
		<!-- ^ "Line exceeds 120 characters" -->
		<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
		<!-- ^ "Class name [...] is not in PascalCase format" -->
		<exclude name="PSR1.Classes.ClassDeclaration.MultipleClasses" />
		<!-- ^ "Each class must be in a file by itself" -->
		<exclude name="Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase" />
		<!-- ^ "Constants must be uppercase; expected 'SOME_CONSTANT' but found 'SOME_constant'" -->
		<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace" />
		<!-- ^ "Expected 0 spaces after opening bracket; newline found" -->
	</rule>
</ruleset>