phpcs.xml.dist 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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 name="basepath" value="."/>
  11. <arg name="extensions" value="php"/>
  12. <arg name="tab-width" value="4"/>
  13. <rule ref="Internal.Tokenizer.Exception">
  14. <type>error</type>
  15. </rule>
  16. <!--
  17. PHPCS built-in https://tentyp.dev/library/php/phpcs/
  18. -->
  19. <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
  20. <rule ref="Generic.Classes.DuplicateClassName"/>
  21. <rule ref="Generic.CodeAnalysis.AssignmentInCondition"/>
  22. <rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
  23. <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
  24. <rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
  25. <!--<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>-->
  26. <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
  27. <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
  28. <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
  29. <rule ref="Generic.Commenting.Fixme"/>
  30. <!--<rule ref="Generic.Commenting.Todo"/>-->
  31. <rule ref="Generic.ControlStructures.InlineControlStructure"/>
  32. <rule ref="Generic.Formatting.DisallowMultipleStatements"/>
  33. <!--<rule ref="Generic.Formatting.MultipleStatementAlignment"/>-->
  34. <rule ref="Generic.Formatting.NoSpaceAfterCast"/>
  35. <rule ref="Generic.Functions.CallTimePassByReference"/>
  36. <rule ref="Generic.NamingConventions.InterfaceNameSuffix"/>
  37. <rule ref="Generic.NamingConventions.TraitNameSuffix"/>
  38. <rule ref="Generic.PHP.BacktickOperator"/>
  39. <rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
  40. <rule ref="Generic.PHP.DeprecatedFunctions"/>
  41. <rule ref="Generic.PHP.DisallowAlternativePHPTags"/>
  42. <rule ref="Generic.PHP.DisallowRequestSuperglobal"/>
  43. <rule ref="Generic.PHP.DisallowShortOpenTag"/>
  44. <rule ref="Generic.PHP.DiscourageGoto"/>
  45. <rule ref="Generic.PHP.LowerCaseConstant"/>
  46. <rule ref="Generic.PHP.LowerCaseKeyword"/>
  47. <rule ref="Generic.PHP.LowerCaseType"/>
  48. <rule ref="Generic.PHP.NoSilencedErrors"/>
  49. <!--<rule ref="Generic.PHP.RequireStrictTypes"/>-->
  50. <rule ref="Generic.PHP.SAPIUsage"/>
  51. <rule ref="Generic.PHP.Syntax"/>
  52. <rule ref="Generic.Strings.UnnecessaryStringConcat"/>
  53. <!--<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>-->
  54. <rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
  55. <rule ref="Generic.WhiteSpace.ScopeIndent"/>
  56. <rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/>
  57. <rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
  58. <rule ref="PSR2.Files.ClosingTag"/>
  59. <rule ref="PSR2.Files.EndFileNewline"/>
  60. <rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
  61. <rule ref="PSR12.Classes.AnonClassDeclaration"/>
  62. <rule ref="PSR12.Classes.ClosingBrace"/>
  63. <rule ref="PSR12.Files.OpenTag"/>
  64. <rule ref="PSR12.Functions.NullableTypeDeclaration"/>
  65. <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
  66. <rule ref="Squiz.Classes.DuplicateProperty"/>
  67. <rule ref="Squiz.Classes.LowercaseClassKeywords"/>
  68. <rule ref="Squiz.Classes.SelfMemberReference"/>
  69. <rule ref="Squiz.Commenting.DocCommentAlignment"/>
  70. <rule ref="Squiz.Commenting.EmptyCatchComment"/>
  71. <rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
  72. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
  73. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
  74. <rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
  75. <rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
  76. <rule ref="Squiz.Formatting.OperatorBracket"/>
  77. <rule ref="Squiz.Functions.FunctionDeclaration"/>
  78. <rule ref="Squiz.Functions.FunctionDuplicateArgument"/>
  79. <rule ref="Squiz.Functions.LowercaseFunctionKeywords"/>
  80. <rule ref="Squiz.Operators.IncrementDecrementUsage"/>
  81. <rule ref="Squiz.Operators.ValidLogicalOperators"/>
  82. <rule ref="Squiz.PHP.DisallowMultipleAssignments"/>
  83. <rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
  84. <rule ref="Squiz.PHP.Eval"/>
  85. <rule ref="Squiz.PHP.InnerFunctions"/>
  86. <rule ref="Squiz.PHP.LowercasePHPFunctions"/>
  87. <rule ref="Squiz.PHP.NonExecutableCode"/>
  88. <rule ref="Squiz.Scope.MemberVarScope"/>
  89. <rule ref="Squiz.Scope.MethodScope"/>
  90. <rule ref="Squiz.Scope.StaticThisUsage"/>
  91. <rule ref="Squiz.Strings.DoubleQuoteUsage"/>
  92. <rule ref="Squiz.Strings.EchoedStrings"/>
  93. <rule ref="Squiz.WhiteSpace.CastSpacing"/>
  94. <rule ref="Squiz.PHP.GlobalKeyword">
  95. <exclude-pattern>examples</exclude-pattern>
  96. </rule>
  97. <rule ref="PSR1.Files.SideEffects">
  98. <exclude-pattern>examples</exclude-pattern>
  99. <exclude-pattern>benchmark</exclude-pattern>
  100. </rule>
  101. <!--
  102. Configurable built-in https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties
  103. -->
  104. <rule ref="Generic.ControlStructures.InlineControlStructure">
  105. <properties>
  106. <property name="error" value="true"/>
  107. </properties>
  108. </rule>
  109. <rule ref="Generic.Files.LineLength">
  110. <properties>
  111. <property name="lineLimit" value="140" />
  112. <property name="absoluteLineLimit" value="160" />
  113. <property name="ignoreComments" value="true" />
  114. </properties>
  115. <exclude-pattern>examples</exclude-pattern>
  116. </rule>
  117. <rule ref="Generic.Formatting.SpaceAfterNot">
  118. <properties>
  119. <property name="spacing" value="0" />
  120. </properties>
  121. </rule>
  122. <rule ref="Generic.PHP.ForbiddenFunctions">
  123. <properties>
  124. <property name="forbiddenFunctions" type="array">
  125. <element key="die" value="exit"/>
  126. <element key="sizeof" value="count"/>
  127. <element key="delete" value="unset"/>
  128. <element key="print" value="echo"/>
  129. <element key="is_null" value="null"/>
  130. <element key="create_function" value="null"/>
  131. </property>
  132. </properties>
  133. </rule>
  134. <rule ref="Generic.Strings.UnnecessaryStringConcat">
  135. <properties>
  136. <property name="allowMultiline" value="true" />
  137. </properties>
  138. </rule>
  139. <rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing">
  140. <properties>
  141. <property name="ignoreNewlines" value="true" />
  142. </properties>
  143. </rule>
  144. <rule ref="Generic.WhiteSpace.ScopeIndent">
  145. <properties>
  146. <property name="tabIndent" value="true" />
  147. <property name="ignoreIndentationTokens" type="array">
  148. <element value="T_COMMENT"/>
  149. <element value="T_DOC_COMMENT_OPEN_TAG"/>
  150. </property>
  151. </properties>
  152. </rule>
  153. <rule ref="PSR12.ControlStructures.BooleanOperatorPlacement">
  154. <properties>
  155. <property name="allowOnly" value="first" />
  156. </properties>
  157. </rule>
  158. <rule ref="PSR12.Namespaces.CompoundNamespaceDepth">
  159. <properties>
  160. <property name="maxDepth" value="1" />
  161. </properties>
  162. </rule>
  163. <rule ref="Squiz.Strings.ConcatenationSpacing">
  164. <properties>
  165. <property name="ignoreNewlines" value="true" />
  166. </properties>
  167. </rule>
  168. <rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
  169. <properties>
  170. <property name="ignoreNewlines" value="true" />
  171. </properties>
  172. </rule>
  173. <rule ref="Squiz.WhiteSpace.OperatorSpacing">
  174. <properties>
  175. <property name="ignoreNewlines" value="true" />
  176. </properties>
  177. </rule>
  178. <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
  179. <properties>
  180. <property name="ignoreBlankLines" value="true" />
  181. </properties>
  182. </rule>
  183. </ruleset>