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,550 +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\Sniffs\Arrays;
11
-
12
- use PHP_CodeSniffer\Util\Tokens;
13
- use PHPCSUtils\BackCompat\Helper;
14
- use PHPCSUtils\Tokens\Collections;
15
- use PHPCSUtils\Utils\Arrays;
16
- use PHPCSUtils\Utils\PassedParameters;
17
- use WordPressCS\WordPress\Sniff;
18
-
19
- /**
20
- * Enforces WordPress array indentation for multi-line arrays.
21
- *
22
- * @link https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#indentation
23
- *
24
- * @since 0.12.0
25
- * @since 0.13.0 Class name changed: this class is now namespaced.
26
- *
27
- * {@internal This sniff should eventually be pulled upstream as part of a solution
28
- * for https://github.com/squizlabs/PHP_CodeSniffer/issues/582 }}
29
- */
30
- final class ArrayIndentationSniff extends Sniff {
31
-
32
- /**
33
- * Should tabs be used for indenting?
34
- *
35
- * If TRUE, fixes will be made using tabs instead of spaces.
36
- * The size of each tab is important, so it should be specified
37
- * using the --tab-width CLI argument.
38
- *
39
- * {@internal While for WPCS this should always be `true`, this property
40
- * was added in anticipation of upstreaming the sniff.
41
- * This property is the same as used in `Generic.WhiteSpace.ScopeIndent`.}}
42
- *
43
- * @var bool
44
- */
45
- public $tabIndent = true;
46
-
47
- /**
48
- * The --tab-width CLI value that is being used.
49
- *
50
- * @var int
51
- */
52
- private $tab_width;
53
-
54
- /**
55
- * Tokens to ignore for subsequent lines in a multi-line array item.
56
- *
57
- * Property is set in the register() method.
58
- *
59
- * @var array
60
- */
61
- private $ignore_tokens = array();
62
-
63
- /**
64
- * Returns an array of tokens this test wants to listen for.
65
- *
66
- * @return array
67
- */
68
- public function register() {
69
- /*
70
- * Set the $ignore_tokens property.
71
- *
72
- * Existing heredoc, nowdoc and inline HTML indentation should be respected at all times.
73
- */
74
- $this->ignore_tokens = Tokens::$heredocTokens;
75
- unset( $this->ignore_tokens[ \T_START_HEREDOC ], $this->ignore_tokens[ \T_START_NOWDOC ] );
76
- $this->ignore_tokens[ \T_INLINE_HTML ] = \T_INLINE_HTML;
77
-
78
- return Collections::arrayOpenTokensBC();
79
- }
80
-
81
- /**
82
- * Processes this test, when one of its tokens is encountered.
83
- *
84
- * @param int $stackPtr The position of the current token in the stack.
85
- *
86
- * @return int|void Integer stack pointer to skip forward or void to continue
87
- * normal file processing.
88
- */
89
- public function process_token( $stackPtr ) {
90
- if ( ! isset( $this->tab_width ) ) {
91
- $this->tab_width = Helper::getTabWidth( $this->phpcsFile );
92
- }
93
-
94
- if ( isset( Collections::shortArrayListOpenTokensBC()[ $this->tokens[ $stackPtr ]['code'] ] )
95
- && Arrays::isShortArray( $this->phpcsFile, $stackPtr ) === false
96
- ) {
97
- // Short list, not short array.
98
- return;
99
- }
100
-
101
- /*
102
- * Determine the array opener & closer.
103
- */
104
- $array_open_close = Arrays::getOpenClose( $this->phpcsFile, $stackPtr );
105
- if ( false === $array_open_close ) {
106
- // Array open/close could not be determined.
107
- return;
108
- }
109
-
110
- $opener = $array_open_close['opener'];
111
- $closer = $array_open_close['closer'];
112
-
113
- if ( $this->tokens[ $opener ]['line'] === $this->tokens[ $closer ]['line'] ) {
114
- // Not interested in single line arrays.
115
- return;
116
- }
117
-
118
- /*
119
- * Check the closing bracket is lined up with the start of the content on the line
120
- * containing the array opener.
121
- */
122
- $opener_line_spaces = $this->get_indentation_size( $opener );
123
- $closer_line_spaces = ( $this->tokens[ $closer ]['column'] - 1 );
124
-
125
- if ( $closer_line_spaces !== $opener_line_spaces ) {
126
- $error = 'Array closer not aligned correctly; expected %s space(s) but found %s';
127
- $error_code = 'CloseBraceNotAligned';
128
-
129
- /*
130
- * Report & fix the issue if the close brace is on its own line with
131
- * nothing or only indentation whitespace before it.
132
- */
133
- if ( 0 === $closer_line_spaces
134
- || ( \T_WHITESPACE === $this->tokens[ ( $closer - 1 ) ]['code']
135
- && 1 === $this->tokens[ ( $closer - 1 ) ]['column'] )
136
- ) {
137
- $this->add_array_alignment_error(
138
- $closer,
139
- $error,
140
- $error_code,
141
- $opener_line_spaces,
142
- $closer_line_spaces,
143
- $this->get_indentation_string( $opener_line_spaces )
144
- );
145
- } else {
146
- /*
147
- * Otherwise, only report the error, don't try and fix it (yet).
148
- *
149
- * It will get corrected in a future loop of the fixer once the closer
150
- * has been moved to its own line by the `ArrayDeclarationSpacing` sniff.
151
- */
152
- $this->phpcsFile->addError(
153
- $error,
154
- $closer,
155
- $error_code,
156
- array( $opener_line_spaces, $closer_line_spaces )
157
- );
158
- }
159
-
160
- unset( $error, $error_code );
161
- }
162
-
163
- /*
164
- * Verify & correct the array item indentation.
165
- */
166
- $array_items = PassedParameters::getParameters( $this->phpcsFile, $stackPtr );
167
- if ( empty( $array_items ) ) {
168
- // Strange, no array items found.
169
- return;
170
- }
171
-
172
- $expected_spaces = ( $opener_line_spaces + $this->tab_width );
173
- $expected_indent = $this->get_indentation_string( $expected_spaces );
174
- $end_of_previous_item = $opener;
175
-
176
- foreach ( $array_items as $item ) {
177
- $end_of_this_item = ( $item['end'] + 1 );
178
-
179
- // Find the line on which the item starts.
180
- $first_content = $this->phpcsFile->findNext(
181
- array( \T_WHITESPACE, \T_DOC_COMMENT_WHITESPACE ),
182
- $item['start'],
183
- $end_of_this_item,
184
- true
185
- );
186
-
187
- // Deal with trailing comments.
188
- if ( false !== $first_content
189
- && \T_COMMENT === $this->tokens[ $first_content ]['code']
190
- && $this->tokens[ $first_content ]['line'] === $this->tokens[ $end_of_previous_item ]['line']
191
- ) {
192
- $first_content = $this->phpcsFile->findNext(
193
- array( \T_WHITESPACE, \T_DOC_COMMENT_WHITESPACE, \T_COMMENT ),
194
- ( $first_content + 1 ),
195
- $end_of_this_item,
196
- true
197
- );
198
- }
199
-
200
- if ( false === $first_content ) {
201
- $end_of_previous_item = $end_of_this_item;
202
- continue;
203
- }
204
-
205
- // Bow out from reporting and fixing mixed multi-line/single-line arrays.
206
- // That is handled by the ArrayDeclarationSpacingSniff.
207
- if ( $this->tokens[ $first_content ]['line'] === $this->tokens[ $end_of_previous_item ]['line'] ) {
208
- return $closer;
209
- }
210
-
211
- // Ignore this item if there is anything but whitespace before the start of the next item.
212
- if ( 1 !== $this->tokens[ $first_content ]['column'] ) {
213
- // Go to the start of the line.
214
- $i = $first_content;
215
- while ( 1 !== $this->tokens[ --$i ]['column'] );
216
-
217
- if ( \T_WHITESPACE !== $this->tokens[ $i ]['code'] ) {
218
- $end_of_previous_item = $end_of_this_item;
219
- continue;
220
- }
221
- }
222
-
223
- $found_spaces = ( $this->tokens[ $first_content ]['column'] - 1 );
224
-
225
- if ( $found_spaces !== $expected_spaces ) {
226
- $this->add_array_alignment_error(
227
- $first_content,
228
- 'Array item not aligned correctly; expected %s spaces but found %s',
229
- 'ItemNotAligned',
230
- $expected_spaces,
231
- $found_spaces,
232
- $expected_indent
233
- );
234
- }
235
-
236
- // No need for further checking if this is a one-line array item.
237
- if ( $this->tokens[ $first_content ]['line'] === $this->tokens[ $item['end'] ]['line'] ) {
238
- $end_of_previous_item = $end_of_this_item;
239
- continue;
240
- }
241
-
242
- /*
243
- * Multi-line array items.
244
- *
245
- * Verify & if needed, correct the indentation of subsequent lines.
246
- * Subsequent lines may be indented more or less than the mimimum expected indent,
247
- * but the "first line after" should be indented - at least - as much as the very first line
248
- * of the array item.
249
- * Indentation correction for subsequent lines will be based on that diff.
250
- */
251
-
252
- // Find first token on second line of the array item.
253
- // If the second line is a heredoc/nowdoc, continue on until we find a line with a different token.
254
- // Same for the second line of a multi-line text string.
255
- for ( $ptr = ( $first_content + 1 ); $ptr <= $item['end']; $ptr++ ) {
256
- if ( $this->tokens[ $first_content ]['line'] !== $this->tokens[ $ptr ]['line']
257
- && 1 === $this->tokens[ $ptr ]['column']
258
- && false === $this->ignore_token( $ptr )
259
- ) {
260
- break;
261
- }
262
- }
263
-
264
- $first_content_on_line2 = $this->phpcsFile->findNext(
265
- array( \T_WHITESPACE, \T_DOC_COMMENT_WHITESPACE ),
266
- $ptr,
267
- $end_of_this_item,
268
- true
269
- );
270
-
271
- if ( false === $first_content_on_line2 ) {
272
- /*
273
- * Apparently there were only tokens in the ignore list on subsequent lines.
274
- *
275
- * In that case, the comma after the array item might be on a line by itself,
276
- * so check its placement.
277
- */
278
- if ( $this->tokens[ $item['end'] ]['line'] !== $this->tokens[ $end_of_this_item ]['line']
279
- && \T_COMMA === $this->tokens[ $end_of_this_item ]['code']
280
- && ( $this->tokens[ $end_of_this_item ]['column'] - 1 ) !== $expected_spaces
281
- ) {
282
- $this->add_array_alignment_error(
283
- $end_of_this_item,
284
- 'Comma after multi-line array item not aligned correctly; expected %s spaces, but found %s',
285
- 'MultiLineArrayItemCommaNotAligned',
286
- $expected_spaces,
287
- ( $this->tokens[ $end_of_this_item ]['column'] - 1 ),
288
- $expected_indent
289
- );
290
- }
291
-
292
- $end_of_previous_item = $end_of_this_item;
293
- continue;
294
- }
295
-
296
- $found_spaces_on_line2 = $this->get_indentation_size( $first_content_on_line2 );
297
- $expected_spaces_on_line2 = $expected_spaces;
298
-
299
- if ( $found_spaces < $found_spaces_on_line2 ) {
300
- $expected_spaces_on_line2 += ( $found_spaces_on_line2 - $found_spaces );
301
- }
302
-
303
- if ( $found_spaces_on_line2 !== $expected_spaces_on_line2 ) {
304
-
305
- $fix = $this->phpcsFile->addFixableError(
306
- 'Multi-line array item not aligned correctly; expected %s spaces, but found %s',
307
- $first_content_on_line2,
308
- 'MultiLineArrayItemNotAligned',
309
- array(
310
- $expected_spaces_on_line2,
311
- $found_spaces_on_line2,
312
- )
313
- );
314
-
315
- if ( true === $fix ) {
316
- $expected_indent_on_line2 = $this->get_indentation_string( $expected_spaces_on_line2 );
317
-
318
- $this->phpcsFile->fixer->beginChangeset();
319
-
320
- // Fix second line for the array item.
321
- if ( 1 === $this->tokens[ $first_content_on_line2 ]['column']
322
- && \T_COMMENT === $this->tokens[ $first_content_on_line2 ]['code']
323
- ) {
324
- $actual_comment = ltrim( $this->tokens[ $first_content_on_line2 ]['content'] );
325
- $replacement = $expected_indent_on_line2 . $actual_comment;
326
-
327
- $this->phpcsFile->fixer->replaceToken( $first_content_on_line2, $replacement );
328
-
329
- } else {
330
- $this->fix_alignment_error( $first_content_on_line2, $expected_indent_on_line2 );
331
- }
332
-
333
- // Fix subsequent lines.
334
- for ( $i = ( $first_content_on_line2 + 1 ); $i <= $item['end']; $i++ ) {
335
- // We're only interested in the first token on each line.
336
- if ( 1 !== $this->tokens[ $i ]['column'] ) {
337
- if ( $this->tokens[ $i ]['line'] === $this->tokens[ $item['end'] ]['line'] ) {
338
- // We might as well quit if we're past the first token on the last line.
339
- break;
340
- }
341
- continue;
342
- }
343
-
344
- $first_content_on_line = $this->phpcsFile->findNext(
345
- array( \T_WHITESPACE, \T_DOC_COMMENT_WHITESPACE ),
346
- $i,
347
- $end_of_this_item,
348
- true
349
- );
350
-
351
- if ( false === $first_content_on_line ) {
352
- break;
353
- }
354
-
355
- // Ignore lines with heredoc and nowdoc tokens and subsequent lines in multi-line strings.
356
- if ( true === $this->ignore_token( $first_content_on_line ) ) {
357
- $i = $first_content_on_line;
358
- continue;
359
- }
360
-
361
- $found_spaces_on_line = $this->get_indentation_size( $first_content_on_line );
362
- $expected_spaces_on_line = ( $expected_spaces_on_line2 + ( $found_spaces_on_line - $found_spaces_on_line2 ) );
363
- $expected_spaces_on_line = max( $expected_spaces_on_line, 0 ); // Can't be below 0.
364
- $expected_indent_on_line = $this->get_indentation_string( $expected_spaces_on_line );
365
-
366
- if ( $found_spaces_on_line !== $expected_spaces_on_line ) {
367
- if ( 1 === $this->tokens[ $first_content_on_line ]['column']
368
- && \T_COMMENT === $this->tokens[ $first_content_on_line ]['code']
369
- ) {
370
- $actual_comment = ltrim( $this->tokens[ $first_content_on_line ]['content'] );
371
- $replacement = $expected_indent_on_line . $actual_comment;
372
-
373
- $this->phpcsFile->fixer->replaceToken( $first_content_on_line, $replacement );
374
- } else {
375
- $this->fix_alignment_error( $first_content_on_line, $expected_indent_on_line );
376
- }
377
- }
378
-
379
- // Move past any potential empty lines between the previous non-empty line and this one.
380
- // No need to do the fixes twice.
381
- $i = $first_content_on_line;
382
- }
383
-
384
- /*
385
- * Check the placement of the comma after the array item as it might be on a line by itself.
386
- */
387
- if ( $this->tokens[ $item['end'] ]['line'] !== $this->tokens[ $end_of_this_item ]['line']
388
- && \T_COMMA === $this->tokens[ $end_of_this_item ]['code']
389
- && ( $this->tokens[ $end_of_this_item ]['column'] - 1 ) !== $expected_spaces
390
- ) {
391
- $this->add_array_alignment_error(
392
- $end_of_this_item,
393
- 'Comma after array item not aligned correctly; expected %s spaces, but found %s',
394
- 'MultiLineArrayItemCommaNotAligned',
395
- $expected_spaces,
396
- ( $this->tokens[ $end_of_this_item ]['column'] - 1 ),
397
- $expected_indent
398
- );
399
- }
400
-
401
- $this->phpcsFile->fixer->endChangeset();
402
- }
403
- }
404
-
405
- $end_of_previous_item = $end_of_this_item;
406
- }
407
- }
408
-
409
- /**
410
- * Should the token be ignored ?
411
- *
412
- * This method is only intended to be used with the first token on a line
413
- * for subsequent lines in an multi-line array item.
414
- *
415
- * @param int $ptr Stack pointer to the first token on a line.
416
- *
417
- * @return bool
418
- */
419
- protected function ignore_token( $ptr ) {
420
- $token_code = $this->tokens[ $ptr ]['code'];
421
-
422
- if ( isset( $this->ignore_tokens[ $token_code ] ) ) {
423
- return true;
424
- }
425
-
426
- /*
427
- * If it's a subsequent line of a multi-line sting, it will not start with a quote
428
- * character, nor just *be* a quote character.
429
- */
430
- if ( isset( Tokens::$stringTokens[ $token_code ] ) === true ) {
431
- // Deal with closing quote of a multi-line string being on its own line.
432
- if ( "'" === $this->tokens[ $ptr ]['content']
433
- || '"' === $this->tokens[ $ptr ]['content']
434
- ) {
435
- return true;
436
- }
437
-
438
- // Deal with subsequent lines of a multi-line string where the token is broken up per line.
439
- if ( "'" !== $this->tokens[ $ptr ]['content'][0]
440
- && '"' !== $this->tokens[ $ptr ]['content'][0]
441
- ) {
442
- return true;
443
- }
444
- }
445
-
446
- return false;
447
- }
448
-
449
- /**
450
- * Determine the line indentation whitespace.
451
- *
452
- * @param int $ptr Stack pointer to an arbitrary token on a line.
453
- *
454
- * @return int Nr of spaces found. Where necessary, tabs are translated to spaces.
455
- */
456
- protected function get_indentation_size( $ptr ) {
457
-
458
- // Find the first token on the line.
459
- for ( ; $ptr >= 0; $ptr-- ) {
460
- if ( 1 === $this->tokens[ $ptr ]['column'] ) {
461
- break;
462
- }
463
- }
464
-
465
- $whitespace = '';
466
-
467
- if ( \T_WHITESPACE === $this->tokens[ $ptr ]['code']
468
- || \T_DOC_COMMENT_WHITESPACE === $this->tokens[ $ptr ]['code']
469
- ) {
470
- return $this->tokens[ $ptr ]['length'];
471
- }
472
-
473
- /*
474
- * Special case for multi-line, non-docblock comments.
475
- * Only applicable for subsequent lines in an array item.
476
- *
477
- * First/Single line is tokenized as T_WHITESPACE + T_COMMENT
478
- * Subsequent lines are tokenized as T_COMMENT including the indentation whitespace.
479
- */
480
- if ( \T_COMMENT === $this->tokens[ $ptr ]['code'] ) {
481
- $content = $this->tokens[ $ptr ]['content'];
482
- $actual_comment = ltrim( $content );
483
- $whitespace = str_replace( $actual_comment, '', $content );
484
- }
485
-
486
- return \strlen( $whitespace );
487
- }
488
-
489
- /**
490
- * Create an indentation string.
491
- *
492
- * @param int $nr Number of spaces the indentation should be.
493
- *
494
- * @return string
495
- */
496
- protected function get_indentation_string( $nr ) {
497
- if ( 0 >= $nr ) {
498
- return '';
499
- }
500
-
501
- // Space-based indentation.
502
- if ( false === $this->tabIndent ) {
503
- return str_repeat( ' ', $nr );
504
- }
505
-
506
- // Tab-based indentation.
507
- $num_tabs = (int) floor( $nr / $this->tab_width );
508
- $remaining = ( $nr % $this->tab_width );
509
- $tab_indent = str_repeat( "\t", $num_tabs );
510
- $tab_indent .= str_repeat( ' ', $remaining );
511
-
512
- return $tab_indent;
513
- }
514
-
515
- /**
516
- * Throw an error and fix incorrect array alignment.
517
- *
518
- * @param int $ptr Stack pointer to the first content on the line.
519
- * @param string $error Error message.
520
- * @param string $error_code Error code.
521
- * @param int $expected Expected nr of spaces (tabs translated to space value).
522
- * @param int $found Found nr of spaces (tabs translated to space value).
523
- * @param string $new_indent Whitespace indent replacement content.
524
- *
525
- * @return void
526
- */
527
- protected function add_array_alignment_error( $ptr, $error, $error_code, $expected, $found, $new_indent ) {
528
-
529
- $fix = $this->phpcsFile->addFixableError( $error, $ptr, $error_code, array( $expected, $found ) );
530
- if ( true === $fix ) {
531
- $this->fix_alignment_error( $ptr, $new_indent );
532
- }
533
- }
534
-
535
- /**
536
- * Fix incorrect array alignment.
537
- *
538
- * @param int $ptr Stack pointer to the first content on the line.
539
- * @param string $new_indent Whitespace indent replacement content.
540
- *
541
- * @return void
542
- */
543
- protected function fix_alignment_error( $ptr, $new_indent ) {
544
- if ( 1 === $this->tokens[ $ptr ]['column'] ) {
545
- $this->phpcsFile->fixer->addContentBefore( $ptr, $new_indent );
546
- } else {
547
- $this->phpcsFile->fixer->replaceToken( ( $ptr - 1 ), $new_indent );
548
- }
549
- }
550
- }