phpcs.xml.dist 12 KB

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