phpcs.xml.dist 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <?xml version="1.0"?>
  2. <ruleset name="php-qrcode-cs"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
  5. <description>php-qrcode rules for phpcs</description>
  6. <!--<file>benchmark</file>-->
  7. <file>examples</file>
  8. <file>src</file>
  9. <file>tests</file>
  10. <arg value="ps"/>
  11. <arg name="parallel" value="8"/>
  12. <arg name="cache" value=".build/phpcs.cache"/>
  13. <arg name="basepath" value="."/>
  14. <arg name="extensions" value="php"/>
  15. <arg name="tab-width" value="4"/>
  16. <config name="installed_paths" value="../../phpcompatibility/php-compatibility,../../phpcsstandards/phpcsutils,../../slevomat/coding-standard"/>
  17. <rule ref="Internal.Tokenizer.Exception">
  18. <type>error</type>
  19. </rule>
  20. <!--
  21. PHPCompatibility https://github.com/PHPCompatibility/PHPCompatibility
  22. -->
  23. <config name="testVersion" value="7.4-"/>
  24. <rule ref="PHPCompatibility"/>
  25. <!--
  26. Slevomat https://github.com/slevomat/coding-standard
  27. -->
  28. <rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
  29. <rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/>
  30. <rule ref="SlevomatCodingStandard.Arrays.DisallowPartiallyKeyed"/>
  31. <rule ref="SlevomatCodingStandard.Attributes.DisallowAttributesJoining"/>
  32. <rule ref="SlevomatCodingStandard.Attributes.DisallowMultipleAttributesPerLine"/>
  33. <rule ref="SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment"/>
  34. <rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
  35. <rule ref="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion"/>
  36. <rule ref="SlevomatCodingStandard.Classes.ForbiddenPublicProperty"/>
  37. <rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
  38. <rule ref="SlevomatCodingStandard.Commenting.DeprecatedAnnotationDeclaration"/>
  39. <!--
  40. <rule ref="SlevomatCodingStandard.Commenting.EmptyComment"/>
  41. <rule ref="SlevomatCodingStandard.Commenting.UselessFunctionDocComment"/>
  42. <rule ref="SlevomatCodingStandard.Commenting.UselessInheritDocComment"/>
  43. -->
  44. <rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
  45. <rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch"/>
  46. <rule ref="SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator"/>
  47. <rule ref="SlevomatCodingStandard.ControlStructures.DisallowTrailingMultiLineTernaryOperator"/>
  48. <rule ref="SlevomatCodingStandard.ControlStructures.NewWithoutParentheses"/>
  49. <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator"/>
  50. <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
  51. <!--<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullSafeObjectOperator"/>-->
  52. <rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/>
  53. <rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator"/>
  54. <!--<rule ref="SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch"/>-->
  55. <rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction"/>
  56. <!--
  57. <rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall"/>
  58. <rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration"/>
  59. -->
  60. <rule ref="SlevomatCodingStandard.Functions.StrictCall"/>
  61. <rule ref="SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile"/>
  62. <rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
  63. <rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
  64. <rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/>
  65. <rule ref="SlevomatCodingStandard.Numbers.DisallowNumericLiteralSeparator"/>
  66. <rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
  67. <rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator"/>
  68. <rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking"/>
  69. <rule ref="SlevomatCodingStandard.PHP.ShortList"/>
  70. <rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
  71. <rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
  72. <rule ref="SlevomatCodingStandard.Strings.DisallowVariableParsing"/>
  73. <!--<rule ref="SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint"/>-->
  74. <rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
  75. <!--<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>-->
  76. <rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
  77. <!--
  78. <rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint"/>
  79. <rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
  80. <rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint"/>
  81. -->
  82. <rule ref="SlevomatCodingStandard.Variables.DisallowVariableVariable"/>
  83. <rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable"/>
  84. <rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>
  85. <!--
  86. <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
  87. <properties>
  88. <property name="linesCountBeforeDeclare" value="0"/>
  89. <property name="linesCountAfterDeclare" value="1"/>
  90. <property name="spacesCountAroundEqualsSign" value="0"/>
  91. </properties>
  92. </rule>
  93. -->
  94. <rule ref="SlevomatCodingStandard.Functions.RequireMultiLineCall">
  95. <properties>
  96. <property name="minLineLength" value="131"/>
  97. </properties>
  98. </rule>
  99. <rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable">
  100. <exclude-pattern>examples</exclude-pattern>
  101. </rule>
  102. <rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
  103. <properties>
  104. <property name="enable" value="false"/>
  105. </properties>
  106. </rule>
  107. <rule ref="SlevomatCodingStandard.Variables.UnusedVariable">
  108. <properties>
  109. <property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true"/>
  110. </properties>
  111. </rule>
  112. <!--
  113. PHPCS built-in https://tentyp.dev/library/php/phpcs/
  114. -->
  115. <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
  116. <rule ref="Generic.Classes.DuplicateClassName"/>
  117. <rule ref="Generic.CodeAnalysis.AssignmentInCondition"/>
  118. <rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
  119. <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
  120. <rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
  121. <!--<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>-->
  122. <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
  123. <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
  124. <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
  125. <rule ref="Generic.Commenting.Fixme"/>
  126. <!--<rule ref="Generic.Commenting.Todo"/>-->
  127. <rule ref="Generic.ControlStructures.InlineControlStructure"/>
  128. <rule ref="Generic.Formatting.DisallowMultipleStatements"/>
  129. <!--<rule ref="Generic.Formatting.MultipleStatementAlignment"/>-->
  130. <rule ref="Generic.Formatting.NoSpaceAfterCast"/>
  131. <rule ref="Generic.Functions.CallTimePassByReference"/>
  132. <rule ref="Generic.NamingConventions.InterfaceNameSuffix"/>
  133. <rule ref="Generic.NamingConventions.TraitNameSuffix"/>
  134. <rule ref="Generic.PHP.BacktickOperator"/>
  135. <rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
  136. <rule ref="Generic.PHP.DeprecatedFunctions"/>
  137. <rule ref="Generic.PHP.DisallowAlternativePHPTags"/>
  138. <rule ref="Generic.PHP.DisallowRequestSuperglobal"/>
  139. <rule ref="Generic.PHP.DisallowShortOpenTag"/>
  140. <rule ref="Generic.PHP.DiscourageGoto"/>
  141. <rule ref="Generic.PHP.LowerCaseConstant"/>
  142. <rule ref="Generic.PHP.LowerCaseKeyword"/>
  143. <rule ref="Generic.PHP.LowerCaseType"/>
  144. <rule ref="Generic.PHP.NoSilencedErrors"/>
  145. <!--<rule ref="Generic.PHP.RequireStrictTypes"/>-->
  146. <rule ref="Generic.PHP.SAPIUsage"/>
  147. <rule ref="Generic.PHP.Syntax"/>
  148. <rule ref="Generic.Strings.UnnecessaryStringConcat"/>
  149. <!--<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>-->
  150. <rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
  151. <rule ref="Generic.WhiteSpace.ScopeIndent"/>
  152. <rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/>
  153. <rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
  154. <rule ref="PSR2.Files.ClosingTag"/>
  155. <rule ref="PSR2.Files.EndFileNewline"/>
  156. <rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
  157. <rule ref="PSR12.Classes.AnonClassDeclaration"/>
  158. <rule ref="PSR12.Classes.ClosingBrace"/>
  159. <rule ref="PSR12.Files.OpenTag"/>
  160. <rule ref="PSR12.Functions.NullableTypeDeclaration"/>
  161. <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
  162. <rule ref="Squiz.Classes.DuplicateProperty"/>
  163. <rule ref="Squiz.Classes.LowercaseClassKeywords"/>
  164. <rule ref="Squiz.Classes.SelfMemberReference"/>
  165. <rule ref="Squiz.Commenting.DocCommentAlignment"/>
  166. <rule ref="Squiz.Commenting.EmptyCatchComment"/>
  167. <rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
  168. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
  169. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
  170. <rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
  171. <rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
  172. <rule ref="Squiz.Formatting.OperatorBracket"/>
  173. <rule ref="Squiz.Functions.FunctionDeclaration"/>
  174. <rule ref="Squiz.Functions.FunctionDuplicateArgument"/>
  175. <rule ref="Squiz.Functions.LowercaseFunctionKeywords"/>
  176. <rule ref="Squiz.Operators.IncrementDecrementUsage"/>
  177. <rule ref="Squiz.Operators.ValidLogicalOperators"/>
  178. <rule ref="Squiz.PHP.DisallowMultipleAssignments"/>
  179. <rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
  180. <rule ref="Squiz.PHP.Eval"/>
  181. <rule ref="Squiz.PHP.InnerFunctions"/>
  182. <rule ref="Squiz.PHP.LowercasePHPFunctions"/>
  183. <rule ref="Squiz.PHP.NonExecutableCode"/>
  184. <rule ref="Squiz.Scope.MemberVarScope"/>
  185. <rule ref="Squiz.Scope.MethodScope"/>
  186. <rule ref="Squiz.Scope.StaticThisUsage"/>
  187. <rule ref="Squiz.Strings.DoubleQuoteUsage"/>
  188. <rule ref="Squiz.Strings.EchoedStrings"/>
  189. <rule ref="Squiz.WhiteSpace.CastSpacing"/>
  190. <rule ref="Squiz.PHP.GlobalKeyword">
  191. <exclude-pattern>examples</exclude-pattern>
  192. </rule>
  193. <rule ref="PSR1.Files.SideEffects">
  194. <exclude-pattern>examples</exclude-pattern>
  195. <exclude-pattern>benchmark</exclude-pattern>
  196. </rule>
  197. <!--
  198. Configurable built-in https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties
  199. -->
  200. <rule ref="Generic.ControlStructures.InlineControlStructure">
  201. <properties>
  202. <property name="error" value="true"/>
  203. </properties>
  204. </rule>
  205. <rule ref="Generic.Files.LineLength">
  206. <properties>
  207. <property name="lineLimit" value="140" />
  208. <property name="absoluteLineLimit" value="160" />
  209. <property name="ignoreComments" value="true" />
  210. </properties>
  211. <exclude-pattern>examples</exclude-pattern>
  212. </rule>
  213. <rule ref="Generic.Formatting.SpaceAfterNot">
  214. <properties>
  215. <property name="spacing" value="0" />
  216. </properties>
  217. </rule>
  218. <rule ref="Generic.PHP.ForbiddenFunctions">
  219. <properties>
  220. <property name="forbiddenFunctions" type="array">
  221. <element key="die" value="exit"/>
  222. <element key="sizeof" value="count"/>
  223. <element key="delete" value="unset"/>
  224. <element key="print" value="echo"/>
  225. <element key="is_null" value="null"/>
  226. <element key="create_function" value="null"/>
  227. </property>
  228. </properties>
  229. </rule>
  230. <rule ref="Generic.Strings.UnnecessaryStringConcat">
  231. <properties>
  232. <property name="allowMultiline" value="true" />
  233. </properties>
  234. </rule>
  235. <rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing">
  236. <properties>
  237. <property name="ignoreNewlines" value="true" />
  238. </properties>
  239. </rule>
  240. <rule ref="Generic.WhiteSpace.ScopeIndent">
  241. <properties>
  242. <property name="tabIndent" value="true" />
  243. <property name="ignoreIndentationTokens" type="array">
  244. <element value="T_COMMENT"/>
  245. <element value="T_DOC_COMMENT_OPEN_TAG"/>
  246. </property>
  247. </properties>
  248. </rule>
  249. <rule ref="PSR12.ControlStructures.BooleanOperatorPlacement">
  250. <properties>
  251. <property name="allowOnly" value="first" />
  252. </properties>
  253. </rule>
  254. <rule ref="PSR12.Namespaces.CompoundNamespaceDepth">
  255. <properties>
  256. <property name="maxDepth" value="1" />
  257. </properties>
  258. </rule>
  259. <rule ref="Squiz.Strings.ConcatenationSpacing">
  260. <properties>
  261. <property name="ignoreNewlines" value="true" />
  262. </properties>
  263. </rule>
  264. <rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
  265. <properties>
  266. <property name="ignoreNewlines" value="true" />
  267. </properties>
  268. </rule>
  269. <rule ref="Squiz.WhiteSpace.OperatorSpacing">
  270. <properties>
  271. <property name="ignoreNewlines" value="true" />
  272. </properties>
  273. </rule>
  274. <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
  275. <properties>
  276. <property name="ignoreBlankLines" value="true" />
  277. </properties>
  278. </rule>
  279. </ruleset>