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,145 +0,0 @@
1
- <?php
2
- /**
3
- * PHPCSUtils, utility functions and classes for PHP_CodeSniffer sniff developers.
4
- *
5
- * @package PHPCSUtils
6
- * @copyright 2019-2020 PHPCSUtils Contributors
7
- * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
- * @link https://github.com/PHPCSStandards/PHPCSUtils
9
- */
10
-
11
- namespace PHPCSUtils\Utils;
12
-
13
- use PHP_CodeSniffer\Files\File;
14
-
15
- /**
16
- * Helper functions for creating PHPCS error/warning messages.
17
- *
18
- * @since 1.0.0
19
- */
20
- final class MessageHelper
21
- {
22
-
23
- /**
24
- * Add a PHPCS message to the output stack as either a warning or an error.
25
- *
26
- * @since 1.0.0
27
- *
28
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
29
- * @param string $message The message.
30
- * @param int $stackPtr The position of the token
31
- * the message relates to.
32
- * @param bool $isError Whether to report the message as an
33
- * 'error' or 'warning'.
34
- * Defaults to true (error).
35
- * @param string $code The error code for the message.
36
- * Defaults to 'Found'.
37
- * @param scalar[] $data Optional input for the data replacements.
38
- * @param int $severity Optional. Severity level. Defaults to 0 which will
39
- * translate to the PHPCS default severity level.
40
- *
41
- * @return bool
42
- */
43
- public static function addMessage(
44
- File $phpcsFile,
45
- $message,
46
- $stackPtr,
47
- $isError = true,
48
- $code = 'Found',
49
- array $data = [],
50
- $severity = 0
51
- ) {
52
- if ($isError === true) {
53
- return $phpcsFile->addError($message, $stackPtr, $code, $data, $severity);
54
- }
55
-
56
- return $phpcsFile->addWarning($message, $stackPtr, $code, $data, $severity);
57
- }
58
-
59
- /**
60
- * Add a PHPCS message to the output stack as either a fixable warning or a fixable error.
61
- *
62
- * @since 1.0.0
63
- *
64
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
65
- * @param string $message The message.
66
- * @param int $stackPtr The position of the token
67
- * the message relates to.
68
- * @param bool $isError Whether to report the message as an
69
- * 'error' or 'warning'.
70
- * Defaults to true (error).
71
- * @param string $code The error code for the message.
72
- * Defaults to 'Found'.
73
- * @param scalar[] $data Optional input for the data replacements.
74
- * @param int $severity Optional. Severity level. Defaults to 0 which will
75
- * translate to the PHPCS default severity level.
76
- *
77
- * @return bool
78
- */
79
- public static function addFixableMessage(
80
- File $phpcsFile,
81
- $message,
82
- $stackPtr,
83
- $isError = true,
84
- $code = 'Found',
85
- array $data = [],
86
- $severity = 0
87
- ) {
88
- if ($isError === true) {
89
- return $phpcsFile->addFixableError($message, $stackPtr, $code, $data, $severity);
90
- }
91
-
92
- return $phpcsFile->addFixableWarning($message, $stackPtr, $code, $data, $severity);
93
- }
94
-
95
- /**
96
- * Convert an arbitrary text string to an alphanumeric string with underscores.
97
- *
98
- * Pre-empt issues in XML and PHP when arbitrary strings are being used as error codes.
99
- *
100
- * @since 1.0.0
101
- *
102
- * @param string $text Arbitrary text string intended to be used in an error code.
103
- * @param bool $strtolower Whether or not to convert the text string to lowercase.
104
- *
105
- * @return string
106
- */
107
- public static function stringToErrorcode($text, $strtolower = false)
108
- {
109
- $text = \preg_replace('`[^a-z0-9_]`i', '_', $text);
110
-
111
- if ($strtolower === true) {
112
- $text = \strtolower($text);
113
- }
114
-
115
- return $text;
116
- }
117
-
118
- /**
119
- * Make the whitespace escape codes used in an arbitrary text string visible.
120
- *
121
- * At times, it is useful to show a code snippet in an error message.
122
- * If such a code snippet contains new lines and/or tab or space characters, those would be
123
- * displayed as-is in the command-line report, often breaking the layout of the report
124
- * or making the report harder to read.
125
- *
126
- * This method will convert these characters to their escape codes, making them visible in the
127
- * display string without impacting the report layout.
128
- *
129
- * @see \PHPCSUtils\Utils\GetTokensToString Methods to retrieve a multi-token code snippet.
130
- * @see \PHP_CodeSniffer\Util\Common\prepareForOutput() Similar PHPCS native method.
131
- *
132
- * @since 1.0.0
133
- *
134
- * @param string $text Arbitrary text string.
135
- *
136
- * @return string
137
- */
138
- public static function showEscapeChars($text)
139
- {
140
- $search = ["\n", "\r", "\t"];
141
- $replace = ['\n', '\r', '\t'];
142
-
143
- return \str_replace($search, $replace, $text);
144
- }
145
- }
@@ -1,389 +0,0 @@
1
- <?php
2
- /**
3
- * PHPCSUtils, utility functions and classes for PHP_CodeSniffer sniff developers.
4
- *
5
- * @package PHPCSUtils
6
- * @copyright 2019-2020 PHPCSUtils Contributors
7
- * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
- * @link https://github.com/PHPCSStandards/PHPCSUtils
9
- */
10
-
11
- namespace PHPCSUtils\Utils;
12
-
13
- use PHP_CodeSniffer\Exceptions\RuntimeException;
14
- use PHP_CodeSniffer\Files\File;
15
- use PHP_CodeSniffer\Util\Tokens;
16
- use PHPCSUtils\BackCompat\BCFile;
17
- use PHPCSUtils\Internal\Cache;
18
- use PHPCSUtils\Tokens\Collections;
19
- use PHPCSUtils\Utils\Conditions;
20
- use PHPCSUtils\Utils\GetTokensAsString;
21
- use PHPCSUtils\Utils\Parentheses;
22
-
23
- /**
24
- * Utility functions for use when examining T_NAMESPACE tokens and to determine the
25
- * namespace of arbitrary tokens.
26
- *
27
- * @link https://www.php.net/language.namespaces PHP Manual on namespaces.
28
- *
29
- * @since 1.0.0
30
- */
31
- final class Namespaces
32
- {
33
-
34
- /**
35
- * Determine what a T_NAMESPACE token is used for.
36
- *
37
- * @since 1.0.0
38
- *
39
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
40
- * @param int $stackPtr The position of the `T_NAMESPACE` token.
41
- *
42
- * @return string Either `'declaration'`, `'operator'` or an empty string.
43
- * An empty string will be returned if it couldn't be
44
- * reliably determined what the `T_NAMESPACE` token is used for,
45
- * which, in most cases, will mean the code contains a parse/fatal error.
46
- *
47
- * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is
48
- * not a `T_NAMESPACE` token.
49
- */
50
- public static function getType(File $phpcsFile, $stackPtr)
51
- {
52
- static $findAfter;
53
-
54
- if (isset($findAfter) === false) {
55
- /*
56
- * Set up array of tokens which can only be used in combination with the keyword as operator
57
- * and which cannot be confused with other keywords.
58
- */
59
- $findAfter = Tokens::$assignmentTokens
60
- + Tokens::$comparisonTokens
61
- + Tokens::$operators
62
- + Tokens::$castTokens
63
- + Tokens::$blockOpeners
64
- + Collections::incrementDecrementOperators()
65
- + Collections::objectOperators()
66
- + Collections::shortArrayListOpenTokensBC();
67
-
68
- $findAfter[\T_OPEN_CURLY_BRACKET] = \T_OPEN_CURLY_BRACKET;
69
- }
70
-
71
- $tokens = $phpcsFile->getTokens();
72
-
73
- if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_NAMESPACE) {
74
- throw new RuntimeException('$stackPtr must be of type T_NAMESPACE');
75
- }
76
-
77
- $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
78
- if ($next === false) {
79
- // Live coding or parse error.
80
- return '';
81
- }
82
-
83
- if (empty($tokens[$stackPtr]['conditions']) === false
84
- || empty($tokens[$stackPtr]['nested_parenthesis']) === false
85
- ) {
86
- /*
87
- * Namespace declarations are only allowed at top level, so this can definitely not
88
- * be a namespace declaration.
89
- */
90
- if ($tokens[$next]['code'] === \T_NS_SEPARATOR) {
91
- return 'operator';
92
- }
93
-
94
- return '';
95
- }
96
-
97
- $start = BCFile::findStartOfStatement($phpcsFile, $stackPtr);
98
- if ($start === $stackPtr
99
- && ($tokens[$next]['code'] === \T_STRING
100
- || $tokens[$next]['code'] === \T_NAME_QUALIFIED
101
- || $tokens[$next]['code'] === \T_OPEN_CURLY_BRACKET)
102
- ) {
103
- return 'declaration';
104
- }
105
-
106
- if (($tokens[$next]['code'] === \T_NS_SEPARATOR
107
- || $tokens[$next]['code'] === \T_NAME_FULLY_QUALIFIED) // PHP 8.0 parse error.
108
- && ($start !== $stackPtr
109
- || $phpcsFile->findNext($findAfter, ($stackPtr + 1), null, false, null, true) !== false)
110
- ) {
111
- return 'operator';
112
- }
113
-
114
- return '';
115
- }
116
-
117
- /**
118
- * Determine whether a T_NAMESPACE token is the keyword for a namespace declaration.
119
- *
120
- * @since 1.0.0
121
- *
122
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
123
- * @param int $stackPtr The position of a `T_NAMESPACE` token.
124
- *
125
- * @return bool `TRUE` if the token passed is the keyword for a namespace declaration.
126
- * `FALSE` if not.
127
- *
128
- * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is
129
- * not a `T_NAMESPACE` token.
130
- */
131
- public static function isDeclaration(File $phpcsFile, $stackPtr)
132
- {
133
- return (self::getType($phpcsFile, $stackPtr) === 'declaration');
134
- }
135
-
136
- /**
137
- * Determine whether a T_NAMESPACE token is used as an operator.
138
- *
139
- * @link https://www.php.net/language.namespaces.nsconstants PHP Manual about the use of the
140
- * namespace keyword as an operator.
141
- *
142
- * @since 1.0.0
143
- *
144
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
145
- * @param int $stackPtr The position of a `T_NAMESPACE` token.
146
- *
147
- * @return bool `TRUE` if the namespace token passed is used as an operator. `FALSE` if not.
148
- *
149
- * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is
150
- * not a `T_NAMESPACE` token.
151
- */
152
- public static function isOperator(File $phpcsFile, $stackPtr)
153
- {
154
- return (self::getType($phpcsFile, $stackPtr) === 'operator');
155
- }
156
-
157
- /**
158
- * Get the complete namespace name as declared.
159
- *
160
- * For hierarchical namespaces, the namespace name will be composed of several tokens,
161
- * i.e. "MyProject\Sub\Level", which will be returned together as one string.
162
- *
163
- * @since 1.0.0
164
- *
165
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
166
- * @param int $stackPtr The position of a `T_NAMESPACE` token.
167
- * @param bool $clean Optional. Whether to get the name stripped
168
- * of potentially interlaced whitespace and/or
169
- * comments. Defaults to `true`.
170
- *
171
- * @return string|false The namespace name; or `FALSE` if the specified position is not a
172
- * `T_NAMESPACE` token, the token points to a namespace operator
173
- * or when parse errors are encountered/during live coding.
174
- * > Note: The name can be an empty string for a valid global
175
- * namespace declaration.
176
- */
177
- public static function getDeclaredName(File $phpcsFile, $stackPtr, $clean = true)
178
- {
179
- try {
180
- if (self::isDeclaration($phpcsFile, $stackPtr) === false) {
181
- // Not a namespace declaration.
182
- return false;
183
- }
184
- } catch (RuntimeException $e) {
185
- // Non-existent token or not a namespace keyword token.
186
- return false;
187
- }
188
-
189
- $endOfStatement = $phpcsFile->findNext(Collections::namespaceDeclarationClosers(), ($stackPtr + 1));
190
- if ($endOfStatement === false) {
191
- // Live coding or parse error.
192
- return false;
193
- }
194
-
195
- $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), ($endOfStatement + 1), true);
196
- if ($next === $endOfStatement) {
197
- // Declaration of global namespace. I.e.: namespace {}.
198
- // If not a scoped {} namespace declaration, no name/global declarations are invalid
199
- // and result in parse errors, but that's not our concern.
200
- return '';
201
- }
202
-
203
- if ($clean === false) {
204
- return \trim(GetTokensAsString::origContent($phpcsFile, $next, ($endOfStatement - 1)));
205
- }
206
-
207
- return \trim(GetTokensAsString::noEmpties($phpcsFile, $next, ($endOfStatement - 1)));
208
- }
209
-
210
- /**
211
- * Find the stack pointer to the namespace declaration applicable for an arbitrary token.
212
- *
213
- * Take note:
214
- * 1. When a namespace declaration token or a token which is part of the namespace
215
- * name is passed to this method, the result will be `false` as technically, these tokens
216
- * are not _within_ a namespace.
217
- * 2. This method has no opinion on whether the token passed is actually _subject_
218
- * to namespacing.
219
- *
220
- * @since 1.0.0
221
- *
222
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
223
- * @param int $stackPtr The token for which to determine
224
- * the namespace.
225
- *
226
- * @return int|false Token pointer to the namespace keyword for the applicable namespace
227
- * declaration; or `FALSE` if it couldn't be determined or
228
- * if no namespace applies.
229
- */
230
- public static function findNamespacePtr(File $phpcsFile, $stackPtr)
231
- {
232
- $tokens = $phpcsFile->getTokens();
233
-
234
- // Check for the existence of the token.
235
- if (isset($tokens[$stackPtr]) === false) {
236
- return false;
237
- }
238
-
239
- // The namespace keyword in a namespace declaration is itself not namespaced.
240
- if ($tokens[$stackPtr]['code'] === \T_NAMESPACE
241
- && self::isDeclaration($phpcsFile, $stackPtr) === true
242
- ) {
243
- return false;
244
- }
245
-
246
- // Check for scoped namespace {}.
247
- $namespacePtr = Conditions::getCondition($phpcsFile, $stackPtr, \T_NAMESPACE);
248
- if ($namespacePtr !== false) {
249
- return $namespacePtr;
250
- }
251
-
252
- /*
253
- * Not in a scoped namespace, so let's see if we can find a non-scoped namespace instead.
254
- * Keeping in mind that:
255
- * - there can be multiple non-scoped namespaces in a file (bad practice, but is allowed);
256
- * - the namespace keyword can also be used as an operator;
257
- * - a non-named namespace resolves to the global namespace;
258
- * - and that namespace declarations can't be nested in anything, so we can skip over any
259
- * nesting structures.
260
- */
261
- if (Cache::isCached($phpcsFile, __METHOD__, $stackPtr) === true) {
262
- return Cache::get($phpcsFile, __METHOD__, $stackPtr);
263
- }
264
-
265
- // Start by breaking out of any scoped structures this token is in.
266
- $prev = $stackPtr;
267
- $firstCondition = Conditions::getFirstCondition($phpcsFile, $stackPtr);
268
- if ($firstCondition !== false) {
269
- $prev = $firstCondition;
270
- }
271
-
272
- // And break out of any surrounding parentheses as well.
273
- $firstParensOpener = Parentheses::getFirstOpener($phpcsFile, $prev);
274
- if ($firstParensOpener !== false) {
275
- $prev = $firstParensOpener;
276
- }
277
-
278
- $find = [
279
- \T_NAMESPACE,
280
- \T_CLOSE_CURLY_BRACKET,
281
- \T_CLOSE_PARENTHESIS,
282
- \T_CLOSE_SHORT_ARRAY,
283
- \T_CLOSE_SQUARE_BRACKET,
284
- \T_DOC_COMMENT_CLOSE_TAG,
285
- \T_ATTRIBUTE_END,
286
- ];
287
- $returnValue = false;
288
-
289
- do {
290
- $prev = $phpcsFile->findPrevious($find, ($prev - 1));
291
- if ($prev === false) {
292
- break;
293
- }
294
-
295
- if ($tokens[$prev]['code'] === \T_CLOSE_CURLY_BRACKET) {
296
- // Stop if we encounter a scoped namespace declaration as we already know we're not in one.
297
- if (isset($tokens[$prev]['scope_condition']) === true
298
- && $tokens[$tokens[$prev]['scope_condition']]['code'] === \T_NAMESPACE
299
- ) {
300
- break;
301
- }
302
-
303
- // Skip over other scoped structures for efficiency.
304
- if (isset($tokens[$prev]['scope_condition']) === true) {
305
- $prev = $tokens[$prev]['scope_condition'];
306
- } elseif (isset($tokens[$prev]['scope_opener']) === true) {
307
- // Shouldn't be possible, but just in case.
308
- $prev = $tokens[$prev]['scope_opener']; // @codeCoverageIgnore
309
- }
310
-
311
- continue;
312
- }
313
-
314
- // Skip over other nesting structures for efficiency.
315
- if (isset($tokens[$prev]['bracket_opener']) === true) {
316
- $prev = $tokens[$prev]['bracket_opener'];
317
- continue;
318
- }
319
-
320
- if (isset($tokens[$prev]['parenthesis_owner']) === true) {
321
- $prev = $tokens[$prev]['parenthesis_owner'];
322
- continue;
323
- } elseif (isset($tokens[$prev]['parenthesis_opener']) === true) {
324
- $prev = $tokens[$prev]['parenthesis_opener'];
325
- continue;
326
- }
327
-
328
- // Skip over potentially large attributes.
329
- if (isset($tokens[$prev]['attribute_opener'])) {
330
- $prev = $tokens[$prev]['attribute_opener'];
331
- continue;
332
- }
333
-
334
- // Skip over potentially large docblocks.
335
- if (isset($tokens[$prev]['comment_opener'])) {
336
- $prev = $tokens[$prev]['comment_opener'];
337
- continue;
338
- }
339
-
340
- // So this is a namespace keyword, check if it's a declaration.
341
- if ($tokens[$prev]['code'] === \T_NAMESPACE
342
- && self::isDeclaration($phpcsFile, $prev) === true
343
- ) {
344
- // Now make sure the token was not part of the declaration.
345
- $endOfStatement = $phpcsFile->findNext(Collections::namespaceDeclarationClosers(), ($prev + 1));
346
- if ($endOfStatement > $stackPtr) {
347
- // Token is part of the declaration, return false.
348
- break;
349
- }
350
-
351
- $returnValue = $prev;
352
- break;
353
- }
354
- } while (true);
355
-
356
- Cache::set($phpcsFile, __METHOD__, $stackPtr, $returnValue);
357
- return $returnValue;
358
- }
359
-
360
- /**
361
- * Determine the namespace name an arbitrary token lives in.
362
- *
363
- * Note: this method has no opinion on whether the token passed is actually _subject_
364
- * to namespacing.
365
- *
366
- * @since 1.0.0
367
- *
368
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
369
- * @param int $stackPtr The token for which to determine
370
- * the namespace.
371
- *
372
- * @return string Namespace name; or an empty string if the namespace couldn't be
373
- * determined or when no namespace applies.
374
- */
375
- public static function determineNamespace(File $phpcsFile, $stackPtr)
376
- {
377
- $namespacePtr = self::findNamespacePtr($phpcsFile, $stackPtr);
378
- if ($namespacePtr === false) {
379
- return '';
380
- }
381
-
382
- $namespace = self::getDeclaredName($phpcsFile, $namespacePtr);
383
- if ($namespace !== false) {
384
- return $namespace;
385
- }
386
-
387
- return '';
388
- }
389
- }
@@ -1,116 +0,0 @@
1
- <?php
2
- /**
3
- * PHPCSUtils, utility functions and classes for PHP_CodeSniffer sniff developers.
4
- *
5
- * @package PHPCSUtils
6
- * @copyright 2019-2020 PHPCSUtils Contributors
7
- * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
- * @link https://github.com/PHPCSStandards/PHPCSUtils
9
- */
10
-
11
- namespace PHPCSUtils\Utils;
12
-
13
- /**
14
- * Utility functions for working with identifier names.
15
- *
16
- * Identifier names in PHP are:
17
- * - {@link https://www.php.net/language.namespaces.definition namespace} names;
18
- * - {@link https://www.php.net/language.oop5.basic class},
19
- * {@link https://www.php.net/language.oop5.traits trait},
20
- * {@link https://www.php.net/language.oop5.interfaces interface} and
21
- * {@link https://www.php.net/language.types.enumerations enum} names;
22
- * - {@link https://www.php.net/functions.user-defined function and method} names;
23
- * - {@link https://www.php.net/language.variables.basics variable} names;
24
- * - {@link https://www.php.net/language.constants constant} names.
25
- *
26
- * @since 1.0.0
27
- */
28
- final class NamingConventions
29
- {
30
-
31
- /**
32
- * Regular expression to check if a given identifier name is valid for use in PHP.
33
- *
34
- * @since 1.0.0
35
- *
36
- * @var string
37
- */
38
- const PHP_LABEL_REGEX = '`^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$`';
39
-
40
- /**
41
- * Uppercase A-Z.
42
- *
43
- * @since 1.0.0
44
- * @deprecated 1.0.10
45
- *
46
- * @var string
47
- */
48
- const AZ_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
49
-
50
- /**
51
- * Lowercase a-z.
52
- *
53
- * @since 1.0.0
54
- * @deprecated 1.0.10
55
- *
56
- * @var string
57
- */
58
- const AZ_LOWER = 'abcdefghijklmnopqrstuvwxyz';
59
-
60
- /**
61
- * Verify whether an arbitrary text string is valid as an identifier name in PHP.
62
- *
63
- * @since 1.0.0
64
- *
65
- * @param string $name The name to verify.
66
- * > Note: for variable names, the leading dollar sign - `$` - needs to be
67
- * removed prior to passing the name to this method.
68
- *
69
- * @return bool
70
- */
71
- public static function isValidIdentifierName($name)
72
- {
73
- if (\is_string($name) === false || $name === '' || \strpos($name, ' ') !== false) {
74
- return false;
75
- }
76
-
77
- return (\preg_match(self::PHP_LABEL_REGEX, $name) === 1);
78
- }
79
-
80
- /**
81
- * Check if two arbitrary identifier names will be seen as the same in PHP.
82
- *
83
- * This method should not be used for variable or constant names, but *should* be used
84
- * when comparing namespace, class/trait/interface and function names.
85
- *
86
- * Variable and constant names in PHP are case-sensitive, except for constants explicitely
87
- * declared case-insensitive using the third parameter for
88
- * {@link https://www.php.net/function.define `define()`}.
89
- *
90
- * All other names are case-insensitive for the most part, but as it's PHP, not completely.
91
- * Basically ASCII chars used are case-insensitive, but anything from 0x80 up is case-sensitive.
92
- *
93
- * This method takes this case-(in)sensitivity into account when comparing identifier names.
94
- *
95
- * Note: this method does not check whether the passed names would be valid for identifiers!
96
- * The {@see \PHPCSUtils\Utils\NamingConventions::isValidIdentifierName()} method should be used
97
- * to verify that, if necessary.
98
- *
99
- * @since 1.0.0
100
- *
101
- * @param string $nameA The first identifier name.
102
- * @param string $nameB The second identifier name.
103
- *
104
- * @return bool `TRUE` if these names would be considered the same in PHP; `FALSE` otherwise.
105
- */
106
- public static function isEqual($nameA, $nameB)
107
- {
108
- // Simple quick check first.
109
- if ($nameA === $nameB) {
110
- return true;
111
- }
112
-
113
- // Comparing via strcasecmp will only compare ASCII letters case-insensitively.
114
- return (\strcasecmp($nameA, $nameB) === 0);
115
- }
116
- }