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,349 +0,0 @@
1
- <?php
2
- /**
3
- * WordPress Coding Standard.
4
- *
5
- * @package WPCS\WordPressCodingStandards
6
- * @link https://github.com/WordPress/WordPress-Coding-Standards
7
- * @license https://opensource.org/licenses/MIT MIT
8
- */
9
-
10
- namespace WordPressCS\WordPress\Helpers;
11
-
12
- use PHP_CodeSniffer\Files\File;
13
- use PHP_CodeSniffer\Util\Tokens;
14
- use PHPCSUtils\Tokens\Collections;
15
- use PHPCSUtils\Utils\Conditions;
16
- use PHPCSUtils\Utils\Context;
17
- use PHPCSUtils\Utils\PassedParameters;
18
- use PHPCSUtils\Utils\TextStrings;
19
- use WordPressCS\WordPress\Helpers\ContextHelper;
20
- use WordPressCS\WordPress\Helpers\VariableHelper;
21
-
22
- /**
23
- * Helper function for checking whether a token is validated.
24
- *
25
- * @since 3.0.0 The method in this class was previously contained in the
26
- * `WordPressCS\WordPress\Sniff` class and has been moved here.
27
- */
28
- final class ValidationHelper {
29
-
30
- /**
31
- * The tokens the function looks for to determine whether a token is validated.
32
- *
33
- * @since 3.0.0
34
- *
35
- * @var array<int|string, string>
36
- */
37
- private static $targets = array(
38
- \T_ISSET => 'construct',
39
- \T_EMPTY => 'construct',
40
- \T_STRING => 'function_call',
41
- \T_COALESCE => 'coalesce',
42
- \T_COALESCE_EQUAL => 'coalesce',
43
- );
44
-
45
- /**
46
- * List of PHP native functions to check if an array index exists.
47
- *
48
- * @since 3.0.0
49
- *
50
- * @var array<string, bool>
51
- */
52
- private static $key_exists_functions = array(
53
- 'array_key_exists' => true,
54
- 'key_exists' => true, // Alias.
55
- );
56
-
57
- /**
58
- * Check if the existence of a variable is validated with isset(), empty(), array_key_exists()
59
- * or key_exists().
60
- *
61
- * When $in_condition_only is `false`, (which is the default), this is considered
62
- * valid:
63
- *
64
- * ```php
65
- * if ( isset( $var ) ) {
66
- * // Do stuff, like maybe return or exit (but could be anything)
67
- * }
68
- *
69
- * foo( $var );
70
- * ```
71
- *
72
- * When it is `true`, that would be invalid; the use of the variable must be within
73
- * the scope of the validating condition, like this:
74
- *
75
- * ```php
76
- * if ( isset( $var ) ) {
77
- * foo( $var );
78
- * }
79
- * ```
80
- *
81
- * @since 0.5.0
82
- * @since 2.1.0 Now recognizes array_key_exists() and key_exists() as validation functions.
83
- * @since 2.1.0 Stricter check on whether the correct variable and the correct
84
- * array keys are being validated.
85
- * @since 3.0.0 - Moved from the Sniff class to this class.
86
- * - The method visibility was changed from `protected` to `public static`.
87
- * - The `$phpcsFile` parameter was added.
88
- *
89
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
90
- * @param int $stackPtr The index of this token in the stack.
91
- * @param array|string $array_keys An array key to check for ("bar" in $foo['bar'])
92
- * or an array of keys for multi-level array access.
93
- * @param bool $in_condition_only Whether to require that this use of the
94
- * variable occurs within the scope of the
95
- * validating condition, or just in the same
96
- * scope (default).
97
- *
98
- * @return bool Whether the var is validated.
99
- */
100
- public static function is_validated( File $phpcsFile, $stackPtr, $array_keys = array(), $in_condition_only = false ) {
101
- $tokens = $phpcsFile->getTokens();
102
- if ( isset( $tokens[ $stackPtr ] ) === false ) {
103
- return false;
104
- }
105
-
106
- if ( $in_condition_only ) {
107
- /*
108
- * This is a stricter check, requiring the variable to be used only
109
- * within the validation condition.
110
- */
111
- $conditionPtr = Conditions::getLastCondition( $phpcsFile, $stackPtr );
112
- if ( false === $conditionPtr ) {
113
- // If there are no conditions, there's no validation.
114
- return false;
115
- }
116
-
117
- $condition = $tokens[ $conditionPtr ];
118
- if ( ! isset( $condition['parenthesis_opener'] ) ) {
119
- // Live coding or parse error.
120
- return false;
121
- }
122
-
123
- $scope_start = $condition['parenthesis_opener'];
124
- $scope_end = $condition['parenthesis_closer'];
125
-
126
- } else {
127
- /*
128
- * We are more loose, requiring only that the variable be validated
129
- * in the same function/file scope as it is used.
130
- */
131
- $scope_start = 0;
132
-
133
- /*
134
- * Check if we are in a function.
135
- *
136
- * Note: PHP 7.4+ arrow functions are not taken into account as those are not
137
- * included in the "conditions" array. Additionally, arrow functions have
138
- * access to variables outside their direct scope.
139
- */
140
- $function = Conditions::getLastCondition( $phpcsFile, $stackPtr, array( \T_FUNCTION, \T_CLOSURE ) );
141
-
142
- // If so, we check only within the function, otherwise the whole file.
143
- if ( false !== $function ) {
144
- $scope_start = $tokens[ $function ]['scope_opener'];
145
- }
146
-
147
- $scope_end = $stackPtr;
148
- }
149
-
150
- if ( ! empty( $array_keys ) && ! is_array( $array_keys ) ) {
151
- $array_keys = (array) $array_keys;
152
- }
153
-
154
- $bare_array_keys = self::strip_quotes_from_array_values( $array_keys );
155
-
156
- // phpcs:ignore Generic.CodeAnalysis.JumbledIncrementer.Found -- On purpose, see below.
157
- for ( $i = ( $scope_start + 1 ); $i < $scope_end; $i++ ) {
158
-
159
- if ( isset( Collections::closedScopes()[ $tokens[ $i ]['code'] ] )
160
- && isset( $tokens[ $i ]['scope_closer'] )
161
- ) {
162
- // Jump over nested closed scopes as validation done within those does not apply.
163
- $i = $tokens[ $i ]['scope_closer'];
164
- continue;
165
- }
166
-
167
- if ( \T_FN === $tokens[ $i ]['code']
168
- && isset( $tokens[ $i ]['scope_closer'] )
169
- && $tokens[ $i ]['scope_closer'] < $scope_end
170
- ) {
171
- // Jump over nested arrow functions as long as the current variable isn't *in* the arrow function.
172
- $i = $tokens[ $i ]['scope_closer'];
173
- continue;
174
- }
175
-
176
- if ( isset( self::$targets[ $tokens[ $i ]['code'] ] ) === false ) {
177
- continue;
178
- }
179
-
180
- switch ( self::$targets[ $tokens[ $i ]['code'] ] ) {
181
- case 'construct':
182
- $issetOpener = $phpcsFile->findNext( Tokens::$emptyTokens, ( $i + 1 ), null, true );
183
- if ( false === $issetOpener
184
- || \T_OPEN_PARENTHESIS !== $tokens[ $issetOpener ]['code']
185
- || isset( $tokens[ $issetOpener ]['parenthesis_closer'] ) === false
186
- ) {
187
- // Parse error or live coding.
188
- continue 2;
189
- }
190
-
191
- $issetCloser = $tokens[ $issetOpener ]['parenthesis_closer'];
192
-
193
- // Look for this variable. We purposely stomp $i from the parent loop.
194
- for ( $i = ( $issetOpener + 1 ); $i < $issetCloser; $i++ ) {
195
-
196
- if ( \T_VARIABLE !== $tokens[ $i ]['code'] ) {
197
- continue;
198
- }
199
-
200
- if ( $tokens[ $stackPtr ]['content'] !== $tokens[ $i ]['content'] ) {
201
- continue;
202
- }
203
-
204
- // If we're checking for specific array keys (ex: 'hello' in
205
- // $_POST['hello']), that must match too. Quote-style, however, doesn't matter.
206
- if ( ! empty( $bare_array_keys ) ) {
207
- $found_keys = VariableHelper::get_array_access_keys( $phpcsFile, $i );
208
- $found_keys = self::strip_quotes_from_array_values( $found_keys );
209
- $diff = array_diff_assoc( $bare_array_keys, $found_keys );
210
- if ( ! empty( $diff ) ) {
211
- continue;
212
- }
213
- }
214
-
215
- return true;
216
- }
217
-
218
- break;
219
-
220
- case 'function_call':
221
- // Only check calls to array_key_exists() and key_exists().
222
- if ( isset( self::$key_exists_functions[ strtolower( $tokens[ $i ]['content'] ) ] ) === false ) {
223
- continue 2;
224
- }
225
-
226
- $next_non_empty = $phpcsFile->findNext( Tokens::$emptyTokens, ( $i + 1 ), null, true );
227
- if ( false === $next_non_empty || \T_OPEN_PARENTHESIS !== $tokens[ $next_non_empty ]['code'] ) {
228
- // Not a function call.
229
- continue 2;
230
- }
231
-
232
- if ( Context::inAttribute( $phpcsFile, $i ) === true ) {
233
- // Definitely not the function call as those are not allowed in attributes.
234
- continue 2;
235
- }
236
-
237
- if ( ContextHelper::has_object_operator_before( $phpcsFile, $i ) === true ) {
238
- // Method call.
239
- continue 2;
240
- }
241
-
242
- if ( ContextHelper::is_token_namespaced( $phpcsFile, $i ) === true ) {
243
- // Namespaced function call.
244
- continue 2;
245
- }
246
-
247
- $params = PassedParameters::getParameters( $phpcsFile, $i );
248
-
249
- // As `key_exists()` is an alias of `array_key_exists()`, the param positions and names are the same.
250
- $array_param = PassedParameters::getParameterFromStack( $params, 2, 'array' );
251
- if ( false === $array_param ) {
252
- continue 2;
253
- }
254
-
255
- $array_param_first_token = $phpcsFile->findNext( Tokens::$emptyTokens, $array_param['start'], ( $array_param['end'] + 1 ), true );
256
- if ( false === $array_param_first_token
257
- || \T_VARIABLE !== $tokens[ $array_param_first_token ]['code']
258
- || $tokens[ $array_param_first_token ]['content'] !== $tokens[ $stackPtr ]['content']
259
- ) {
260
- continue 2;
261
- }
262
-
263
- if ( ! empty( $bare_array_keys ) ) {
264
- // Prevent the original array from being altered.
265
- $bare_keys = $bare_array_keys;
266
- $last_key = array_pop( $bare_keys );
267
-
268
- /*
269
- * For multi-level array access, the complete set of keys could be split between
270
- * the $key and the $array parameter, but could also be completely in the $array
271
- * parameter, so we need to check both options.
272
- */
273
- $found_keys = VariableHelper::get_array_access_keys( $phpcsFile, $array_param_first_token );
274
- $found_keys = self::strip_quotes_from_array_values( $found_keys );
275
-
276
- // First try matching the complete set against the array parameter.
277
- $diff = array_diff_assoc( $bare_array_keys, $found_keys );
278
- if ( empty( $diff ) ) {
279
- return true;
280
- }
281
-
282
- // If that failed, try getting an exact match for the subset against the
283
- // $array parameter and the last key against the first.
284
- $key_param = PassedParameters::getParameterFromStack( $params, 1, 'key' );
285
- if ( false !== $key_param
286
- && $bare_keys === $found_keys
287
- && TextStrings::stripQuotes( $key_param['raw'] ) === $last_key
288
- ) {
289
- return true;
290
- }
291
-
292
- // Didn't find the correct array keys.
293
- continue 2;
294
- }
295
-
296
- return true;
297
-
298
- case 'coalesce':
299
- $prev = $i;
300
- do {
301
- $prev = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $prev - 1 ), null, true );
302
- // Skip over array keys, like `$_GET['key']['subkey']`.
303
- if ( \T_CLOSE_SQUARE_BRACKET === $tokens[ $prev ]['code'] ) {
304
- $prev = $tokens[ $prev ]['bracket_opener'];
305
- continue;
306
- }
307
-
308
- break;
309
- } while ( $prev >= ( $scope_start + 1 ) );
310
-
311
- // We should now have reached the variable.
312
- if ( \T_VARIABLE !== $tokens[ $prev ]['code'] ) {
313
- continue 2;
314
- }
315
-
316
- if ( $tokens[ $prev ]['content'] !== $tokens[ $stackPtr ]['content'] ) {
317
- continue 2;
318
- }
319
-
320
- if ( ! empty( $bare_array_keys ) ) {
321
- $found_keys = VariableHelper::get_array_access_keys( $phpcsFile, $prev );
322
- $found_keys = self::strip_quotes_from_array_values( $found_keys );
323
- $diff = array_diff_assoc( $bare_array_keys, $found_keys );
324
- if ( ! empty( $diff ) ) {
325
- continue 2;
326
- }
327
- }
328
-
329
- // Right variable, correct key.
330
- return true;
331
- }
332
- }
333
-
334
- return false;
335
- }
336
-
337
- /**
338
- * Strip quotes of all the values in an array containing only text strings.
339
- *
340
- * @since 3.0.0
341
- *
342
- * @param string[] $text_strings The input array.
343
- *
344
- * @return string[]
345
- */
346
- private static function strip_quotes_from_array_values( array $text_strings ) {
347
- return array_map( array( 'PHPCSUtils\Utils\TextStrings', 'stripQuotes' ), $text_strings );
348
- }
349
- }
@@ -1,262 +0,0 @@
1
- <?php
2
- /**
3
- * WordPress Coding Standard.
4
- *
5
- * @package WPCS\WordPressCodingStandards
6
- * @link https://github.com/WordPress/WordPress-Coding-Standards
7
- * @license https://opensource.org/licenses/MIT MIT
8
- */
9
-
10
- namespace WordPressCS\WordPress\Helpers;
11
-
12
- use PHP_CodeSniffer\Files\File;
13
- use PHP_CodeSniffer\Util\Tokens;
14
- use PHPCSUtils\Utils\GetTokensAsString;
15
- use PHPCSUtils\Utils\Parentheses;
16
-
17
- /**
18
- * Helper utilities for working with variables.
19
- *
20
- * ---------------------------------------------------------------------------------------------
21
- * This class is only intended for internal use by WordPressCS and is not part of the public API.
22
- * This also means that it has no promise of backward compatibility. Use at your own risk.
23
- * ---------------------------------------------------------------------------------------------
24
- *
25
- * {@internal The functionality in this class will likely be replaced at some point in
26
- * the future by functions from PHPCSUtils.}
27
- *
28
- * @internal
29
- *
30
- * @since 3.0.0 The methods in this class were previously contained in the
31
- * `WordPressCS\WordPress\Sniff` class and have been moved here.
32
- */
33
- final class VariableHelper {
34
-
35
- /**
36
- * Get the index keys of an array variable.
37
- *
38
- * E.g., "bar" and "baz" in $foo['bar']['baz'].
39
- *
40
- * @since 2.1.0
41
- * @since 3.0.0 - Moved from the Sniff class to this class.
42
- * - Visibility is now `public` (was `protected`) and the method `static`.
43
- * - The `$phpcsFile` parameter was added.
44
- *
45
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
46
- * @param int $stackPtr The index of the variable token in the stack.
47
- * @param bool $all Whether to get all keys or only the first.
48
- * Defaults to `true`(= all).
49
- *
50
- * @return array An array of index keys whose value is being accessed.
51
- * or an empty array if this is not array access.
52
- */
53
- public static function get_array_access_keys( File $phpcsFile, $stackPtr, $all = true ) {
54
- $tokens = $phpcsFile->getTokens();
55
- $keys = array();
56
-
57
- if ( isset( $tokens[ $stackPtr ] ) === false
58
- || \T_VARIABLE !== $tokens[ $stackPtr ]['code']
59
- ) {
60
- return $keys;
61
- }
62
-
63
- $current = $stackPtr;
64
-
65
- do {
66
- // Find the next non-empty token.
67
- $open_bracket = $phpcsFile->findNext(
68
- Tokens::$emptyTokens,
69
- ( $current + 1 ),
70
- null,
71
- true
72
- );
73
-
74
- // If it isn't a bracket, this isn't an array-access.
75
- if ( false === $open_bracket
76
- || \T_OPEN_SQUARE_BRACKET !== $tokens[ $open_bracket ]['code']
77
- || ! isset( $tokens[ $open_bracket ]['bracket_closer'] )
78
- ) {
79
- break;
80
- }
81
-
82
- $key = GetTokensAsString::compact(
83
- $phpcsFile,
84
- ( $open_bracket + 1 ),
85
- ( $tokens[ $open_bracket ]['bracket_closer'] - 1 ),
86
- true
87
- );
88
-
89
- $keys[] = trim( $key );
90
- $current = $tokens[ $open_bracket ]['bracket_closer'];
91
- } while ( isset( $tokens[ $current ] ) && true === $all );
92
-
93
- return $keys;
94
- }
95
-
96
- /**
97
- * Get the index key of an array variable.
98
- *
99
- * E.g., "bar" in $foo['bar'].
100
- *
101
- * @since 0.5.0
102
- * @since 2.1.0 Now uses get_array_access_keys() under the hood.
103
- * @since 3.0.0 - Moved from the Sniff class to this class.
104
- * - Visibility is now `public` (was `protected`) and the method `static`.
105
- * - The `$phpcsFile` parameter was added.
106
- *
107
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
108
- * @param int $stackPtr The index of the variable token in the stack.
109
- *
110
- * @return string|false The array index key whose value is being accessed.
111
- */
112
- public static function get_array_access_key( File $phpcsFile, $stackPtr ) {
113
- $keys = self::get_array_access_keys( $phpcsFile, $stackPtr, false );
114
- if ( isset( $keys[0] ) ) {
115
- return $keys[0];
116
- }
117
-
118
- return false;
119
- }
120
-
121
- /**
122
- * Check whether a variable is being compared to another value.
123
- *
124
- * E.g., $var === 'foo', 1 <= $var, etc.
125
- *
126
- * Also recognizes `switch ( $var )` and `match ( $var )`.
127
- *
128
- * @since 0.5.0
129
- * @since 2.1.0 Added the $include_coalesce parameter.
130
- * @since 3.0.0 - Moved from the Sniff class to this class.
131
- * - Visibility is now `public` (was `protected`) and the method `static`.
132
- * - The `$phpcsFile` parameter was added.
133
- *
134
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
135
- * @param int $stackPtr The index of this token in the stack.
136
- * @param bool $include_coalesce Optional. Whether or not to regard the null
137
- * coalesce operator - ?? - as a comparison operator.
138
- * Defaults to true.
139
- * Null coalesce is a special comparison operator in this
140
- * sense as it doesn't compare a variable to whatever is
141
- * on the other side of the comparison operator.
142
- *
143
- * @return bool Whether this is a comparison.
144
- */
145
- public static function is_comparison( File $phpcsFile, $stackPtr, $include_coalesce = true ) {
146
- $tokens = $phpcsFile->getTokens();
147
- if ( isset( $tokens[ $stackPtr ] ) === false ) {
148
- return false;
149
- }
150
-
151
- $comparisonTokens = Tokens::$comparisonTokens;
152
- if ( false === $include_coalesce ) {
153
- unset( $comparisonTokens[ \T_COALESCE ] );
154
- }
155
-
156
- // We first check if this is a switch or match statement (switch ( $var )).
157
- if ( Parentheses::lastOwnerIn( $phpcsFile, $stackPtr, array( \T_SWITCH, \T_MATCH ) ) !== false ) {
158
- return true;
159
- }
160
-
161
- // Find the previous non-empty token. We check before the var first because
162
- // yoda conditions are usually expected.
163
- $previous_token = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true );
164
-
165
- if ( isset( $comparisonTokens[ $tokens[ $previous_token ]['code'] ] ) ) {
166
- return true;
167
- }
168
-
169
- // Maybe the comparison operator is after this.
170
- $next_token = $phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
171
-
172
- // This might be an opening square bracket in the case of arrays ($var['a']).
173
- while ( false !== $next_token
174
- && \T_OPEN_SQUARE_BRACKET === $tokens[ $next_token ]['code']
175
- && isset( $tokens[ $next_token ]['bracket_closer'] )
176
- ) {
177
- $next_token = $phpcsFile->findNext(
178
- Tokens::$emptyTokens,
179
- ( $tokens[ $next_token ]['bracket_closer'] + 1 ),
180
- null,
181
- true
182
- );
183
- }
184
-
185
- if ( false !== $next_token && isset( $comparisonTokens[ $tokens[ $next_token ]['code'] ] ) ) {
186
- return true;
187
- }
188
-
189
- return false;
190
- }
191
-
192
- /**
193
- * Check if this variable is being assigned a value.
194
- *
195
- * E.g., $var = 'foo';
196
- *
197
- * Also handles array assignments to arbitrary depth:
198
- *
199
- * $array['key'][ $foo ][ something() ] = $bar;
200
- *
201
- * @since 0.5.0
202
- * @since 3.0.0 - Moved from the Sniff class to this class.
203
- * - Visibility is now `public` (was `protected`) and the method `static`.
204
- * - The `$phpcsFile` parameter was added.
205
- * - The `$include_coalesce` parameter was added.
206
- *
207
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
208
- * @param int $stackPtr The index of the token in the stack.
209
- * This must point to either a T_VARIABLE or
210
- * T_CLOSE_SQUARE_BRACKET token.
211
- * @param bool $include_coalesce Optional. Whether or not to regard the null
212
- * coalesce operator - ?? - as a comparison operator.
213
- * Defaults to true.
214
- * Null coalesce is a special comparison operator in this
215
- * sense as it doesn't compare a variable to whatever is
216
- * on the other side of the comparison operator.
217
- *
218
- * @return bool Whether the token is a variable being assigned a value.
219
- */
220
- public static function is_assignment( File $phpcsFile, $stackPtr, $include_coalesce = true ) {
221
- $tokens = $phpcsFile->getTokens();
222
- if ( isset( $tokens[ $stackPtr ] ) === false ) {
223
- return false;
224
- }
225
-
226
- static $valid = array(
227
- \T_VARIABLE => true,
228
- \T_CLOSE_SQUARE_BRACKET => true,
229
- );
230
-
231
- // Must be a variable or closing square bracket (see below).
232
- if ( ! isset( $valid[ $tokens[ $stackPtr ]['code'] ] ) ) {
233
- return false;
234
- }
235
-
236
- $next_non_empty = $phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true, null, true );
237
-
238
- // No token found.
239
- if ( false === $next_non_empty ) {
240
- return false;
241
- }
242
-
243
- $assignmentTokens = Tokens::$assignmentTokens;
244
- if ( false === $include_coalesce ) {
245
- unset( $assignmentTokens[ \T_COALESCE_EQUAL ] );
246
- }
247
-
248
- // If the next token is an assignment, that's all we need to know.
249
- if ( isset( $assignmentTokens[ $tokens[ $next_non_empty ]['code'] ] ) ) {
250
- return true;
251
- }
252
-
253
- // Check if this is an array assignment, e.g., `$var['key'] = 'val';` .
254
- if ( \T_OPEN_SQUARE_BRACKET === $tokens[ $next_non_empty ]['code']
255
- && isset( $tokens[ $next_non_empty ]['bracket_closer'] )
256
- ) {
257
- return self::is_assignment( $phpcsFile, $tokens[ $next_non_empty ]['bracket_closer'], $include_coalesce );
258
- }
259
-
260
- return false;
261
- }
262
- }