phpcs.xml.dist 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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.DeclareStrictTypes"/>-->
  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.Functions.RequireMultiLineCall">
  72. <properties>
  73. <property name="minLineLength" value="131"/>
  74. </properties>
  75. </rule>
  76. <rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable">
  77. <exclude-pattern>examples</exclude-pattern>
  78. </rule>
  79. <rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
  80. <properties>
  81. <property name="withSpaces" value="no"/>
  82. <property name="shortNullable" value="no"/>
  83. <property name="nullPosition" value="last"/>
  84. </properties>
  85. </rule>
  86. <rule ref="SlevomatCodingStandard.Variables.UnusedVariable">
  87. <properties>
  88. <property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true"/>
  89. </properties>
  90. </rule>
  91. <!--
  92. PHPCS built-in https://tentyp.dev/library/php/phpcs/
  93. -->
  94. <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
  95. <rule ref="Generic.Classes.DuplicateClassName"/>
  96. <rule ref="Generic.CodeAnalysis.AssignmentInCondition"/>
  97. <rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
  98. <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
  99. <rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
  100. <!--<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>-->
  101. <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
  102. <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
  103. <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
  104. <rule ref="Generic.Commenting.Fixme"/>
  105. <!--<rule ref="Generic.Commenting.Todo"/>-->
  106. <rule ref="Generic.ControlStructures.InlineControlStructure"/>
  107. <rule ref="Generic.Formatting.DisallowMultipleStatements"/>
  108. <!--<rule ref="Generic.Formatting.MultipleStatementAlignment"/>-->
  109. <rule ref="Generic.Formatting.NoSpaceAfterCast"/>
  110. <rule ref="Generic.Functions.CallTimePassByReference"/>
  111. <rule ref="Generic.NamingConventions.InterfaceNameSuffix"/>
  112. <rule ref="Generic.NamingConventions.TraitNameSuffix"/>
  113. <rule ref="Generic.PHP.BacktickOperator"/>
  114. <rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
  115. <rule ref="Generic.PHP.DeprecatedFunctions"/>
  116. <rule ref="Generic.PHP.DisallowAlternativePHPTags"/>
  117. <rule ref="Generic.PHP.DisallowRequestSuperglobal"/>
  118. <rule ref="Generic.PHP.DisallowShortOpenTag"/>
  119. <rule ref="Generic.PHP.DiscourageGoto"/>
  120. <rule ref="Generic.PHP.LowerCaseConstant"/>
  121. <rule ref="Generic.PHP.LowerCaseKeyword"/>
  122. <rule ref="Generic.PHP.LowerCaseType"/>
  123. <rule ref="Generic.PHP.NoSilencedErrors"/>
  124. <!--<rule ref="Generic.PHP.RequireStrictTypes"/>-->
  125. <rule ref="Generic.PHP.SAPIUsage"/>
  126. <rule ref="Generic.PHP.Syntax"/>
  127. <rule ref="Generic.Strings.UnnecessaryStringConcat"/>
  128. <!--<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>-->
  129. <rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
  130. <rule ref="Generic.WhiteSpace.ScopeIndent"/>
  131. <rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/>
  132. <rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
  133. <rule ref="PSR2.Files.ClosingTag"/>
  134. <rule ref="PSR2.Files.EndFileNewline"/>
  135. <rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
  136. <rule ref="PSR12.Classes.AnonClassDeclaration"/>
  137. <rule ref="PSR12.Classes.ClosingBrace"/>
  138. <rule ref="PSR12.Files.OpenTag"/>
  139. <rule ref="PSR12.Functions.NullableTypeDeclaration"/>
  140. <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
  141. <rule ref="Squiz.Classes.DuplicateProperty"/>
  142. <rule ref="Squiz.Classes.LowercaseClassKeywords"/>
  143. <rule ref="Squiz.Classes.SelfMemberReference"/>
  144. <rule ref="Squiz.Commenting.DocCommentAlignment"/>
  145. <rule ref="Squiz.Commenting.EmptyCatchComment"/>
  146. <rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
  147. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
  148. <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
  149. <rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
  150. <rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
  151. <rule ref="Squiz.Formatting.OperatorBracket"/>
  152. <rule ref="Squiz.Functions.FunctionDeclaration"/>
  153. <rule ref="Squiz.Functions.FunctionDuplicateArgument"/>
  154. <rule ref="Squiz.Functions.LowercaseFunctionKeywords"/>
  155. <rule ref="Squiz.Operators.IncrementDecrementUsage"/>
  156. <rule ref="Squiz.Operators.ValidLogicalOperators"/>
  157. <rule ref="Squiz.PHP.DisallowMultipleAssignments"/>
  158. <rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
  159. <rule ref="Squiz.PHP.Eval"/>
  160. <rule ref="Squiz.PHP.InnerFunctions"/>
  161. <rule ref="Squiz.PHP.LowercasePHPFunctions"/>
  162. <rule ref="Squiz.PHP.NonExecutableCode"/>
  163. <rule ref="Squiz.Scope.MemberVarScope"/>
  164. <rule ref="Squiz.Scope.MethodScope"/>
  165. <rule ref="Squiz.Scope.StaticThisUsage"/>
  166. <rule ref="Squiz.Strings.DoubleQuoteUsage"/>
  167. <rule ref="Squiz.Strings.EchoedStrings"/>
  168. <rule ref="Squiz.WhiteSpace.CastSpacing"/>
  169. <rule ref="Squiz.PHP.GlobalKeyword">
  170. <exclude-pattern>examples</exclude-pattern>
  171. </rule>
  172. <rule ref="PSR1.Files.SideEffects">
  173. <exclude-pattern>examples</exclude-pattern>
  174. </rule>
  175. <!--
  176. Configurable built-in https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties
  177. -->
  178. <rule ref="Generic.ControlStructures.InlineControlStructure">
  179. <properties>
  180. <property name="error" value="true"/>
  181. </properties>
  182. </rule>
  183. <rule ref="Generic.Files.LineLength">
  184. <properties>
  185. <property name="lineLimit" value="140" />
  186. <property name="absoluteLineLimit" value="160" />
  187. <property name="ignoreComments" value="true" />
  188. </properties>
  189. <exclude-pattern>examples</exclude-pattern>
  190. </rule>
  191. <rule ref="Generic.Formatting.SpaceAfterNot">
  192. <properties>
  193. <property name="spacing" value="0" />
  194. </properties>
  195. </rule>
  196. <rule ref="Generic.PHP.ForbiddenFunctions">
  197. <properties>
  198. <property name="forbiddenFunctions" type="array">
  199. <element key="die" value="exit"/>
  200. <element key="sizeof" value="count"/>
  201. <element key="delete" value="unset"/>
  202. <element key="print" value="echo"/>
  203. <element key="is_null" value="null"/>
  204. <element key="create_function" value="null"/>
  205. </property>
  206. </properties>
  207. </rule>
  208. <rule ref="Generic.Strings.UnnecessaryStringConcat">
  209. <properties>
  210. <property name="allowMultiline" value="true" />
  211. </properties>
  212. </rule>
  213. <rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing">
  214. <properties>
  215. <property name="ignoreNewlines" value="true" />
  216. </properties>
  217. </rule>
  218. <rule ref="Generic.WhiteSpace.ScopeIndent">
  219. <properties>
  220. <property name="tabIndent" value="true" />
  221. <property name="ignoreIndentationTokens" type="array">
  222. <element value="T_COMMENT"/>
  223. <element value="T_DOC_COMMENT_OPEN_TAG"/>
  224. </property>
  225. </properties>
  226. </rule>
  227. <rule ref="PSR12.ControlStructures.BooleanOperatorPlacement">
  228. <properties>
  229. <property name="allowOnly" value="first" />
  230. </properties>
  231. </rule>
  232. <rule ref="PSR12.Namespaces.CompoundNamespaceDepth">
  233. <properties>
  234. <property name="maxDepth" value="1" />
  235. </properties>
  236. </rule>
  237. <rule ref="Squiz.Strings.ConcatenationSpacing">
  238. <properties>
  239. <property name="ignoreNewlines" value="true" />
  240. </properties>
  241. </rule>
  242. <rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
  243. <properties>
  244. <property name="ignoreNewlines" value="true" />
  245. </properties>
  246. </rule>
  247. <rule ref="Squiz.WhiteSpace.OperatorSpacing">
  248. <properties>
  249. <property name="ignoreNewlines" value="true" />
  250. </properties>
  251. </rule>
  252. <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
  253. <properties>
  254. <property name="ignoreBlankLines" value="true" />
  255. </properties>
  256. </rule>
  257. </ruleset>