phpcs.xml.dist 12 KB

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