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,828 +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\Internal\Cache;
17
- use PHPCSUtils\Tokens\Collections;
18
- use PHPCSUtils\Utils\GetTokensAsString;
19
- use PHPCSUtils\Utils\ObjectDeclarations;
20
- use PHPCSUtils\Utils\Scopes;
21
- use PHPCSUtils\Utils\UseStatements;
22
-
23
- /**
24
- * Utility functions for use when examining function declaration statements.
25
- *
26
- * @since 1.0.0 The `FunctionDeclarations::getProperties()` and the
27
- * `FunctionDeclarations::getParameters()` methods are based on and
28
- * inspired by respectively the `getMethodProperties()`
29
- * and `getMethodParameters()` methods in the PHPCS native
30
- * `PHP_CodeSniffer\Files\File` class.
31
- * Also see {@see \PHPCSUtils\BackCompat\BCFile}.
32
- */
33
- final class FunctionDeclarations
34
- {
35
-
36
- /**
37
- * A list of all PHP magic functions.
38
- *
39
- * The array keys contain the function names. The values contain the name without the double underscore.
40
- *
41
- * The function names are listed in lowercase as these function names in PHP are case-insensitive
42
- * and comparisons against this list should therefore always be done in a case-insensitive manner.
43
- *
44
- * @since 1.0.0
45
- *
46
- * @var array<string, string>
47
- */
48
- public static $magicFunctions = [
49
- '__autoload' => 'autoload',
50
- ];
51
-
52
- /**
53
- * A list of all PHP magic methods.
54
- *
55
- * The array keys contain the method names. The values contain the name without the double underscore.
56
- *
57
- * The method names are listed in lowercase as these method names in PHP are case-insensitive
58
- * and comparisons against this list should therefore always be done in a case-insensitive manner.
59
- *
60
- * @since 1.0.0
61
- *
62
- * @var array<string, string>
63
- */
64
- public static $magicMethods = [
65
- '__construct' => 'construct',
66
- '__destruct' => 'destruct',
67
- '__call' => 'call',
68
- '__callstatic' => 'callstatic',
69
- '__get' => 'get',
70
- '__set' => 'set',
71
- '__isset' => 'isset',
72
- '__unset' => 'unset',
73
- '__sleep' => 'sleep',
74
- '__wakeup' => 'wakeup',
75
- '__tostring' => 'tostring',
76
- '__set_state' => 'set_state',
77
- '__clone' => 'clone',
78
- '__invoke' => 'invoke',
79
- '__debuginfo' => 'debuginfo', // PHP >= 5.6.
80
- '__serialize' => 'serialize', // PHP >= 7.4.
81
- '__unserialize' => 'unserialize', // PHP >= 7.4.
82
- ];
83
-
84
- /**
85
- * A list of all PHP native non-magic methods starting with a double underscore.
86
- *
87
- * These come from PHP modules such as SOAPClient.
88
- *
89
- * The array keys are the method names, the values the name of the PHP class containing
90
- * the function.
91
- *
92
- * The method names are listed in lowercase as function names in PHP are case-insensitive
93
- * and comparisons against this list should therefore always be done in a case-insensitive manner.
94
- *
95
- * @since 1.0.0
96
- *
97
- * @var array<string, string>
98
- */
99
- public static $methodsDoubleUnderscore = [
100
- '__dorequest' => 'SOAPClient',
101
- '__getcookies' => 'SOAPClient',
102
- '__getfunctions' => 'SOAPClient',
103
- '__getlastrequest' => 'SOAPClient',
104
- '__getlastrequestheaders' => 'SOAPClient',
105
- '__getlastresponse' => 'SOAPClient',
106
- '__getlastresponseheaders' => 'SOAPClient',
107
- '__gettypes' => 'SOAPClient',
108
- '__setcookie' => 'SOAPClient',
109
- '__setlocation' => 'SOAPClient',
110
- '__setsoapheaders' => 'SOAPClient',
111
- '__soapcall' => 'SOAPClient',
112
- ];
113
-
114
- /**
115
- * Returns the declaration name for a function.
116
- *
117
- * Alias for the {@see \PHPCSUtils\Utils\ObjectDeclarations::getName()} method.
118
- *
119
- * @see \PHPCSUtils\BackCompat\BCFile::getDeclarationName() Original function.
120
- * @see \PHPCSUtils\Utils\ObjectDeclarations::getName() PHPCSUtils native improved version.
121
- *
122
- * @since 1.0.0
123
- *
124
- * @codeCoverageIgnore
125
- *
126
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
127
- * @param int $stackPtr The position of the function keyword token.
128
- *
129
- * @return string|null The name of the function; or `NULL` if the passed token doesn't exist,
130
- * the function is anonymous or in case of a parse error/live coding.
131
- *
132
- * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified token is not of type
133
- * `T_FUNCTION`.
134
- */
135
- public static function getName(File $phpcsFile, $stackPtr)
136
- {
137
- return ObjectDeclarations::getName($phpcsFile, $stackPtr);
138
- }
139
-
140
- /**
141
- * Retrieves the visibility and implementation properties of a method.
142
- *
143
- * Main differences with the PHPCS version:
144
- * - Bugs fixed:
145
- * - Handling of PHPCS annotations.
146
- * - `"has_body"` index could be set to `true` for functions without body in the case of
147
- * parse errors or live coding.
148
- * - Defensive coding against incorrect calls to this method.
149
- * - More efficient checking whether a function has a body.
150
- * - Support for PHP 8.0 identifier name tokens in return types, cross-version PHP & PHPCS.
151
- * - The results of this function call are cached during a PHPCS run for faster response times.
152
- *
153
- * @see \PHP_CodeSniffer\Files\File::getMethodProperties() Original source.
154
- * @see \PHPCSUtils\BackCompat\BCFile::getMethodProperties() Cross-version compatible version of the original.
155
- *
156
- * @since 1.0.0
157
- *
158
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
159
- * @param int $stackPtr The position in the stack of the function token to
160
- * acquire the properties for.
161
- *
162
- * @return array<string, mixed> Array with information about a function declaration.
163
- * The format of the return value is:
164
- * ```php
165
- * array(
166
- * 'scope' => string, // Public, private, or protected
167
- * 'scope_specified' => bool, // TRUE if the scope keyword was found.
168
- * 'return_type' => string, // The return type of the method.
169
- * 'return_type_token' => int|false, // The stack pointer to the start of the return type
170
- * // or FALSE if there is no return type.
171
- * 'return_type_end_token' => int|false, // The stack pointer to the end of the return type
172
- * // or FALSE if there is no return type.
173
- * 'nullable_return_type' => bool, // TRUE if the return type is preceded
174
- * // by the nullability operator.
175
- * 'is_abstract' => bool, // TRUE if the abstract keyword was found.
176
- * 'is_final' => bool, // TRUE if the final keyword was found.
177
- * 'is_static' => bool, // TRUE if the static keyword was found.
178
- * 'has_body' => bool, // TRUE if the method has a body
179
- * );
180
- * ```
181
- *
182
- * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a T_FUNCTION
183
- * or T_CLOSURE token, nor an arrow function.
184
- */
185
- public static function getProperties(File $phpcsFile, $stackPtr)
186
- {
187
- $tokens = $phpcsFile->getTokens();
188
-
189
- if (isset($tokens[$stackPtr]) === false
190
- || isset(Collections::functionDeclarationTokens()[$tokens[$stackPtr]['code']]) === false
191
- ) {
192
- throw new RuntimeException('$stackPtr must be of type T_FUNCTION or T_CLOSURE or an arrow function');
193
- }
194
-
195
- if (Cache::isCached($phpcsFile, __METHOD__, $stackPtr) === true) {
196
- return Cache::get($phpcsFile, __METHOD__, $stackPtr);
197
- }
198
-
199
- if ($tokens[$stackPtr]['code'] === \T_FUNCTION) {
200
- $valid = Tokens::$methodPrefixes;
201
- } else {
202
- $valid = [\T_STATIC => \T_STATIC];
203
- }
204
-
205
- $valid += Tokens::$emptyTokens;
206
-
207
- $scope = 'public';
208
- $scopeSpecified = false;
209
- $isAbstract = false;
210
- $isFinal = false;
211
- $isStatic = false;
212
-
213
- for ($i = ($stackPtr - 1); $i > 0; $i--) {
214
- if (isset($valid[$tokens[$i]['code']]) === false) {
215
- break;
216
- }
217
-
218
- switch ($tokens[$i]['code']) {
219
- case \T_PUBLIC:
220
- $scope = 'public';
221
- $scopeSpecified = true;
222
- break;
223
- case \T_PRIVATE:
224
- $scope = 'private';
225
- $scopeSpecified = true;
226
- break;
227
- case \T_PROTECTED:
228
- $scope = 'protected';
229
- $scopeSpecified = true;
230
- break;
231
- case \T_ABSTRACT:
232
- $isAbstract = true;
233
- break;
234
- case \T_FINAL:
235
- $isFinal = true;
236
- break;
237
- case \T_STATIC:
238
- $isStatic = true;
239
- break;
240
- }
241
- }
242
-
243
- $returnType = '';
244
- $returnTypeToken = false;
245
- $returnTypeEndToken = false;
246
- $nullableReturnType = false;
247
- $hasBody = false;
248
- $returnTypeTokens = Collections::returnTypeTokens();
249
-
250
- $parenthesisCloser = null;
251
- if (isset($tokens[$stackPtr]['parenthesis_closer']) === true) {
252
- $parenthesisCloser = $tokens[$stackPtr]['parenthesis_closer'];
253
- }
254
-
255
- if (isset($parenthesisCloser) === true) {
256
- $scopeOpener = null;
257
- if (isset($tokens[$stackPtr]['scope_opener']) === true) {
258
- $scopeOpener = $tokens[$stackPtr]['scope_opener'];
259
- }
260
-
261
- for ($i = $parenthesisCloser; $i < $phpcsFile->numTokens; $i++) {
262
- if ($i === $scopeOpener) {
263
- // End of function definition.
264
- $hasBody = true;
265
- break;
266
- }
267
-
268
- if ($scopeOpener === null && $tokens[$i]['code'] === \T_SEMICOLON) {
269
- // End of abstract/interface function definition.
270
- break;
271
- }
272
-
273
- if ($tokens[$i]['code'] === \T_USE) {
274
- // Skip over closure use statements.
275
- for (
276
- $j = ($i + 1);
277
- $j < $phpcsFile->numTokens && isset(Tokens::$emptyTokens[$tokens[$j]['code']]) === true;
278
- $j++
279
- );
280
-
281
- if ($tokens[$j]['code'] === \T_OPEN_PARENTHESIS) {
282
- if (isset($tokens[$j]['parenthesis_closer']) === false) {
283
- // Live coding/parse error, stop parsing.
284
- break;
285
- }
286
-
287
- $i = $tokens[$j]['parenthesis_closer'];
288
- continue;
289
- }
290
- }
291
-
292
- if ($tokens[$i]['code'] === \T_NULLABLE) {
293
- $nullableReturnType = true;
294
- }
295
-
296
- if (isset($returnTypeTokens[$tokens[$i]['code']]) === true) {
297
- if ($returnTypeToken === false) {
298
- $returnTypeToken = $i;
299
- }
300
-
301
- $returnType .= $tokens[$i]['content'];
302
- $returnTypeEndToken = $i;
303
- }
304
- }
305
- }
306
-
307
- if ($returnType !== '' && $nullableReturnType === true) {
308
- $returnType = '?' . $returnType;
309
- }
310
-
311
- $returnValue = [
312
- 'scope' => $scope,
313
- 'scope_specified' => $scopeSpecified,
314
- 'return_type' => $returnType,
315
- 'return_type_token' => $returnTypeToken,
316
- 'return_type_end_token' => $returnTypeEndToken,
317
- 'nullable_return_type' => $nullableReturnType,
318
- 'is_abstract' => $isAbstract,
319
- 'is_final' => $isFinal,
320
- 'is_static' => $isStatic,
321
- 'has_body' => $hasBody,
322
- ];
323
-
324
- Cache::set($phpcsFile, __METHOD__, $stackPtr, $returnValue);
325
- return $returnValue;
326
- }
327
-
328
- /**
329
- * Retrieves the method parameters for the specified function token.
330
- *
331
- * Also supports passing in a `T_USE` token for a closure use group.
332
- *
333
- * The returned array will contain the following information for each parameter:
334
- *
335
- * ```php
336
- * 0 => array(
337
- * 'name' => string, // The variable name.
338
- * 'token' => int, // The stack pointer to the variable name.
339
- * 'content' => string, // The full content of the variable definition.
340
- * 'has_attributes' => bool, // Does the parameter have one or more attributes attached ?
341
- * 'pass_by_reference' => bool, // Is the variable passed by reference?
342
- * 'reference_token' => int|false, // The stack pointer to the reference operator
343
- * // or FALSE if the param is not passed by reference.
344
- * 'variable_length' => bool, // Is the param of variable length through use of `...` ?
345
- * 'variadic_token' => int|false, // The stack pointer to the ... operator
346
- * // or FALSE if the param is not variable length.
347
- * 'type_hint' => string, // The type hint for the variable.
348
- * 'type_hint_token' => int|false, // The stack pointer to the start of the type hint
349
- * // or FALSE if there is no type hint.
350
- * 'type_hint_end_token' => int|false, // The stack pointer to the end of the type hint
351
- * // or FALSE if there is no type hint.
352
- * 'nullable_type' => bool, // TRUE if the var type is preceded by the nullability
353
- * // operator.
354
- * 'comma_token' => int|false, // The stack pointer to the comma after the param
355
- * // or FALSE if this is the last param.
356
- * )
357
- * ```
358
- *
359
- * Parameters with default values have the following additional array indexes:
360
- * ```php
361
- * 'default' => string, // The full content of the default value.
362
- * 'default_token' => int, // The stack pointer to the start of the default value.
363
- * 'default_equal_token' => int, // The stack pointer to the equals sign.
364
- * ```
365
- *
366
- * Parameters declared using PHP 8 constructor property promotion, have these additional array indexes:
367
- * ```php
368
- * 'property_visibility' => string, // The property visibility as declared.
369
- * 'visibility_token' => int|false, // The stack pointer to the visibility modifier token.
370
- * // or FALSE if the visibility is not explicitly declared.
371
- * 'property_readonly' => bool, // TRUE if the readonly keyword was found.
372
- * 'readonly_token' => int, // The stack pointer to the readonly modifier token.
373
- * // This index will only be set if the property is readonly.
374
- * ```
375
- *
376
- * Main differences with the PHPCS version:
377
- * - Defensive coding against incorrect calls to this method.
378
- * - More efficient and more stable checking whether a `T_USE` token is a closure use.
379
- * - More efficient and more stable looping of the default value.
380
- * - Clearer exception message when a non-closure use token was passed to the function.
381
- * - Support for PHP 8.0 identifier name tokens in parameter types, cross-version PHP & PHPCS.
382
- * - The results of this function call are cached during a PHPCS run for faster response times.
383
- *
384
- * @see \PHP_CodeSniffer\Files\File::getMethodParameters() Original source.
385
- * @see \PHPCSUtils\BackCompat\BCFile::getMethodParameters() Cross-version compatible version of the original.
386
- *
387
- * @since 1.0.0
388
- *
389
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
390
- * @param int $stackPtr The position in the stack of the function token
391
- * to acquire the parameters for.
392
- *
393
- * @return array<int, array<string, mixed>>
394
- *
395
- * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified $stackPtr is not of
396
- * type `T_FUNCTION`, `T_CLOSURE` or `T_USE`,
397
- * nor an arrow function.
398
- * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If a passed `T_USE` token is not a closure
399
- * use token.
400
- */
401
- public static function getParameters(File $phpcsFile, $stackPtr)
402
- {
403
- $tokens = $phpcsFile->getTokens();
404
-
405
- if (isset($tokens[$stackPtr]) === false
406
- || (isset(Collections::functionDeclarationTokens()[$tokens[$stackPtr]['code']]) === false
407
- && $tokens[$stackPtr]['code'] !== \T_USE)
408
- ) {
409
- throw new RuntimeException('$stackPtr must be of type T_FUNCTION, T_CLOSURE or T_USE or an arrow function');
410
- }
411
-
412
- if ($tokens[$stackPtr]['code'] === \T_USE) {
413
- // This will work PHPCS 3.x/4.x cross-version without much overhead.
414
- $opener = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
415
- if ($opener === false
416
- || $tokens[$opener]['code'] !== \T_OPEN_PARENTHESIS
417
- || UseStatements::isClosureUse($phpcsFile, $stackPtr) === false
418
- ) {
419
- throw new RuntimeException('$stackPtr was not a valid closure T_USE');
420
- }
421
- } else {
422
- if (isset($tokens[$stackPtr]['parenthesis_opener']) === false) {
423
- // Live coding or syntax error, so no params to find.
424
- return [];
425
- }
426
-
427
- $opener = $tokens[$stackPtr]['parenthesis_opener'];
428
- }
429
-
430
- if (isset($tokens[$opener]['parenthesis_closer']) === false) {
431
- // Live coding or syntax error, so no params to find.
432
- return [];
433
- }
434
-
435
- if (Cache::isCached($phpcsFile, __METHOD__, $stackPtr) === true) {
436
- return Cache::get($phpcsFile, __METHOD__, $stackPtr);
437
- }
438
-
439
- $closer = $tokens[$opener]['parenthesis_closer'];
440
-
441
- $vars = [];
442
- $currVar = null;
443
- $paramStart = ($opener + 1);
444
- $defaultStart = null;
445
- $equalToken = null;
446
- $paramCount = 0;
447
- $hasAttributes = false;
448
- $passByReference = false;
449
- $referenceToken = false;
450
- $variableLength = false;
451
- $variadicToken = false;
452
- $typeHint = '';
453
- $typeHintToken = false;
454
- $typeHintEndToken = false;
455
- $nullableType = false;
456
- $visibilityToken = null;
457
- $readonlyToken = null;
458
-
459
- $parameterTypeTokens = Collections::parameterTypeTokens();
460
-
461
- for ($i = $paramStart; $i <= $closer; $i++) {
462
- if (isset($parameterTypeTokens[$tokens[$i]['code']]) === true
463
- /*
464
- * Self and parent are valid, static invalid, but was probably intended as type declaration.
465
- * Note: constructor property promotion does not support static properties, so this should
466
- * still be a valid assumption.
467
- */
468
- || $tokens[$i]['code'] === \T_STATIC
469
- ) {
470
- if ($typeHintToken === false) {
471
- $typeHintToken = $i;
472
- }
473
-
474
- $typeHint .= $tokens[$i]['content'];
475
- $typeHintEndToken = $i;
476
- continue;
477
- }
478
-
479
- switch ($tokens[$i]['code']) {
480
- case \T_ATTRIBUTE:
481
- $hasAttributes = true;
482
-
483
- // Skip to the end of the attribute.
484
- $i = $tokens[$i]['attribute_closer'];
485
- break;
486
-
487
- case \T_BITWISE_AND:
488
- $passByReference = true;
489
- $referenceToken = $i;
490
- break;
491
-
492
- case \T_VARIABLE:
493
- $currVar = $i;
494
- break;
495
-
496
- case \T_ELLIPSIS:
497
- $variableLength = true;
498
- $variadicToken = $i;
499
- break;
500
-
501
- case \T_NULLABLE:
502
- $nullableType = true;
503
- $typeHint .= $tokens[$i]['content'];
504
- $typeHintEndToken = $i;
505
- break;
506
-
507
- case \T_PUBLIC:
508
- case \T_PROTECTED:
509
- case \T_PRIVATE:
510
- $visibilityToken = $i;
511
- break;
512
-
513
- case \T_READONLY:
514
- $readonlyToken = $i;
515
- break;
516
-
517
- case \T_CLOSE_PARENTHESIS:
518
- case \T_COMMA:
519
- // If it's null, then there must be no parameters for this
520
- // method.
521
- if ($currVar === null) {
522
- continue 2;
523
- }
524
-
525
- $vars[$paramCount] = [];
526
- $vars[$paramCount]['token'] = $currVar;
527
- $vars[$paramCount]['name'] = $tokens[$currVar]['content'];
528
- $vars[$paramCount]['content'] = \trim(
529
- GetTokensAsString::normal($phpcsFile, $paramStart, ($i - 1))
530
- );
531
-
532
- if ($defaultStart !== null) {
533
- $vars[$paramCount]['default'] = \trim(
534
- GetTokensAsString::normal($phpcsFile, $defaultStart, ($i - 1))
535
- );
536
- $vars[$paramCount]['default_token'] = $defaultStart;
537
- $vars[$paramCount]['default_equal_token'] = $equalToken;
538
- }
539
-
540
- $vars[$paramCount]['has_attributes'] = $hasAttributes;
541
- $vars[$paramCount]['pass_by_reference'] = $passByReference;
542
- $vars[$paramCount]['reference_token'] = $referenceToken;
543
- $vars[$paramCount]['variable_length'] = $variableLength;
544
- $vars[$paramCount]['variadic_token'] = $variadicToken;
545
- $vars[$paramCount]['type_hint'] = $typeHint;
546
- $vars[$paramCount]['type_hint_token'] = $typeHintToken;
547
- $vars[$paramCount]['type_hint_end_token'] = $typeHintEndToken;
548
- $vars[$paramCount]['nullable_type'] = $nullableType;
549
-
550
- if ($visibilityToken !== null || $readonlyToken !== null) {
551
- $vars[$paramCount]['property_visibility'] = 'public';
552
- $vars[$paramCount]['visibility_token'] = false;
553
- $vars[$paramCount]['property_readonly'] = false;
554
-
555
- if ($visibilityToken !== null) {
556
- $vars[$paramCount]['property_visibility'] = $tokens[$visibilityToken]['content'];
557
- $vars[$paramCount]['visibility_token'] = $visibilityToken;
558
- }
559
-
560
- if ($readonlyToken !== null) {
561
- $vars[$paramCount]['property_readonly'] = true;
562
- $vars[$paramCount]['readonly_token'] = $readonlyToken;
563
- }
564
- }
565
-
566
- if ($tokens[$i]['code'] === \T_COMMA) {
567
- $vars[$paramCount]['comma_token'] = $i;
568
- } else {
569
- $vars[$paramCount]['comma_token'] = false;
570
- }
571
-
572
- // Reset the vars, as we are about to process the next parameter.
573
- $currVar = null;
574
- $paramStart = ($i + 1);
575
- $defaultStart = null;
576
- $equalToken = null;
577
- $hasAttributes = false;
578
- $passByReference = false;
579
- $referenceToken = false;
580
- $variableLength = false;
581
- $variadicToken = false;
582
- $typeHint = '';
583
- $typeHintToken = false;
584
- $typeHintEndToken = false;
585
- $nullableType = false;
586
- $visibilityToken = null;
587
- $readonlyToken = null;
588
-
589
- ++$paramCount;
590
- break;
591
-
592
- case \T_EQUAL:
593
- $defaultStart = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true);
594
- $equalToken = $i;
595
-
596
- // Skip past everything in the default value before going into the next switch loop.
597
- for ($j = ($i + 1); $j <= $closer; $j++) {
598
- // Skip past array()'s et al as default values.
599
- if (isset($tokens[$j]['parenthesis_opener'], $tokens[$j]['parenthesis_closer'])) {
600
- $j = $tokens[$j]['parenthesis_closer'];
601
-
602
- if ($j === $closer) {
603
- // Found the end of the parameter.
604
- break;
605
- }
606
-
607
- continue;
608
- }
609
-
610
- // Skip past short arrays et al as default values.
611
- if (isset($tokens[$j]['bracket_opener'])) {
612
- $j = $tokens[$j]['bracket_closer'];
613
- continue;
614
- }
615
-
616
- if ($tokens[$j]['code'] === \T_COMMA) {
617
- break;
618
- }
619
- }
620
-
621
- $i = ($j - 1);
622
- break;
623
- }
624
- }
625
-
626
- Cache::set($phpcsFile, __METHOD__, $stackPtr, $vars);
627
- return $vars;
628
- }
629
-
630
- /**
631
- * Checks if a given function is a PHP magic function.
632
- *
633
- * @todo Add check for the function declaration being namespaced!
634
- *
635
- * @see \PHPCSUtils\Utils\FunctionDeclaration::$magicFunctions List of names of magic functions.
636
- * @see \PHPCSUtils\Utils\FunctionDeclaration::isMagicFunctionName() For when you already know the name of the
637
- * function and scope checking is done in the
638
- * sniff.
639
- *
640
- * @since 1.0.0
641
- *
642
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
643
- * @param int $stackPtr The `T_FUNCTION` token to check.
644
- *
645
- * @return bool
646
- */
647
- public static function isMagicFunction(File $phpcsFile, $stackPtr)
648
- {
649
- $tokens = $phpcsFile->getTokens();
650
- if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_FUNCTION) {
651
- return false;
652
- }
653
-
654
- if (Scopes::isOOMethod($phpcsFile, $stackPtr) === true) {
655
- return false;
656
- }
657
-
658
- $name = self::getName($phpcsFile, $stackPtr);
659
- return self::isMagicFunctionName($name);
660
- }
661
-
662
- /**
663
- * Verify if a given function name is the name of a PHP magic function.
664
- *
665
- * @see \PHPCSUtils\Utils\FunctionDeclaration::$magicFunctions List of names of magic functions.
666
- *
667
- * @since 1.0.0
668
- *
669
- * @param string $name The full function name.
670
- *
671
- * @return bool
672
- */
673
- public static function isMagicFunctionName($name)
674
- {
675
- $name = \strtolower($name);
676
- return (isset(self::$magicFunctions[$name]) === true);
677
- }
678
-
679
- /**
680
- * Checks if a given function is a PHP magic method.
681
- *
682
- * @see \PHPCSUtils\Utils\FunctionDeclaration::$magicMethods List of names of magic methods.
683
- * @see \PHPCSUtils\Utils\FunctionDeclaration::isMagicMethodName() For when you already know the name of the
684
- * method and scope checking is done in the
685
- * sniff.
686
- *
687
- * @since 1.0.0
688
- *
689
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
690
- * @param int $stackPtr The `T_FUNCTION` token to check.
691
- *
692
- * @return bool
693
- */
694
- public static function isMagicMethod(File $phpcsFile, $stackPtr)
695
- {
696
- if (Scopes::isOOMethod($phpcsFile, $stackPtr) === false) {
697
- return false;
698
- }
699
-
700
- $name = self::getName($phpcsFile, $stackPtr);
701
- return self::isMagicMethodName($name);
702
- }
703
-
704
- /**
705
- * Verify if a given function name is the name of a PHP magic method.
706
- *
707
- * @see \PHPCSUtils\Utils\FunctionDeclaration::$magicMethods List of names of magic methods.
708
- *
709
- * @since 1.0.0
710
- *
711
- * @param string $name The full function name.
712
- *
713
- * @return bool
714
- */
715
- public static function isMagicMethodName($name)
716
- {
717
- $name = \strtolower($name);
718
- return (isset(self::$magicMethods[$name]) === true);
719
- }
720
-
721
- /**
722
- * Checks if a given function is a non-magic PHP native double underscore method.
723
- *
724
- * @see \PHPCSUtils\Utils\FunctionDeclaration::$methodsDoubleUnderscore List of the PHP native non-magic
725
- * double underscore method names.
726
- * @see \PHPCSUtils\Utils\FunctionDeclaration::isPHPDoubleUnderscoreMethodName() For when you already know the
727
- * name of the method and scope
728
- * checking is done in the sniff.
729
- *
730
- * @since 1.0.0
731
- *
732
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
733
- * @param int $stackPtr The `T_FUNCTION` token to check.
734
- *
735
- * @return bool
736
- */
737
- public static function isPHPDoubleUnderscoreMethod(File $phpcsFile, $stackPtr)
738
- {
739
- $tokens = $phpcsFile->getTokens();
740
- if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_FUNCTION) {
741
- return false;
742
- }
743
-
744
- $scopePtr = Scopes::validDirectScope($phpcsFile, $stackPtr, Tokens::$ooScopeTokens);
745
- if ($scopePtr === false) {
746
- return false;
747
- }
748
-
749
- /*
750
- * If this is a class, make sure it extends something, as otherwise, the methods
751
- * still can't be overloads for the SOAPClient methods.
752
- * For a trait/interface we don't know the concrete implementation context, so skip
753
- * this check.
754
- */
755
- if ($tokens[$scopePtr]['code'] === \T_CLASS || $tokens[$scopePtr]['code'] === \T_ANON_CLASS) {
756
- $extends = ObjectDeclarations::findExtendedClassName($phpcsFile, $scopePtr);
757
- if ($extends === false) {
758
- return false;
759
- }
760
- }
761
-
762
- $name = self::getName($phpcsFile, $stackPtr);
763
- return self::isPHPDoubleUnderscoreMethodName($name);
764
- }
765
-
766
- /**
767
- * Verify if a given function name is the name of a non-magic PHP native double underscore method.
768
- *
769
- * @see \PHPCSUtils\Utils\FunctionDeclaration::$methodsDoubleUnderscore List of the PHP native non-magic
770
- * double underscore method names.
771
- *
772
- * @since 1.0.0
773
- *
774
- * @param string $name The full function name.
775
- *
776
- * @return bool
777
- */
778
- public static function isPHPDoubleUnderscoreMethodName($name)
779
- {
780
- $name = \strtolower($name);
781
- return (isset(self::$methodsDoubleUnderscore[$name]) === true);
782
- }
783
-
784
- /**
785
- * Checks if a given function is a magic method or a PHP native double underscore method.
786
- *
787
- * {@internal Not the most efficient way of checking this, but less efficient ways will get
788
- * less reliable results or introduce a lot of code duplication.}
789
- *
790
- * @see \PHPCSUtils\Utils\FunctionDeclaration::isSpecialMethodName() For when you already know the name of the
791
- * method and scope checking is done in the
792
- * sniff.
793
- *
794
- * @since 1.0.0
795
- *
796
- * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
797
- * @param int $stackPtr The `T_FUNCTION` token to check.
798
- *
799
- * @return bool
800
- */
801
- public static function isSpecialMethod(File $phpcsFile, $stackPtr)
802
- {
803
- if (self::isMagicMethod($phpcsFile, $stackPtr) === true) {
804
- return true;
805
- }
806
-
807
- if (self::isPHPDoubleUnderscoreMethod($phpcsFile, $stackPtr) === true) {
808
- return true;
809
- }
810
-
811
- return false;
812
- }
813
-
814
- /**
815
- * Verify if a given function name is the name of a magic method or a PHP native double underscore method.
816
- *
817
- * @since 1.0.0
818
- *
819
- * @param string $name The full function name.
820
- *
821
- * @return bool
822
- */
823
- public static function isSpecialMethodName($name)
824
- {
825
- $name = \strtolower($name);
826
- return (isset(self::$magicMethods[$name]) === true || isset(self::$methodsDoubleUnderscore[$name]) === true);
827
- }
828
- }