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,322 +0,0 @@
1
- <?php
2
- /**
3
- * PHPCSUtils, utility functions and classes for PHP_CodeSniffer sniff developers.
4
- *
5
- * @package PHPCSUtils
6
- * @copyright 2019-2020 PHPCSUtils Contributors
7
- * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
- * @link https://github.com/PHPCSStandards/PHPCSUtils
9
- */
10
-
11
- namespace PHPCSUtils\Utils;
12
-
13
- use PHP_CodeSniffer\Exceptions\RuntimeException;
14
- use PHP_CodeSniffer\Files\File;
15
-
16
- /**
17
- * Utility functions for working with integer/float tokens.
18
- *
19
- * PHP 7.4 introduced numeric literal separators. PHPCS backfills this since PHPCS 3.5.3/4.
20
- * PHP 8.1 introduced an explicit octal notation. This is backfilled in PHPCS since PHPCS 3.7.0.
21
- *
22
- * While there are currently no unsupported numeric syntaxes, the methods in this class
23
- * can still be useful for external standards which need to examine the
24
- * contents of `T_LNUMBER` or `T_DNUMBER` tokens.
25
- *
26
- * @link https://www.php.net/migration74.new-features.php#migration74.new-features.core.numeric-literal-separator
27
- * PHP Manual on numeric literal separators.
28
- * @link https://www.php.net/manual/en/migration81.new-features.php#migration81.new-features.core.octal-literal-prefix
29
- * PHP Manual on the introduction of the integer octal literal prefix.
30
- *
31
- * @since 1.0.0
32
- */
33
- final class Numbers
34
- {
35
-
36
- /**
37
- * Regex to determine whether the contents of an arbitrary string represents a decimal integer.
38
- *
39
- * @since 1.0.0
40
- *
41
- * @var string
42
- */
43
- const REGEX_DECIMAL_INT = '`^(?:0|[1-9][0-9]*)$`D';
44
-
45
- /**
46
- * Regex to determine whether the contents of an arbitrary string represents an octal integer.
47
- *
48
- * @since 1.0.0
49
- *
50
- * @var string
51
- */
52
- const REGEX_OCTAL_INT = '`^0[o]?[0-7]+$`iD';
53
-
54
- /**
55
- * Regex to determine whether the contents of an arbitrary string represents a binary integer.
56
- *
57
- * @since 1.0.0
58
- *
59
- * @var string
60
- */
61
- const REGEX_BINARY_INT = '`^0b[0-1]+$`iD';
62
-
63
- /**
64
- * Regex to determine whether the contents of an arbitrary string represents a hexidecimal integer.
65
- *
66
- * @since 1.0.0
67
- *
68
- * @var string
69
- */
70
- const REGEX_HEX_INT = '`^0x[0-9A-F]+$`iD';
71
-
72
- /**
73
- * Regex to determine whether the contents of an arbitrary string represents a float.
74
- *
75
- * @link https://www.php.net/language.types.float PHP Manual on floats
76
- *
77
- * @since 1.0.0
78
- *
79
- * @var string
80
- */
81
- const REGEX_FLOAT = '`
82
- ^(?:
83
- (?:
84
- (?:
85
- (?P<LNUM>[0-9]+)
86
- |
87
- (?P<DNUM>([0-9]*\.(?P>LNUM)|(?P>LNUM)\.[0-9]*))
88
- )
89
- [e][+-]?(?P>LNUM)
90
- )
91
- |
92
- (?P>DNUM)
93
- |
94
- (?:0|[1-9][0-9]*)
95
- )$
96
- `ixD';
97
-
98
- /**
99
- * Retrieve information about a number token.
100
- *
101
- * Helper function to deal with numeric literals, potentially with underscore separators
102
- * and/or explicit octal notation.
103
- *
104
- * @since 1.0.0
105
- *
106
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
107
- * @param int $stackPtr The position of a T_LNUMBER or T_DNUMBER token.
108
- *
109
- * @return array<string, string|int> An array with information about the number.
110
- * The format of the array return value is:
111
- * ```php
112
- * array(
113
- * 'orig_content' => string, // The original content of the token(s);
114
- * 'content' => string, // The content, underscore(s) removed;
115
- * 'code' => int, // The token code of the number, either
116
- * // T_LNUMBER or T_DNUMBER.
117
- * 'type' => string, // The token type, either 'T_LNUMBER'
118
- * // or 'T_DNUMBER'.
119
- * 'decimal' => string, // The decimal value of the number;
120
- * 'last_token' => int, // The stackPtr to the last token which was
121
- * // part of the number.
122
- * // At this time, this will be always be the original
123
- * // stackPtr. This may change in the future if
124
- * // new numeric syntaxes would be added to PHP.
125
- * )
126
- * ```
127
- *
128
- * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified token is not of type
129
- * `T_LNUMBER` or `T_DNUMBER`.
130
- */
131
- public static function getCompleteNumber(File $phpcsFile, $stackPtr)
132
- {
133
- $tokens = $phpcsFile->getTokens();
134
-
135
- if (isset($tokens[$stackPtr]) === false
136
- || ($tokens[$stackPtr]['code'] !== \T_LNUMBER && $tokens[$stackPtr]['code'] !== \T_DNUMBER)
137
- ) {
138
- throw new RuntimeException(
139
- 'Token type "' . $tokens[$stackPtr]['type'] . '" is not T_LNUMBER or T_DNUMBER'
140
- );
141
- }
142
-
143
- $content = $tokens[$stackPtr]['content'];
144
- return [
145
- 'orig_content' => $content,
146
- 'content' => \str_replace('_', '', $content),
147
- 'code' => $tokens[$stackPtr]['code'],
148
- 'type' => $tokens[$stackPtr]['type'],
149
- 'decimal' => self::getDecimalValue($content),
150
- 'last_token' => $stackPtr,
151
- ];
152
- }
153
-
154
- /**
155
- * Get the decimal number value of a numeric string.
156
- *
157
- * Takes PHP 7.4 numeric literal separators and explicit octal literals in numbers into account.
158
- *
159
- * @since 1.0.0
160
- *
161
- * @param string $textString Arbitrary text string.
162
- * This text string should be the (combined) token content of
163
- * one or more tokens which together represent a number in PHP.
164
- *
165
- * @return string|false Decimal number as a string or `FALSE` if the passed parameter
166
- * was not a numeric string.
167
- * > Note: floating point numbers with exponent will not be expanded,
168
- * but returned as-is.
169
- */
170
- public static function getDecimalValue($textString)
171
- {
172
- if (\is_string($textString) === false || $textString === '') {
173
- return false;
174
- }
175
-
176
- /*
177
- * Remove potential PHP 7.4 numeric literal separators.
178
- *
179
- * {@internal While the is..() functions also do this, this is still needed
180
- * here to allow the hexdec(), bindec() functions to work correctly and for
181
- * the decimal/float to return a cross-version compatible decimal value.}
182
- */
183
- $textString = \str_replace('_', '', $textString);
184
-
185
- if (self::isDecimalInt($textString) === true) {
186
- return $textString;
187
- }
188
-
189
- if (self::isHexidecimalInt($textString) === true) {
190
- return (string) \hexdec($textString);
191
- }
192
-
193
- if (self::isBinaryInt($textString) === true) {
194
- return (string) \bindec($textString);
195
- }
196
-
197
- if (self::isOctalInt($textString) === true) {
198
- return (string) \octdec($textString);
199
- }
200
-
201
- if (self::isFloat($textString) === true) {
202
- return $textString;
203
- }
204
-
205
- return false;
206
- }
207
-
208
- /**
209
- * Verify whether the contents of an arbitrary string represents a decimal integer.
210
- *
211
- * Takes PHP 7.4 numeric literal separators in numbers into account.
212
- *
213
- * @since 1.0.0
214
- *
215
- * @param string $textString Arbitrary string.
216
- *
217
- * @return bool
218
- */
219
- public static function isDecimalInt($textString)
220
- {
221
- if (\is_string($textString) === false || $textString === '') {
222
- return false;
223
- }
224
-
225
- // Remove potential PHP 7.4 numeric literal separators.
226
- $textString = \str_replace('_', '', $textString);
227
-
228
- return (\preg_match(self::REGEX_DECIMAL_INT, $textString) === 1);
229
- }
230
-
231
- /**
232
- * Verify whether the contents of an arbitrary string represents a hexidecimal integer.
233
- *
234
- * Takes PHP 7.4 numeric literal separators in numbers into account.
235
- *
236
- * @since 1.0.0
237
- *
238
- * @param string $textString Arbitrary string.
239
- *
240
- * @return bool
241
- */
242
- public static function isHexidecimalInt($textString)
243
- {
244
- if (\is_string($textString) === false || $textString === '') {
245
- return false;
246
- }
247
-
248
- // Remove potential PHP 7.4 numeric literal separators.
249
- $textString = \str_replace('_', '', $textString);
250
-
251
- return (\preg_match(self::REGEX_HEX_INT, $textString) === 1);
252
- }
253
-
254
- /**
255
- * Verify whether the contents of an arbitrary string represents a binary integer.
256
- *
257
- * Takes PHP 7.4 numeric literal separators in numbers into account.
258
- *
259
- * @since 1.0.0
260
- *
261
- * @param string $textString Arbitrary string.
262
- *
263
- * @return bool
264
- */
265
- public static function isBinaryInt($textString)
266
- {
267
- if (\is_string($textString) === false || $textString === '') {
268
- return false;
269
- }
270
-
271
- // Remove potential PHP 7.4 numeric literal separators.
272
- $textString = \str_replace('_', '', $textString);
273
-
274
- return (\preg_match(self::REGEX_BINARY_INT, $textString) === 1);
275
- }
276
-
277
- /**
278
- * Verify whether the contents of an arbitrary string represents an octal integer.
279
- *
280
- * Takes PHP 7.4 numeric literal separators and explicit octal literals in numbers into account.
281
- *
282
- * @since 1.0.0
283
- *
284
- * @param string $textString Arbitrary string.
285
- *
286
- * @return bool
287
- */
288
- public static function isOctalInt($textString)
289
- {
290
- if (\is_string($textString) === false || $textString === '') {
291
- return false;
292
- }
293
-
294
- // Remove potential PHP 7.4 numeric literal separators.
295
- $textString = \str_replace('_', '', $textString);
296
-
297
- return (\preg_match(self::REGEX_OCTAL_INT, $textString) === 1);
298
- }
299
-
300
- /**
301
- * Verify whether the contents of an arbitrary string represents a floating point number.
302
- *
303
- * Takes PHP 7.4 numeric literal separators in numbers into account.
304
- *
305
- * @since 1.0.0
306
- *
307
- * @param string $textString Arbitrary string.
308
- *
309
- * @return bool
310
- */
311
- public static function isFloat($textString)
312
- {
313
- if (\is_string($textString) === false || $textString === '') {
314
- return false;
315
- }
316
-
317
- // Remove potential PHP 7.4 numeric literal separators.
318
- $textString = \str_replace('_', '', $textString);
319
-
320
- return (\preg_match(self::REGEX_FLOAT, $textString) === 1);
321
- }
322
- }
@@ -1,359 +0,0 @@
1
- <?php
2
- /**
3
- * PHPCSUtils, utility functions and classes for PHP_CodeSniffer sniff developers.
4
- *
5
- * @package PHPCSUtils
6
- * @copyright 2019-2020 PHPCSUtils Contributors
7
- * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
- * @link https://github.com/PHPCSStandards/PHPCSUtils
9
- */
10
-
11
- namespace PHPCSUtils\Utils;
12
-
13
- use PHP_CodeSniffer\Exceptions\RuntimeException;
14
- use PHP_CodeSniffer\Files\File;
15
- use PHP_CodeSniffer\Util\Tokens;
16
- use PHPCSUtils\Tokens\Collections;
17
- use PHPCSUtils\Utils\GetTokensAsString;
18
-
19
- /**
20
- * Utility functions for use when examining object declaration statements.
21
- *
22
- * @since 1.0.0 The `ObjectDeclarations::get(Declaration)Name()`,
23
- * `ObjectDeclarations::getClassProperties()`, `ObjectDeclarations::findExtendedClassName()`
24
- * and `ObjectDeclarations::findImplementedInterfaceNames()` methods are based on and
25
- * inspired by the methods of the same name in the PHPCS native
26
- * PHP_CodeSniffer\Files\File` class.
27
- * Also see {@see \PHPCSUtils\BackCompat\BCFile}.
28
- */
29
- final class ObjectDeclarations
30
- {
31
-
32
- /**
33
- * Retrieves the declaration name for classes, interfaces, traits, enums and functions.
34
- *
35
- * Main differences with the PHPCS version:
36
- * - Defensive coding against incorrect calls to this method.
37
- * - Improved handling of invalid names, like names starting with a number.
38
- * This allows sniffs to report on invalid names instead of ignoring them.
39
- * - Bug fix: improved handling of parse errors.
40
- * Using the original method, a parse error due to an invalid name could cause the method
41
- * to return the name of the *next* construct, a partial name and/or the name of a class
42
- * being extended/interface being implemented.
43
- * Using this version of the utility method, either the complete name (invalid or not) will
44
- * be returned or `null` in case of no name (parse error).
45
- *
46
- * @see \PHP_CodeSniffer\Files\File::getDeclarationName() Original source.
47
- * @see \PHPCSUtils\BackCompat\BCFile::getDeclarationName() Cross-version compatible version of the original.
48
- *
49
- * @since 1.0.0
50
- *
51
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
52
- * @param int $stackPtr The position of the declaration token
53
- * which declared the class, interface,
54
- * trait, enum or function.
55
- *
56
- * @return string|null The name of the class, interface, trait, enum, or function;
57
- * or `NULL` if the passed token doesn't exist, the function or
58
- * class is anonymous or in case of a parse error/live coding.
59
- *
60
- * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified token is not of type
61
- * `T_FUNCTION`, `T_CLASS`, `T_ANON_CLASS`,
62
- * `T_CLOSURE`, `T_TRAIT`, `T_ENUM` or `T_INTERFACE`.
63
- */
64
- public static function getName(File $phpcsFile, $stackPtr)
65
- {
66
- $tokens = $phpcsFile->getTokens();
67
-
68
- if (isset($tokens[$stackPtr]) === false
69
- || ($tokens[$stackPtr]['code'] === \T_ANON_CLASS || $tokens[$stackPtr]['code'] === \T_CLOSURE)
70
- ) {
71
- return null;
72
- }
73
-
74
- $tokenCode = $tokens[$stackPtr]['code'];
75
-
76
- if ($tokenCode !== \T_FUNCTION
77
- && $tokenCode !== \T_CLASS
78
- && $tokenCode !== \T_INTERFACE
79
- && $tokenCode !== \T_TRAIT
80
- && $tokenCode !== \T_ENUM
81
- ) {
82
- throw new RuntimeException(
83
- 'Token type "' . $tokens[$stackPtr]['type']
84
- . '" is not T_FUNCTION, T_CLASS, T_INTERFACE, T_TRAIT or T_ENUM'
85
- );
86
- }
87
-
88
- if ($tokenCode === \T_FUNCTION
89
- && \strtolower($tokens[$stackPtr]['content']) !== 'function'
90
- ) {
91
- // This is a function declared without the "function" keyword.
92
- // So this token is the function name.
93
- return $tokens[$stackPtr]['content'];
94
- }
95
-
96
- /*
97
- * Determine the name. Note that we cannot simply look for the first T_STRING
98
- * because an (invalid) class name starting with a number will be multiple tokens.
99
- * Whitespace or comment are however not allowed within a name.
100
- */
101
-
102
- $stopPoint = $phpcsFile->numTokens;
103
- if ($tokenCode === \T_FUNCTION && isset($tokens[$stackPtr]['parenthesis_opener']) === true) {
104
- $stopPoint = $tokens[$stackPtr]['parenthesis_opener'];
105
- } elseif (isset($tokens[$stackPtr]['scope_opener']) === true) {
106
- $stopPoint = $tokens[$stackPtr]['scope_opener'];
107
- }
108
-
109
- $exclude = Tokens::$emptyTokens;
110
- $exclude[] = \T_OPEN_PARENTHESIS;
111
- $exclude[] = \T_OPEN_CURLY_BRACKET;
112
- $exclude[] = \T_BITWISE_AND;
113
- $exclude[] = \T_COLON; // Backed enums.
114
-
115
- $nameStart = $phpcsFile->findNext($exclude, ($stackPtr + 1), $stopPoint, true);
116
- if ($nameStart === false) {
117
- // Live coding or parse error.
118
- return null;
119
- }
120
-
121
- $tokenAfterNameEnd = $phpcsFile->findNext($exclude, $nameStart, $stopPoint);
122
-
123
- if ($tokenAfterNameEnd === false) {
124
- return $tokens[$nameStart]['content'];
125
- }
126
-
127
- // Name starts with number, so is composed of multiple tokens.
128
- return GetTokensAsString::noEmpties($phpcsFile, $nameStart, ($tokenAfterNameEnd - 1));
129
- }
130
-
131
- /**
132
- * Retrieves the implementation properties of a class.
133
- *
134
- * Main differences with the PHPCS version:
135
- * - Bugs fixed:
136
- * - Handling of PHPCS annotations.
137
- * - Handling of unorthodox docblock placement.
138
- * - Defensive coding against incorrect calls to this method.
139
- * - Additional `'abstract_token'`, `'final_token'`, and `'readonly_token'` indexes in the return array.
140
- *
141
- * @see \PHP_CodeSniffer\Files\File::getClassProperties() Original source.
142
- * @see \PHPCSUtils\BackCompat\BCFile::getClassProperties() Cross-version compatible version of the original.
143
- *
144
- * @since 1.0.0
145
- *
146
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
147
- * @param int $stackPtr The position in the stack of the `T_CLASS`
148
- * token to acquire the properties for.
149
- *
150
- * @return array<string, int|bool> Array with implementation properties of a class.
151
- * The format of the return value is:
152
- * ```php
153
- * array(
154
- * 'is_abstract' => bool, // TRUE if the abstract keyword was found.
155
- * 'abstract_token' => int|false, // The stack pointer to the `abstract` keyword or
156
- * // FALSE if the abstract keyword was not found.
157
- * 'is_final' => bool, // TRUE if the final keyword was found.
158
- * 'final_token' => int|false, // The stack pointer to the `final` keyword or
159
- * // FALSE if the abstract keyword was not found.
160
- * 'is_readonly' => bool, // TRUE if the readonly keyword was found.
161
- * 'readonly_token' => int|false, // The stack pointer to the `readonly` keyword or
162
- * // FALSE if the abstract keyword was not found.
163
- * );
164
- * ```
165
- *
166
- * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
167
- * `T_CLASS` token.
168
- */
169
- public static function getClassProperties(File $phpcsFile, $stackPtr)
170
- {
171
- $tokens = $phpcsFile->getTokens();
172
-
173
- if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_CLASS) {
174
- throw new RuntimeException('$stackPtr must be of type T_CLASS');
175
- }
176
-
177
- $valid = Collections::classModifierKeywords() + Tokens::$emptyTokens;
178
- $properties = [
179
- 'is_abstract' => false,
180
- 'abstract_token' => false,
181
- 'is_final' => false,
182
- 'final_token' => false,
183
- 'is_readonly' => false,
184
- 'readonly_token' => false,
185
- ];
186
-
187
- for ($i = ($stackPtr - 1); $i > 0; $i--) {
188
- if (isset($valid[$tokens[$i]['code']]) === false) {
189
- break;
190
- }
191
-
192
- switch ($tokens[$i]['code']) {
193
- case \T_ABSTRACT:
194
- $properties['is_abstract'] = true;
195
- $properties['abstract_token'] = $i;
196
- break;
197
-
198
- case \T_FINAL:
199
- $properties['is_final'] = true;
200
- $properties['final_token'] = $i;
201
- break;
202
-
203
- case \T_READONLY:
204
- $properties['is_readonly'] = true;
205
- $properties['readonly_token'] = $i;
206
- break;
207
- }
208
- }
209
-
210
- return $properties;
211
- }
212
-
213
- /**
214
- * Retrieves the name of the class that the specified class extends.
215
- *
216
- * Works for classes, anonymous classes and interfaces, though it is strongly recommended
217
- * to use the {@see \PHPCSUtils\Utils\ObjectDeclarations::findExtendedInterfaceNames()}
218
- * method to examine interfaces instead. Interfaces can extend multiple parent interfaces,
219
- * and that use-case is not handled by this method.
220
- *
221
- * Main differences with the PHPCS version:
222
- * - Bugs fixed:
223
- * - Handling of PHPCS annotations.
224
- * - Handling of comments.
225
- * - Handling of the namespace keyword used as operator.
226
- * - Improved handling of parse errors.
227
- * - The returned name will be clean of superfluous whitespace and/or comments.
228
- * - Support for PHP 8.0 tokenization of identifier/namespaced names, cross-version PHP & PHPCS.
229
- *
230
- * @see \PHP_CodeSniffer\Files\File::findExtendedClassName() Original source.
231
- * @see \PHPCSUtils\BackCompat\BCFile::findExtendedClassName() Cross-version compatible version of
232
- * the original.
233
- * @see \PHPCSUtils\Utils\ObjectDeclarations::findExtendedInterfaceNames() Similar method for extended interfaces.
234
- *
235
- * @since 1.0.0
236
- *
237
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
238
- * @param int $stackPtr The stack position of the class or interface.
239
- *
240
- * @return string|false The extended class name or `FALSE` on error or if there
241
- * is no extended class name.
242
- */
243
- public static function findExtendedClassName(File $phpcsFile, $stackPtr)
244
- {
245
- $names = self::findNames($phpcsFile, $stackPtr, \T_EXTENDS, Collections::ooCanExtend());
246
- if ($names === false) {
247
- return false;
248
- }
249
-
250
- // Classes can only extend one parent class.
251
- return \array_shift($names);
252
- }
253
-
254
- /**
255
- * Retrieves the names of the interfaces that the specified class or enum implements.
256
- *
257
- * Main differences with the PHPCS version:
258
- * - Bugs fixed:
259
- * - Handling of PHPCS annotations.
260
- * - Handling of comments.
261
- * - Handling of the namespace keyword used as operator.
262
- * - Improved handling of parse errors.
263
- * - The returned name(s) will be clean of superfluous whitespace and/or comments.
264
- * - Support for PHP 8.0 tokenization of identifier/namespaced names, cross-version PHP & PHPCS.
265
- *
266
- * @see \PHP_CodeSniffer\Files\File::findImplementedInterfaceNames() Original source.
267
- * @see \PHPCSUtils\BackCompat\BCFile::findImplementedInterfaceNames() Cross-version compatible version of
268
- * the original.
269
- *
270
- * @since 1.0.0
271
- *
272
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
273
- * @param int $stackPtr The stack position of the class or enum token.
274
- *
275
- * @return array<string>|false Array with names of the implemented interfaces or `FALSE` on
276
- * error or if there are no implemented interface names.
277
- */
278
- public static function findImplementedInterfaceNames(File $phpcsFile, $stackPtr)
279
- {
280
- return self::findNames($phpcsFile, $stackPtr, \T_IMPLEMENTS, Collections::ooCanImplement());
281
- }
282
-
283
- /**
284
- * Retrieves the names of the interfaces that the specified interface extends.
285
- *
286
- * @see \PHPCSUtils\Utils\ObjectDeclarations::findExtendedClassName() Similar method for extended classes.
287
- *
288
- * @since 1.0.0
289
- *
290
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
291
- * @param int $stackPtr The stack position of the interface keyword.
292
- *
293
- * @return array<string>|false Array with names of the extended interfaces or `FALSE` on
294
- * error or if there are no extended interface names.
295
- */
296
- public static function findExtendedInterfaceNames(File $phpcsFile, $stackPtr)
297
- {
298
- return self::findNames(
299
- $phpcsFile,
300
- $stackPtr,
301
- \T_EXTENDS,
302
- [\T_INTERFACE => \T_INTERFACE]
303
- );
304
- }
305
-
306
- /**
307
- * Retrieves the names of the extended classes or interfaces or the implemented
308
- * interfaces that the specific class/interface declaration extends/implements.
309
- *
310
- * @since 1.0.0
311
- *
312
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
313
- * @param int $stackPtr The stack position of the
314
- * class/interface declaration keyword.
315
- * @param int $keyword The token constant for the keyword to examine.
316
- * Either `T_EXTENDS` or `T_IMPLEMENTS`.
317
- * @param array<int|string, int|string> $allowedFor Array of OO types for which use of the keyword
318
- * is allowed.
319
- *
320
- * @return array<string>|false Returns an array of names or `FALSE` on error or when the object
321
- * being declared does not extend/implement another object.
322
- */
323
- private static function findNames(File $phpcsFile, $stackPtr, $keyword, array $allowedFor)
324
- {
325
- $tokens = $phpcsFile->getTokens();
326
-
327
- if (isset($tokens[$stackPtr]) === false
328
- || isset($allowedFor[$tokens[$stackPtr]['code']]) === false
329
- || isset($tokens[$stackPtr]['scope_opener']) === false
330
- ) {
331
- return false;
332
- }
333
-
334
- $scopeOpener = $tokens[$stackPtr]['scope_opener'];
335
- $keywordPtr = $phpcsFile->findNext($keyword, ($stackPtr + 1), $scopeOpener);
336
- if ($keywordPtr === false) {
337
- return false;
338
- }
339
-
340
- $find = Collections::namespacedNameTokens() + Tokens::$emptyTokens;
341
- $names = [];
342
- $end = $keywordPtr;
343
- do {
344
- $start = ($end + 1);
345
- $end = $phpcsFile->findNext($find, $start, ($scopeOpener + 1), true);
346
- $name = GetTokensAsString::noEmpties($phpcsFile, $start, ($end - 1));
347
-
348
- if (\trim($name) !== '') {
349
- $names[] = $name;
350
- }
351
- } while ($tokens[$end]['code'] === \T_COMMA);
352
-
353
- if (empty($names)) {
354
- return false;
355
- }
356
-
357
- return $names;
358
- }
359
- }