phpcs.xml.dist 12 KB

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