sdc-build-wp 4.1.0 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/composer.json +2 -3
  2. package/composer.lock +3 -313
  3. package/index.js +38 -21
  4. package/lib/blocks.js +8 -6
  5. package/lib/style.js +17 -0
  6. package/package.json +1 -1
  7. package/vendor/composer/autoload_classmap.php +0 -37
  8. package/vendor/composer/autoload_psr4.php +0 -1
  9. package/vendor/composer/autoload_real.php +2 -0
  10. package/vendor/composer/autoload_static.php +0 -53
  11. package/vendor/composer/installed.json +1 -329
  12. package/vendor/composer/installed.php +3 -39
  13. package/vendor/composer/platform_check.php +26 -0
  14. package/lib/bustCache.js +0 -14
  15. package/vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md +0 -22
  16. package/vendor/dealerdirect/phpcodesniffer-composer-installer/README.md +0 -285
  17. package/vendor/dealerdirect/phpcodesniffer-composer-installer/composer.json +0 -71
  18. package/vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php +0 -637
  19. package/vendor/phpcsstandards/phpcsextra/CHANGELOG.md +0 -590
  20. package/vendor/phpcsstandards/phpcsextra/LICENSE +0 -165
  21. package/vendor/phpcsstandards/phpcsextra/Modernize/Docs/FunctionCalls/DirnameStandard.xml +0 -40
  22. package/vendor/phpcsstandards/phpcsextra/Modernize/Sniffs/FunctionCalls/DirnameSniff.php +0 -382
  23. package/vendor/phpcsstandards/phpcsextra/Modernize/ruleset.xml +0 -5
  24. package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/ArrayBraceSpacingStandard.xml +0 -94
  25. package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/CommaAfterLastStandard.xml +0 -43
  26. package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/ArrayBraceSpacingSniff.php +0 -305
  27. package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/CommaAfterLastSniff.php +0 -226
  28. package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/ruleset.xml +0 -5
  29. package/vendor/phpcsstandards/phpcsextra/README.md +0 -573
  30. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DisallowShortArraySyntaxStandard.xml +0 -27
  31. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DuplicateArrayKeyStandard.xml +0 -44
  32. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedArrayKeyTypesStandard.xml +0 -40
  33. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedKeyedUnkeyedArrayStandard.xml +0 -31
  34. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowAnonClassParenthesesStandard.xml +0 -24
  35. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowFinalClassStandard.xml +0 -25
  36. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/ModifierKeywordOrderStandard.xml +0 -27
  37. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireAnonClassParenthesesStandard.xml +0 -23
  38. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireFinalClassStandard.xml +0 -25
  39. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ConstructorDestructorReturnStandard.xml +0 -64
  40. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ForeachUniqueAssignmentStandard.xml +0 -26
  41. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoDoubleNegativeStandard.xml +0 -27
  42. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoEchoSprintfStandard.xml +0 -25
  43. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/StaticInFinalClassStandard.xml +0 -43
  44. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/LowercaseClassResolutionKeywordStandard.xml +0 -23
  45. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/ModifierKeywordOrderStandard.xml +0 -30
  46. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/UppercaseMagicConstantsStandard.xml +0 -25
  47. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowAlternativeSyntaxStandard.xml +0 -35
  48. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowLonelyIfStandard.xml +0 -49
  49. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/IfElseDeclarationStandard.xml +0 -37
  50. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Files/SeparateFunctionsFromOOStandard.xml +0 -45
  51. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/NoLongClosuresStandard.xml +0 -42
  52. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/RequireFinalMethodsInTraitsStandard.xml +0 -33
  53. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowLongListSyntaxStandard.xml +0 -23
  54. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowShortListSyntaxStandard.xml +0 -23
  55. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowCurlyBraceSyntaxStandard.xml +0 -27
  56. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowDeclarationWithoutNameStandard.xml +0 -25
  57. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/EnforceCurlyBraceSyntaxStandard.xml +0 -27
  58. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/OneDeclarationPerFileStandard.xml +0 -27
  59. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/NamingConventions/NoReservedKeywordParameterNamesStandard.xml +0 -23
  60. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/OOStructures/AlphabeticExtendsImplementsStandard.xml +0 -27
  61. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/ConcatPositionStandard.xml +0 -31
  62. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowLogicalAndOrStandard.xml +0 -30
  63. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowShortTernaryStandard.xml +0 -26
  64. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowStandalonePostIncrementDecrementStandard.xml +0 -44
  65. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/StrictComparisonsStandard.xml +0 -29
  66. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/TypeSeparatorSpacingStandard.xml +0 -33
  67. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/LowercasePHPTagStandard.xml +0 -25
  68. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/OneStatementInShortEchoTagStandard.xml +0 -41
  69. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowMixedGroupUseStandard.xml +0 -39
  70. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseClassStandard.xml +0 -25
  71. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseConstStandard.xml +0 -25
  72. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseFunctionStandard.xml +0 -25
  73. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/KeywordSpacingStandard.xml +0 -29
  74. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/LowercaseFunctionConstStandard.xml +0 -25
  75. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoLeadingBackslashStandard.xml +0 -23
  76. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoUselessAliasesStandard.xml +0 -30
  77. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/AnonClassKeywordSpacingStandard.xml +0 -31
  78. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/CommaSpacingStandard.xml +0 -94
  79. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/DisallowInlineTabsStandard.xml +0 -25
  80. package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/PrecisionAlignmentStandard.xml +0 -29
  81. package/vendor/phpcsstandards/phpcsextra/Universal/Helpers/DummyTokenizer.php +0 -60
  82. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php +0 -89
  83. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DuplicateArrayKeySniff.php +0 -297
  84. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedArrayKeyTypesSniff.php +0 -174
  85. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedKeyedUnkeyedArraySniff.php +0 -134
  86. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowAnonClassParenthesesSniff.php +0 -112
  87. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowFinalClassSniff.php +0 -116
  88. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/ModifierKeywordOrderSniff.php +0 -188
  89. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireAnonClassParenthesesSniff.php +0 -81
  90. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireFinalClassSniff.php +0 -102
  91. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ConstructorDestructorReturnSniff.php +0 -211
  92. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ForeachUniqueAssignmentSniff.php +0 -153
  93. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoDoubleNegativeSniff.php +0 -269
  94. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoEchoSprintfSniff.php +0 -131
  95. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/StaticInFinalClassSniff.php +0 -216
  96. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/LowercaseClassResolutionKeywordSniff.php +0 -106
  97. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/ModifierKeywordOrderSniff.php +0 -199
  98. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/UppercaseMagicConstantsSniff.php +0 -89
  99. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowAlternativeSyntaxSniff.php +0 -216
  100. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowLonelyIfSniff.php +0 -348
  101. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/IfElseDeclarationSniff.php +0 -164
  102. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Files/SeparateFunctionsFromOOSniff.php +0 -190
  103. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/NoLongClosuresSniff.php +0 -233
  104. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/RequireFinalMethodsInTraitsSniff.php +0 -120
  105. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowLongListSyntaxSniff.php +0 -71
  106. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowShortListSyntaxSniff.php +0 -86
  107. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowCurlyBraceSyntaxSniff.php +0 -81
  108. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowDeclarationWithoutNameSniff.php +0 -80
  109. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/EnforceCurlyBraceSyntaxSniff.php +0 -81
  110. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/OneDeclarationPerFileSniff.php +0 -96
  111. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/NamingConventions/NoReservedKeywordParameterNamesSniff.php +0 -190
  112. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/OOStructures/AlphabeticExtendsImplementsSniff.php +0 -275
  113. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/ConcatPositionSniff.php +0 -204
  114. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowLogicalAndOrSniff.php +0 -112
  115. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowShortTernarySniff.php +0 -76
  116. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowStandalonePostIncrementDecrementSniff.php +0 -197
  117. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/StrictComparisonsSniff.php +0 -116
  118. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/TypeSeparatorSpacingSniff.php +0 -85
  119. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/LowercasePHPTagSniff.php +0 -87
  120. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/OneStatementInShortEchoTagSniff.php +0 -101
  121. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowMixedGroupUseSniff.php +0 -248
  122. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseClassSniff.php +0 -211
  123. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseConstSniff.php +0 -211
  124. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseFunctionSniff.php +0 -211
  125. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/KeywordSpacingSniff.php +0 -207
  126. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/LowercaseFunctionConstSniff.php +0 -156
  127. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoLeadingBackslashSniff.php +0 -170
  128. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoUselessAliasesSniff.php +0 -155
  129. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/AnonClassKeywordSpacingSniff.php +0 -79
  130. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/CommaSpacingSniff.php +0 -408
  131. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/DisallowInlineTabsSniff.php +0 -173
  132. package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php +0 -445
  133. package/vendor/phpcsstandards/phpcsextra/Universal/ruleset.xml +0 -5
  134. package/vendor/phpcsstandards/phpcsextra/composer.json +0 -69
  135. package/vendor/phpcsstandards/phpcsutils/.phpdoc.xml.dist +0 -36
  136. package/vendor/phpcsstandards/phpcsutils/CHANGELOG.md +0 -1106
  137. package/vendor/phpcsstandards/phpcsutils/LICENSE +0 -165
  138. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php +0 -551
  139. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php +0 -781
  140. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php +0 -123
  141. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/Helper.php +0 -202
  142. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/InvalidTokenArray.php +0 -44
  143. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestFileNotFound.php +0 -47
  144. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestMarkerNotFound.php +0 -43
  145. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestTargetNotFound.php +0 -50
  146. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Fixers/SpacesFixer.php +0 -246
  147. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/Cache.php +0 -218
  148. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/IsShortArrayOrList.php +0 -687
  149. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/IsShortArrayOrListWithCache.php +0 -269
  150. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/NoFileCache.php +0 -164
  151. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/StableCollections.php +0 -75
  152. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/UtilityMethodTestCase.php +0 -459
  153. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/Collections.php +0 -837
  154. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/TokenHelper.php +0 -55
  155. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Arrays.php +0 -227
  156. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Conditions.php +0 -156
  157. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Context.php +0 -232
  158. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ControlStructures.php +0 -276
  159. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/FunctionDeclarations.php +0 -828
  160. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/GetTokensAsString.php +0 -262
  161. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Lists.php +0 -359
  162. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/MessageHelper.php +0 -145
  163. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Namespaces.php +0 -389
  164. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/NamingConventions.php +0 -116
  165. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Numbers.php +0 -322
  166. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ObjectDeclarations.php +0 -359
  167. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Operators.php +0 -252
  168. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Orthography.php +0 -120
  169. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Parentheses.php +0 -419
  170. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/PassedParameters.php +0 -510
  171. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Scopes.php +0 -143
  172. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/TextStrings.php +0 -331
  173. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/UseStatements.php +0 -432
  174. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Variables.php +0 -333
  175. package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/ruleset.xml +0 -4
  176. package/vendor/phpcsstandards/phpcsutils/README.md +0 -297
  177. package/vendor/phpcsstandards/phpcsutils/composer.json +0 -92
  178. package/vendor/phpcsstandards/phpcsutils/phpcsutils-autoload.php +0 -68
  179. package/vendor/wp-coding-standards/wpcs/CHANGELOG.md +0 -1654
  180. package/vendor/wp-coding-standards/wpcs/LICENSE +0 -21
  181. package/vendor/wp-coding-standards/wpcs/README.md +0 -261
  182. package/vendor/wp-coding-standards/wpcs/WordPress/AbstractArrayAssignmentRestrictionsSniff.php +0 -261
  183. package/vendor/wp-coding-standards/wpcs/WordPress/AbstractClassRestrictionsSniff.php +0 -257
  184. package/vendor/wp-coding-standards/wpcs/WordPress/AbstractFunctionParameterSniff.php +0 -111
  185. package/vendor/wp-coding-standards/wpcs/WordPress/AbstractFunctionRestrictionsSniff.php +0 -358
  186. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/ArrayIndentationStandard.xml +0 -116
  187. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/ArrayKeySpacingRestrictionsStandard.xml +0 -31
  188. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/MultipleStatementAlignmentStandard.xml +0 -50
  189. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/CodeAnalysis/EscapedNotTranslatedStandard.xml +0 -24
  190. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/DateTime/CurrentTimeTimestampStandard.xml +0 -35
  191. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/DateTime/RestrictedFunctionsStandard.xml +0 -54
  192. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/PrefixAllGlobalsStandard.xml +0 -119
  193. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/ValidHookNameStandard.xml +0 -35
  194. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/ValidPostTypeSlugStandard.xml +0 -121
  195. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/PHP/IniSetStandard.xml +0 -40
  196. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/PHP/StrictInArrayStandard.xml +0 -53
  197. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/PHP/YodaConditionsStandard.xml +0 -27
  198. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Security/SafeRedirectStandard.xml +0 -23
  199. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/CapabilitiesStandard.xml +0 -69
  200. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/CapitalPDangitStandard.xml +0 -43
  201. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/ClassNameCaseStandard.xml +0 -23
  202. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/CronIntervalStandard.xml +0 -45
  203. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedClassesStandard.xml +0 -23
  204. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedFunctionsStandard.xml +0 -23
  205. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedParameterValuesStandard.xml +0 -23
  206. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedParametersStandard.xml +0 -40
  207. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/EnqueuedResourceParametersStandard.xml +0 -92
  208. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/EnqueuedResourcesStandard.xml +0 -57
  209. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/PostsPerPageStandard.xml +0 -73
  210. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/CastStructureSpacingStandard.xml +0 -27
  211. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/ControlStructureSpacingStandard.xml +0 -150
  212. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/ObjectOperatorSpacingStandard.xml +0 -19
  213. package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +0 -61
  214. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ArrayWalkingFunctionsHelper.php +0 -108
  215. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ConstantsHelper.php +0 -135
  216. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ContextHelper.php +0 -394
  217. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/DeprecationHelper.php +0 -84
  218. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/EscapingFunctionsTrait.php +0 -256
  219. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/FormattingFunctionsHelper.php +0 -60
  220. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/IsUnitTestTrait.php +0 -238
  221. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ListHelper.php +0 -101
  222. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/MinimumWPVersionTrait.php +0 -159
  223. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/PrintingFunctionsTrait.php +0 -122
  224. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/RulesetPropertyHelper.php +0 -73
  225. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/SanitizationHelperTrait.php +0 -418
  226. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/SnakeCaseHelper.php +0 -60
  227. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/UnslashingFunctionsHelper.php +0 -59
  228. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ValidationHelper.php +0 -349
  229. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/VariableHelper.php +0 -262
  230. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/WPDBTrait.php +0 -115
  231. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/WPGlobalVariablesHelper.php +0 -312
  232. package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/WPHookHelper.php +0 -113
  233. package/vendor/wp-coding-standards/wpcs/WordPress/Sniff.php +0 -72
  234. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/ArrayDeclarationSpacingSniff.php +0 -252
  235. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/ArrayIndentationSniff.php +0 -550
  236. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/ArrayKeySpacingRestrictionsSniff.php +0 -174
  237. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/MultipleStatementAlignmentSniff.php +0 -583
  238. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/CodeAnalysis/AssignmentInTernaryConditionSniff.php +0 -173
  239. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/CodeAnalysis/EscapedNotTranslatedSniff.php +0 -89
  240. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/DirectDatabaseQuerySniff.php +0 -301
  241. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/PreparedSQLPlaceholdersSniff.php +0 -761
  242. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/PreparedSQLSniff.php +0 -242
  243. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/RestrictedClassesSniff.php +0 -57
  244. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/RestrictedFunctionsSniff.php +0 -63
  245. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/SlowDBQuerySniff.php +0 -58
  246. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DateTime/CurrentTimeTimestampSniff.php +0 -168
  247. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DateTime/RestrictedFunctionsSniff.php +0 -59
  248. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Files/FileNameSniff.php +0 -313
  249. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php +0 -1297
  250. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidFunctionNameSniff.php +0 -188
  251. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidHookNameSniff.php +0 -277
  252. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidPostTypeSlugSniff.php +0 -230
  253. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidVariableNameSniff.php +0 -289
  254. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/DevelopmentFunctionsSniff.php +0 -63
  255. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/DiscouragedPHPFunctionsSniff.php +0 -100
  256. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/DontExtractSniff.php +0 -52
  257. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/IniSetSniff.php +0 -193
  258. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/NoSilencedErrorsSniff.php +0 -245
  259. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/POSIXFunctionsSniff.php +0 -73
  260. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/PregQuoteDelimiterSniff.php +0 -70
  261. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/RestrictedPHPFunctionsSniff.php +0 -45
  262. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/StrictInArraySniff.php +0 -122
  263. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/TypeCastsSniff.php +0 -90
  264. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/YodaConditionsSniff.php +0 -124
  265. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/EscapeOutputSniff.php +0 -903
  266. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/NonceVerificationSniff.php +0 -422
  267. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/PluginMenuSlugSniff.php +0 -126
  268. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/SafeRedirectSniff.php +0 -45
  269. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/ValidatedSanitizedInputSniff.php +0 -244
  270. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php +0 -862
  271. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/AlternativeFunctionsSniff.php +0 -371
  272. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/CapabilitiesSniff.php +0 -478
  273. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/CapitalPDangitSniff.php +0 -315
  274. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/ClassNameCaseSniff.php +0 -897
  275. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/CronIntervalSniff.php +0 -321
  276. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedClassesSniff.php +0 -152
  277. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedFunctionsSniff.php +0 -1708
  278. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedParameterValuesSniff.php +0 -291
  279. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedParametersSniff.php +0 -509
  280. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DiscouragedConstantsSniff.php +0 -160
  281. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DiscouragedFunctionsSniff.php +0 -54
  282. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/EnqueuedResourceParametersSniff.php +0 -241
  283. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/EnqueuedResourcesSniff.php +0 -108
  284. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/GlobalVariablesOverrideSniff.php +0 -436
  285. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/I18nSniff.php +0 -977
  286. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/PostsPerPageSniff.php +0 -102
  287. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/CastStructureSpacingSniff.php +0 -59
  288. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php +0 -486
  289. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/ObjectOperatorSpacingSniff.php +0 -63
  290. package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/OperatorSpacingSniff.php +0 -60
  291. package/vendor/wp-coding-standards/wpcs/WordPress/ruleset.xml +0 -13
  292. package/vendor/wp-coding-standards/wpcs/WordPress-Core/ruleset.xml +0 -948
  293. package/vendor/wp-coding-standards/wpcs/WordPress-Docs/ruleset.xml +0 -109
  294. package/vendor/wp-coding-standards/wpcs/WordPress-Extra/ruleset.xml +0 -199
  295. package/vendor/wp-coding-standards/wpcs/composer.json +0 -88
  296. package/vendor/wp-coding-standards/wpcs/phpcs.xml.dist.sample +0 -153
@@ -1,164 +0,0 @@
1
- <?php
2
- /**
3
- * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer.
4
- *
5
- * @package PHPCSExtra
6
- * @copyright 2020 PHPCSExtra Contributors
7
- * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
- * @link https://github.com/PHPCSStandards/PHPCSExtra
9
- */
10
-
11
- namespace PHPCSExtra\Universal\Sniffs\ControlStructures;
12
-
13
- use PHP_CodeSniffer\Files\File;
14
- use PHP_CodeSniffer\Sniffs\Sniff;
15
- use PHP_CodeSniffer\Util\Tokens;
16
-
17
- /**
18
- * Verifies that `else(if)` statements with braces are on a new line.
19
- *
20
- * Sister-sniff to the following two PHPCS native sniffs which each demand that `else[]if` is on the
21
- * same line as the closing curly of the preceding `(else)if`:
22
- * - `PEAR.ControlStructures.ControlSignature[.Found]`
23
- * - `Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace`
24
- *
25
- * Other related sniffs:
26
- * - `Squiz.ControlStructures.ElseIfDeclaration` Forbids the use of "elseif", demands "else if".
27
- * - `PSR2.ControlStructures.ElseIfDeclaration` Forbids the use of "else if", demands "elseif".
28
- *
29
- * @since 1.0.0
30
- */
31
- final class IfElseDeclarationSniff implements Sniff
32
- {
33
-
34
- /**
35
- * Name of the metric.
36
- *
37
- * @since 1.0.0
38
- *
39
- * @var string
40
- */
41
- const METRIC_NAME = 'Else(if) on a new line';
42
-
43
- /**
44
- * Returns an array of tokens this test wants to listen for.
45
- *
46
- * @since 1.0.0
47
- *
48
- * @return array<int|string>
49
- */
50
- public function register()
51
- {
52
- return [
53
- \T_ELSE,
54
- \T_ELSEIF,
55
- ];
56
- }
57
-
58
- /**
59
- * Processes this test, when one of its tokens is encountered.
60
- *
61
- * @since 1.0.0
62
- *
63
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
64
- * @param int $stackPtr The position of the current token
65
- * in the stack passed in $tokens.
66
- *
67
- * @return void
68
- */
69
- public function process(File $phpcsFile, $stackPtr)
70
- {
71
- $tokens = $phpcsFile->getTokens();
72
-
73
- /*
74
- * Check for control structures without braces and alternative syntax.
75
- */
76
- $scopePtr = $stackPtr;
77
- if (isset($tokens[$stackPtr]['scope_opener']) === false) {
78
- // Deal with "else if".
79
- $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
80
- if ($tokens[$next]['code'] === \T_IF) {
81
- $scopePtr = $next;
82
- }
83
- }
84
-
85
- if (isset($tokens[$scopePtr]['scope_opener']) === false
86
- || $tokens[$tokens[$scopePtr]['scope_opener']]['code'] === \T_COLON
87
- ) {
88
- // No scope opener found or alternative syntax (not our concern).
89
- return;
90
- }
91
-
92
- /*
93
- * Check whether the else(if) is on a new line.
94
- */
95
- $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
96
- if ($prevNonEmpty === false || $tokens[$prevNonEmpty]['code'] !== \T_CLOSE_CURLY_BRACKET) {
97
- // Parse error or mixing braced and non-braced. Not our concern.
98
- return;
99
- }
100
-
101
- if ($tokens[$prevNonEmpty]['line'] !== $tokens[$stackPtr]['line']) {
102
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'yes');
103
- return;
104
- }
105
-
106
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'no');
107
-
108
- $errorBase = \strtoupper($tokens[$stackPtr]['content']);
109
- $error = $errorBase . ' statement must be on a new line.';
110
-
111
- $prevNonWhitespace = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
112
-
113
- if ($prevNonWhitespace !== $prevNonEmpty) {
114
- // Comment found between previous scope closer and the keyword.
115
- $fix = $phpcsFile->addError($error, $stackPtr, 'NoNewLine');
116
- return;
117
- }
118
-
119
- $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NoNewLine');
120
- if ($fix === false) {
121
- return;
122
- }
123
-
124
- /*
125
- * Fix it.
126
- */
127
-
128
- // Figure out the indentation for the else(if).
129
- $indentBase = $prevNonEmpty;
130
- if (isset($tokens[$prevNonEmpty]['scope_condition']) === true
131
- && ($tokens[$tokens[$prevNonEmpty]['scope_condition']]['column'] === 1
132
- || ($tokens[($tokens[$prevNonEmpty]['scope_condition'] - 1)]['code'] === \T_WHITESPACE
133
- && $tokens[($tokens[$prevNonEmpty]['scope_condition'] - 1)]['column'] === 1))
134
- ) {
135
- // Base the indentation off the previous if/elseif if on a line by itself.
136
- $indentBase = $tokens[$prevNonEmpty]['scope_condition'];
137
- }
138
-
139
- $indent = '';
140
- $firstOnIndentLine = $indentBase;
141
- if ($tokens[$firstOnIndentLine]['column'] !== 1) {
142
- while (isset($tokens[($firstOnIndentLine - 1)]) && $tokens[--$firstOnIndentLine]['column'] !== 1);
143
-
144
- if ($tokens[$firstOnIndentLine]['code'] === \T_WHITESPACE) {
145
- $indent = $tokens[$firstOnIndentLine]['content'];
146
-
147
- // If tabs were replaced, use the original content.
148
- if (isset($tokens[$firstOnIndentLine]['orig_content']) === true) {
149
- $indent = $tokens[$firstOnIndentLine]['orig_content'];
150
- }
151
- }
152
- }
153
-
154
- $phpcsFile->fixer->beginChangeset();
155
-
156
- // Remove any whitespace between the previous scope closer and the else(if).
157
- for ($i = ($prevNonEmpty + 1); $i < $stackPtr; $i++) {
158
- $phpcsFile->fixer->replaceToken($i, '');
159
- }
160
-
161
- $phpcsFile->fixer->addContent($prevNonEmpty, $phpcsFile->eolChar . $indent);
162
- $phpcsFile->fixer->endChangeset();
163
- }
164
- }
@@ -1,190 +0,0 @@
1
- <?php
2
- /**
3
- * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer.
4
- *
5
- * @package PHPCSExtra
6
- * @copyright 2020 PHPCSExtra Contributors
7
- * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
- * @link https://github.com/PHPCSStandards/PHPCSExtra
9
- */
10
-
11
- namespace PHPCSExtra\Universal\Sniffs\Files;
12
-
13
- use PHP_CodeSniffer\Files\File;
14
- use PHP_CodeSniffer\Sniffs\Sniff;
15
- use PHP_CodeSniffer\Util\Tokens;
16
- use PHPCSUtils\Tokens\Collections;
17
-
18
- /**
19
- * A file should either declare (global/namespaced) functions or declare OO structures, but not both.
20
- *
21
- * Nested function declarations, i.e. functions declared within a function/method will be disregarded
22
- * for the purposes of this sniff.
23
- * The same goes for anonymous classes, closures and arrow functions.
24
- *
25
- * Notes:
26
- * - This sniff has no opinion on side effects. If you want to sniff for those, use the PHPCS
27
- * native `PSR1.Files.SideEffects` sniff.
28
- * - This sniff has no opinion on multiple OO structures being declared in one file.
29
- * If you want to sniff for that, use the PHPCS native `Generic.Files.OneObjectStructurePerFile` sniff.
30
- *
31
- * @since 1.0.0
32
- */
33
- final class SeparateFunctionsFromOOSniff implements Sniff
34
- {
35
-
36
- /**
37
- * Name of the metric.
38
- *
39
- * @since 1.0.0
40
- *
41
- * @var string
42
- */
43
- const METRIC_NAME = 'Functions or OO declarations ?';
44
-
45
- /**
46
- * Tokens this sniff searches for.
47
- *
48
- * Enhanced from within the register() methods.
49
- *
50
- * @since 1.0.0
51
- *
52
- * @var array<int|string>
53
- */
54
- private $search = [
55
- // Some tokens to help skip over structures we're not interested in.
56
- \T_START_HEREDOC => \T_START_HEREDOC,
57
- \T_START_NOWDOC => \T_START_NOWDOC,
58
- ];
59
-
60
- /**
61
- * Returns an array of tokens this test wants to listen for.
62
- *
63
- * @since 1.0.0
64
- *
65
- * @return array<int|string>
66
- */
67
- public function register()
68
- {
69
- $this->search += Tokens::$ooScopeTokens;
70
- $this->search += Collections::functionDeclarationTokens();
71
-
72
- return Collections::phpOpenTags();
73
- }
74
-
75
- /**
76
- * Processes this test, when one of its tokens is encountered.
77
- *
78
- * @since 1.0.0
79
- *
80
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
81
- * @param int $stackPtr The position of the current token
82
- * in the stack passed in $tokens.
83
- *
84
- * @return int|void Integer stack pointer to skip forward or void to continue
85
- * normal file processing.
86
- */
87
- public function process(File $phpcsFile, $stackPtr)
88
- {
89
- $tokens = $phpcsFile->getTokens();
90
-
91
- $firstOO = null;
92
- $firstFunction = null;
93
- $functionCount = 0;
94
- $OOCount = 0;
95
-
96
- for ($i = 0; $i < $phpcsFile->numTokens; $i++) {
97
- // Ignore anything within square brackets.
98
- if ($tokens[$i]['code'] !== \T_OPEN_CURLY_BRACKET
99
- && isset($tokens[$i]['bracket_opener'], $tokens[$i]['bracket_closer'])
100
- && $i === $tokens[$i]['bracket_opener']
101
- ) {
102
- $i = $tokens[$i]['bracket_closer'];
103
- continue;
104
- }
105
-
106
- // Skip past nested arrays, function calls and arbitrary groupings.
107
- if ($tokens[$i]['code'] === \T_OPEN_PARENTHESIS
108
- && isset($tokens[$i]['parenthesis_closer'])
109
- ) {
110
- $i = $tokens[$i]['parenthesis_closer'];
111
- continue;
112
- }
113
-
114
- // Skip over potentially large docblocks.
115
- if ($tokens[$i]['code'] === \T_DOC_COMMENT_OPEN_TAG
116
- && isset($tokens[$i]['comment_closer'])
117
- ) {
118
- $i = $tokens[$i]['comment_closer'];
119
- continue;
120
- }
121
-
122
- // Ignore everything else we're not interested in.
123
- if (isset($this->search[$tokens[$i]['code']]) === false) {
124
- continue;
125
- }
126
-
127
- // Skip over structures which won't contain anything we're interested in.
128
- if (($tokens[$i]['code'] === \T_START_HEREDOC
129
- || $tokens[$i]['code'] === \T_START_NOWDOC
130
- || $tokens[$i]['code'] === \T_ANON_CLASS
131
- || $tokens[$i]['code'] === \T_CLOSURE
132
- || $tokens[$i]['code'] === \T_FN)
133
- && isset($tokens[$i]['scope_condition'], $tokens[$i]['scope_closer'])
134
- && $tokens[$i]['scope_condition'] === $i
135
- ) {
136
- $i = $tokens[$i]['scope_closer'];
137
- continue;
138
- }
139
-
140
- // This will be either a function declaration or an OO declaration token.
141
- if ($tokens[$i]['code'] === \T_FUNCTION) {
142
- if (isset($firstFunction) === false) {
143
- $firstFunction = $i;
144
- }
145
-
146
- ++$functionCount;
147
- } else {
148
- if (isset($firstOO) === false) {
149
- $firstOO = $i;
150
- }
151
-
152
- ++$OOCount;
153
- }
154
-
155
- if (isset($tokens[$i]['scope_closer']) === true) {
156
- $i = $tokens[$i]['scope_closer'];
157
- }
158
- }
159
-
160
- if ($functionCount > 0 && $OOCount > 0) {
161
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'Both function and OO declarations');
162
-
163
- $reportToken = \max($firstFunction, $firstOO);
164
-
165
- $phpcsFile->addError(
166
- 'A file should either contain function declarations or OO structure declarations, but not both.'
167
- . ' Found %d function declaration(s) and %d OO structure declaration(s).'
168
- . ' The first function declaration was found on line %d;'
169
- . ' the first OO declaration was found on line %d',
170
- $reportToken,
171
- 'Mixed',
172
- [
173
- $functionCount,
174
- $OOCount,
175
- $tokens[$firstFunction]['line'],
176
- $tokens[$firstOO]['line'],
177
- ]
178
- );
179
- } elseif ($functionCount > 0) {
180
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'Only function(s)');
181
- } elseif ($OOCount > 0) {
182
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'Only OO structure(s)');
183
- } else {
184
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'Neither');
185
- }
186
-
187
- // Ignore the rest of the file.
188
- return ($phpcsFile->numTokens + 1);
189
- }
190
- }
@@ -1,233 +0,0 @@
1
- <?php
2
- /**
3
- * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer.
4
- *
5
- * @package PHPCSExtra
6
- * @copyright 2020 PHPCSExtra Contributors
7
- * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
- * @link https://github.com/PHPCSStandards/PHPCSExtra
9
- */
10
-
11
- namespace PHPCSExtra\Universal\Sniffs\FunctionDeclarations;
12
-
13
- use PHP_CodeSniffer\Files\File;
14
- use PHP_CodeSniffer\Sniffs\Sniff;
15
- use PHP_CodeSniffer\Util\Tokens;
16
-
17
- /**
18
- * Forbids long closures.
19
- *
20
- * @since 1.1.0
21
- */
22
- final class NoLongClosuresSniff implements Sniff
23
- {
24
-
25
- /**
26
- * Name of the metric.
27
- *
28
- * @since 1.1.0
29
- *
30
- * @var string
31
- */
32
- const METRIC_NAME_CODE = 'Closure length (code only)';
33
-
34
- /**
35
- * Name of the metric.
36
- *
37
- * @since 1.1.0
38
- *
39
- * @var string
40
- */
41
- const METRIC_NAME_COMMENTS = 'Closure length (code + comments)';
42
-
43
- /**
44
- * Name of the metric.
45
- *
46
- * @since 1.1.0
47
- *
48
- * @var string
49
- */
50
- const METRIC_NAME_ALL = 'Closure length (code + comments + blank lines)';
51
-
52
- /**
53
- * Maximum number of lines allowed before a closure is considered a "long" closure.
54
- *
55
- * Defaults to 5 lines, i.e. when a closure contains 6 lines, a warning will be thrown.
56
- *
57
- * @since 1.1.0
58
- *
59
- * @var int
60
- */
61
- public $recommendedLines = 5;
62
-
63
- /**
64
- * Maximum number of lines allowed before a closure is considered a "long" closure.
65
- *
66
- * Defaults to 8 lines, i.e. when a closure contains 9 lines, an error will be thrown.
67
- *
68
- * @since 1.1.0
69
- *
70
- * @var int
71
- */
72
- public $maxLines = 8;
73
-
74
- /**
75
- * Whether or not to exclude lines which only contain documentation in the line count.
76
- *
77
- * Defaults to `true`.
78
- *
79
- * @since 1.1.0
80
- *
81
- * @var bool
82
- */
83
- public $ignoreCommentLines = true;
84
-
85
- /**
86
- * Whether or not to exclude empty lines from the line count.
87
- *
88
- * Defaults to `true`.
89
- *
90
- * @since 1.1.0
91
- *
92
- * @var bool
93
- */
94
- public $ignoreEmptyLines = true;
95
-
96
- /**
97
- * Returns an array of tokens this test wants to listen for.
98
- *
99
- * @since 1.1.0
100
- *
101
- * @return array<int|string>
102
- */
103
- public function register()
104
- {
105
- return [\T_CLOSURE];
106
- }
107
-
108
- /**
109
- * Processes this test, when one of its tokens is encountered.
110
- *
111
- * @since 1.1.0
112
- *
113
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
114
- * @param int $stackPtr The position of the current token
115
- * in the stack passed in $tokens.
116
- *
117
- * @return void
118
- */
119
- public function process(File $phpcsFile, $stackPtr)
120
- {
121
- $this->recommendedLines = (int) $this->recommendedLines;
122
- $this->maxLines = (int) $this->maxLines;
123
-
124
- $tokens = $phpcsFile->getTokens();
125
-
126
- if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) {
127
- // Live coding/parse error. Shouldn't be possible as in that case tokenizer won't retokenize to T_CLOSURE.
128
- return; // @codeCoverageIgnore
129
- }
130
-
131
- $opener = $tokens[$stackPtr]['scope_opener'];
132
- $closer = $tokens[$stackPtr]['scope_closer'];
133
-
134
- $currentLine = $tokens[$opener]['line'];
135
- $closerLine = $tokens[$closer]['line'];
136
-
137
- $codeLines = 0;
138
- $commentLines = 0;
139
- $blankLines = 0;
140
-
141
- // Check whether the line of the scope opener needs to be counted, but ignore trailing comments on that line.
142
- $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($opener + 1), $closer, true);
143
- if ($firstNonEmpty !== false && $tokens[$firstNonEmpty]['line'] === $currentLine) {
144
- ++$codeLines;
145
- }
146
-
147
- // Check whether the line of the scope closer needs to be counted.
148
- if ($closerLine !== $currentLine) {
149
- $hasCommentTokens = false;
150
- $hasCodeTokens = false;
151
- for ($i = ($closer - 1); $tokens[$i]['line'] === $closerLine && $i > $opener; $i--) {
152
- if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === false) {
153
- $hasCodeTokens = true;
154
- } elseif (isset(Tokens::$commentTokens[$tokens[$i]['code']]) === true) {
155
- $hasCommentTokens = true;
156
- }
157
- }
158
-
159
- if ($hasCodeTokens === true) {
160
- ++$codeLines;
161
- } elseif ($hasCommentTokens === true) {
162
- ++$commentLines;
163
- }
164
- }
165
-
166
- // We've already examined the opener line, so move to the next line.
167
- for ($i = ($opener + 1); $tokens[$i]['line'] === $currentLine && $i < $closer; $i++);
168
- $currentLine = $tokens[$i]['line'];
169
-
170
- // Walk tokens.
171
- while ($currentLine !== $closerLine) {
172
- $hasCommentTokens = false;
173
- $hasCodeTokens = false;
174
-
175
- while ($tokens[$i]['line'] === $currentLine) {
176
- if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === false) {
177
- $hasCodeTokens = true;
178
- } elseif (isset(Tokens::$commentTokens[$tokens[$i]['code']]) === true) {
179
- $hasCommentTokens = true;
180
- }
181
-
182
- ++$i;
183
- }
184
-
185
- if ($hasCodeTokens === true) {
186
- ++$codeLines;
187
- } elseif ($hasCommentTokens === true) {
188
- ++$commentLines;
189
- } else {
190
- // Only option left is that this is an empty line.
191
- ++$blankLines;
192
- }
193
-
194
- $currentLine = $tokens[$i]['line'];
195
- }
196
-
197
- $nonBlankLines = ($codeLines + $commentLines);
198
- $totalLines = ($codeLines + $commentLines + $blankLines);
199
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME_CODE, $codeLines . ' lines');
200
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME_COMMENTS, $nonBlankLines . ' lines');
201
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME_ALL, $totalLines . ' lines');
202
-
203
- $lines = $codeLines;
204
- if ($this->ignoreCommentLines === false) {
205
- $lines += $commentLines;
206
- }
207
- if ($this->ignoreEmptyLines === false) {
208
- $lines += $blankLines;
209
- }
210
-
211
- $errorSuffix = ' Declare a named function instead. Found closure containing %s lines';
212
-
213
- if ($lines > $this->maxLines) {
214
- $phpcsFile->addError(
215
- 'Closures which are longer than %s lines are forbidden.' . $errorSuffix,
216
- $stackPtr,
217
- 'ExceedsMaximum',
218
- [$this->maxLines, $lines]
219
- );
220
-
221
- return;
222
- }
223
-
224
- if ($lines > $this->recommendedLines) {
225
- $phpcsFile->addWarning(
226
- 'It is recommended for closures to contain %s lines or less.' . $errorSuffix,
227
- $stackPtr,
228
- 'ExceedsRecommended',
229
- [$this->recommendedLines, $lines]
230
- );
231
- }
232
- }
233
- }
@@ -1,120 +0,0 @@
1
- <?php
2
- /**
3
- * PHPCSExtra, a collection of sniffs and standards for use with PHP_CodeSniffer.
4
- *
5
- * @package PHPCSExtra
6
- * @copyright 2023 PHPCSExtra Contributors
7
- * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
- * @link https://github.com/PHPCSStandards/PHPCSExtra
9
- */
10
-
11
- namespace PHPCSExtra\Universal\Sniffs\FunctionDeclarations;
12
-
13
- use PHP_CodeSniffer\Files\File;
14
- use PHP_CodeSniffer\Sniffs\Sniff;
15
- use PHPCSUtils\Utils\FunctionDeclarations;
16
- use PHPCSUtils\Utils\ObjectDeclarations;
17
- use PHPCSUtils\Utils\Scopes;
18
-
19
- /**
20
- * Require non-abstract, non-private methods in traits to be declared as "final".
21
- *
22
- * @since 1.1.0
23
- */
24
- final class RequireFinalMethodsInTraitsSniff implements Sniff
25
- {
26
-
27
- /**
28
- * Name of the metric.
29
- *
30
- * @since 1.1.0
31
- *
32
- * @var string
33
- */
34
- const METRIC_NAME = 'Non-private method in trait is abstract or final ?';
35
-
36
- /**
37
- * Returns an array of tokens this test wants to listen for.
38
- *
39
- * @since 1.1.0
40
- *
41
- * @return array<int|string>
42
- */
43
- public function register()
44
- {
45
- return [\T_FUNCTION];
46
- }
47
-
48
- /**
49
- * Processes this test, when one of its tokens is encountered.
50
- *
51
- * @since 1.1.0
52
- *
53
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
54
- * @param int $stackPtr The position of the current token
55
- * in the stack passed in $tokens.
56
- *
57
- * @return void
58
- */
59
- public function process(File $phpcsFile, $stackPtr)
60
- {
61
- $tokens = $phpcsFile->getTokens();
62
- if (isset($tokens[$stackPtr]['parenthesis_opener']) === false) {
63
- // Parse error/live coding.
64
- return;
65
- }
66
-
67
- $scopePtr = Scopes::validDirectScope($phpcsFile, $stackPtr, \T_TRAIT);
68
- if ($scopePtr === false) {
69
- // Not a trait method.
70
- return;
71
- }
72
-
73
- $methodProps = FunctionDeclarations::getProperties($phpcsFile, $stackPtr);
74
- if ($methodProps['scope'] === 'private') {
75
- // Private methods can't be final.
76
- return;
77
- }
78
-
79
- if ($methodProps['is_final'] === true) {
80
- // Already final, nothing to do.
81
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'final');
82
- return;
83
- }
84
-
85
- if ($methodProps['is_abstract'] === true) {
86
- // Abstract classes can't be final.
87
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'abstract');
88
- return;
89
- }
90
-
91
- $phpcsFile->recordMetric($stackPtr, self::METRIC_NAME, 'not abstract, not final');
92
-
93
- $methodName = FunctionDeclarations::getName($phpcsFile, $stackPtr);
94
- $magic = '';
95
- $code = 'NonFinalMethodFound';
96
- if (FunctionDeclarations::isMagicMethodName($methodName) === true) {
97
- // Use separate error code for magic methods.
98
- $magic = 'magic ';
99
- $code = 'NonFinalMagicMethodFound';
100
- }
101
-
102
- $data = [
103
- $methodProps['scope'],
104
- $magic,
105
- $methodName,
106
- ObjectDeclarations::getName($phpcsFile, $scopePtr),
107
- ];
108
-
109
- $fix = $phpcsFile->addFixableError(
110
- 'The non-abstract, %s %smethod "%s()" in trait %s should be declared as final.',
111
- $stackPtr,
112
- $code,
113
- $data
114
- );
115
-
116
- if ($fix === true) {
117
- $phpcsFile->fixer->addContentBefore($stackPtr, 'final ');
118
- }
119
- }
120
- }