phpcs.xml.dist 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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. <config name="installed_paths" value="../../slevomat/coding-standard"/>
  11. <arg value="ps"/>
  12. <arg name="parallel" value="8"/>
  13. <!--<arg name="cache" value=".build/phpcs.cache"/>-->
  14. <arg name="basepath" value="."/>
  15. <arg name="extensions" value="php"/>
  16. <arg name="tab-width" value="4"/>
  17. <rule ref="Internal.Tokenizer.Exception">
  18. <type>error</type>
  19. </rule>
  20. <!--
  21. Slevomat https://github.com/slevomat/coding-standard
  22. -->
  23. <rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
  24. <rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/>
  25. <rule ref="SlevomatCodingStandard.Arrays.DisallowPartiallyKeyed"/>
  26. <rule ref="SlevomatCodingStandard.Attributes.DisallowAttributesJoining"/>
  27. <rule ref="SlevomatCodingStandard.Attributes.DisallowMultipleAttributesPerLine"/>
  28. <rule ref="SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment"/>
  29. <rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
  30. <rule ref="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion"/>
  31. <rule ref="SlevomatCodingStandard.Classes.ForbiddenPublicProperty"/>
  32. <rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
  33. <rule ref="SlevomatCodingStandard.Commenting.DeprecatedAnnotationDeclaration"/>
  34. <rule ref="SlevomatCodingStandard.Commenting.EmptyComment"/>
  35. <rule ref="SlevomatCodingStandard.Commenting.UselessFunctionDocComment"/>
  36. <rule ref="SlevomatCodingStandard.Commenting.UselessInheritDocComment"/>
  37. <rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
  38. <rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch"/>
  39. <rule ref="SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator"/>
  40. <rule ref="SlevomatCodingStandard.ControlStructures.DisallowTrailingMultiLineTernaryOperator"/>
  41. <rule ref="SlevomatCodingStandard.ControlStructures.NewWithoutParentheses"/>
  42. <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator"/>
  43. <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
  44. <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullSafeObjectOperator"/>
  45. <rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/>
  46. <rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator"/>
  47. <rule ref="SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch"/>
  48. <rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction"/>
  49. <rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall"/>
  50. <rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration"/>
  51. <rule ref="SlevomatCodingStandard.Functions.StrictCall"/>
  52. <rule ref="SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile"/>
  53. <rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
  54. <rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
  55. <rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/>
  56. <rule ref="SlevomatCodingStandard.Numbers.DisallowNumericLiteralSeparator"/>
  57. <rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
  58. <rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator"/>
  59. <rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking"/>
  60. <rule ref="SlevomatCodingStandard.PHP.ShortList"/>
  61. <rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
  62. <rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
  63. <rule ref="SlevomatCodingStandard.Strings.DisallowVariableParsing"/>
  64. <!--<rule ref="SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint"/>-->
  65. <rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
  66. <rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
  67. <rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
  68. <rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint"/>
  69. <rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
  70. <!--<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint"/>-->
  71. <rule ref="SlevomatCodingStandard.Variables.DisallowVariableVariable"/>
  72. <rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable"/>
  73. <rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>
  74. <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
  75. <properties>
  76. <property name="linesCountBeforeDeclare" value="0"/>
  77. <property name="linesCountAfterDeclare" value="1"/>
  78. <property name="spacesCountAroundEqualsSign" value="0"/>
  79. </properties>
  80. </rule>
  81. <rule ref="SlevomatCodingStandard.Functions.RequireMultiLineCall">
  82. <properties>
  83. <property name="minLineLength" value="131"/>
  84. </properties>
  85. </rule>
  86. <rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable">
  87. <exclude-pattern>examples</exclude-pattern>
  88. </rule>
  89. <rule ref="SlevomatCodingStandard.TypeHints.DNFTypeHintFormat">
  90. <properties>
  91. <property name="shortNullable" value="no"/>
  92. <property name="nullPosition" value="last"/>
  93. </properties>
  94. </rule>
  95. <rule ref="SlevomatCodingStandard.Variables.UnusedVariable">
  96. <properties>
  97. <property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true"/>
  98. </properties>
  99. </rule>
  100. <!--
  101. PHPCS built-in https://tentyp.dev/library/php/phpcs/
  102. -->
  103. <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
  104. <rule ref="Generic.Classes.DuplicateClassName"/>
  105. <rule ref="Generic.CodeAnalysis.AssignmentInCondition"/>
  106. <rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
  107. <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
  108. <rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
  109. <!--<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>-->
  110. <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
  111. <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
  112. <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
  113. <rule ref="Generic.Commenting.Fixme"/>
  114. <!--<rule ref="Generic.Commenting.Todo"/>-->
  115. <rule ref="Generic.ControlStructures.InlineControlStructure"/>
  116. <rule ref="Generic.Formatting.DisallowMultipleStatements"/>
  117. <!--<rule ref="Generic.Formatting.MultipleStatementAlignment"/>-->
  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.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. <exclude-pattern>benchmark</exclude-pattern>
  181. </rule>
  182. <!--
  183. Configurable built-in https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties
  184. -->
  185. <rule ref="Generic.ControlStructures.InlineControlStructure">
  186. <properties>
  187. <property name="error" value="true"/>
  188. </properties>
  189. </rule>
  190. <rule ref="Generic.Files.LineLength">
  191. <properties>
  192. <property name="lineLimit" value="140" />
  193. <property name="absoluteLineLimit" value="160" />
  194. <property name="ignoreComments" value="true" />
  195. </properties>
  196. <exclude-pattern>examples</exclude-pattern>
  197. </rule>
  198. <rule ref="Generic.Formatting.SpaceAfterCast">
  199. <properties>
  200. <property name="spacing" value="0"/>
  201. </properties>
  202. </rule>
  203. <rule ref="Generic.Formatting.SpaceAfterNot">
  204. <properties>
  205. <property name="spacing" value="0" />
  206. </properties>
  207. </rule>
  208. <rule ref="Generic.PHP.ForbiddenFunctions">
  209. <properties>
  210. <property name="forbiddenFunctions" type="array">
  211. <element key="die" value="exit"/>
  212. <element key="sizeof" value="count"/>
  213. <element key="delete" value="unset"/>
  214. <element key="print" value="echo"/>
  215. <element key="is_null" value="null"/>
  216. <element key="create_function" value="null"/>
  217. </property>
  218. </properties>
  219. </rule>
  220. <rule ref="Generic.Strings.UnnecessaryStringConcat">
  221. <properties>
  222. <property name="allowMultiline" value="true" />
  223. </properties>
  224. </rule>
  225. <rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing">
  226. <properties>
  227. <property name="ignoreNewlines" value="true" />
  228. </properties>
  229. </rule>
  230. <rule ref="Generic.WhiteSpace.ScopeIndent">
  231. <properties>
  232. <property name="tabIndent" value="true" />
  233. <property name="ignoreIndentationTokens" type="array">
  234. <element value="T_COMMENT"/>
  235. <element value="T_DOC_COMMENT_OPEN_TAG"/>
  236. </property>
  237. </properties>
  238. </rule>
  239. <rule ref="PSR12.ControlStructures.BooleanOperatorPlacement">
  240. <properties>
  241. <property name="allowOnly" value="first" />
  242. </properties>
  243. </rule>
  244. <rule ref="PSR12.Namespaces.CompoundNamespaceDepth">
  245. <properties>
  246. <property name="maxDepth" value="1" />
  247. </properties>
  248. </rule>
  249. <rule ref="Squiz.Strings.ConcatenationSpacing">
  250. <properties>
  251. <property name="ignoreNewlines" value="true" />
  252. </properties>
  253. </rule>
  254. <rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
  255. <properties>
  256. <property name="ignoreNewlines" value="true" />
  257. </properties>
  258. </rule>
  259. <rule ref="Squiz.WhiteSpace.OperatorSpacing">
  260. <properties>
  261. <property name="ignoreNewlines" value="true" />
  262. </properties>
  263. </rule>
  264. <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
  265. <properties>
  266. <property name="ignoreBlankLines" value="true" />
  267. </properties>
  268. </rule>
  269. </ruleset>