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.
- package/composer.json +2 -3
- package/composer.lock +3 -313
- package/index.js +38 -21
- package/lib/blocks.js +8 -6
- package/lib/style.js +17 -0
- package/package.json +1 -1
- package/vendor/composer/autoload_classmap.php +0 -37
- package/vendor/composer/autoload_psr4.php +0 -1
- package/vendor/composer/autoload_real.php +2 -0
- package/vendor/composer/autoload_static.php +0 -53
- package/vendor/composer/installed.json +1 -329
- package/vendor/composer/installed.php +3 -39
- package/vendor/composer/platform_check.php +26 -0
- package/lib/bustCache.js +0 -14
- package/vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md +0 -22
- package/vendor/dealerdirect/phpcodesniffer-composer-installer/README.md +0 -285
- package/vendor/dealerdirect/phpcodesniffer-composer-installer/composer.json +0 -71
- package/vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php +0 -637
- package/vendor/phpcsstandards/phpcsextra/CHANGELOG.md +0 -590
- package/vendor/phpcsstandards/phpcsextra/LICENSE +0 -165
- package/vendor/phpcsstandards/phpcsextra/Modernize/Docs/FunctionCalls/DirnameStandard.xml +0 -40
- package/vendor/phpcsstandards/phpcsextra/Modernize/Sniffs/FunctionCalls/DirnameSniff.php +0 -382
- package/vendor/phpcsstandards/phpcsextra/Modernize/ruleset.xml +0 -5
- package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/ArrayBraceSpacingStandard.xml +0 -94
- package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Docs/Arrays/CommaAfterLastStandard.xml +0 -43
- package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/ArrayBraceSpacingSniff.php +0 -305
- package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/Sniffs/Arrays/CommaAfterLastSniff.php +0 -226
- package/vendor/phpcsstandards/phpcsextra/NormalizedArrays/ruleset.xml +0 -5
- package/vendor/phpcsstandards/phpcsextra/README.md +0 -573
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DisallowShortArraySyntaxStandard.xml +0 -27
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/DuplicateArrayKeyStandard.xml +0 -44
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedArrayKeyTypesStandard.xml +0 -40
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Arrays/MixedKeyedUnkeyedArrayStandard.xml +0 -31
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowAnonClassParenthesesStandard.xml +0 -24
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/DisallowFinalClassStandard.xml +0 -25
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/ModifierKeywordOrderStandard.xml +0 -27
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireAnonClassParenthesesStandard.xml +0 -23
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Classes/RequireFinalClassStandard.xml +0 -25
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ConstructorDestructorReturnStandard.xml +0 -64
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/ForeachUniqueAssignmentStandard.xml +0 -26
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoDoubleNegativeStandard.xml +0 -27
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/NoEchoSprintfStandard.xml +0 -25
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/CodeAnalysis/StaticInFinalClassStandard.xml +0 -43
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/LowercaseClassResolutionKeywordStandard.xml +0 -23
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/ModifierKeywordOrderStandard.xml +0 -30
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Constants/UppercaseMagicConstantsStandard.xml +0 -25
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowAlternativeSyntaxStandard.xml +0 -35
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/DisallowLonelyIfStandard.xml +0 -49
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/ControlStructures/IfElseDeclarationStandard.xml +0 -37
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Files/SeparateFunctionsFromOOStandard.xml +0 -45
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/NoLongClosuresStandard.xml +0 -42
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/FunctionDeclarations/RequireFinalMethodsInTraitsStandard.xml +0 -33
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowLongListSyntaxStandard.xml +0 -23
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Lists/DisallowShortListSyntaxStandard.xml +0 -23
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowCurlyBraceSyntaxStandard.xml +0 -27
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/DisallowDeclarationWithoutNameStandard.xml +0 -25
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/EnforceCurlyBraceSyntaxStandard.xml +0 -27
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Namespaces/OneDeclarationPerFileStandard.xml +0 -27
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/NamingConventions/NoReservedKeywordParameterNamesStandard.xml +0 -23
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/OOStructures/AlphabeticExtendsImplementsStandard.xml +0 -27
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/ConcatPositionStandard.xml +0 -31
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowLogicalAndOrStandard.xml +0 -30
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowShortTernaryStandard.xml +0 -26
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/DisallowStandalonePostIncrementDecrementStandard.xml +0 -44
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/StrictComparisonsStandard.xml +0 -29
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/Operators/TypeSeparatorSpacingStandard.xml +0 -33
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/LowercasePHPTagStandard.xml +0 -25
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/PHP/OneStatementInShortEchoTagStandard.xml +0 -41
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowMixedGroupUseStandard.xml +0 -39
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseClassStandard.xml +0 -25
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseConstStandard.xml +0 -25
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/DisallowUseFunctionStandard.xml +0 -25
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/KeywordSpacingStandard.xml +0 -29
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/LowercaseFunctionConstStandard.xml +0 -25
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoLeadingBackslashStandard.xml +0 -23
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/UseStatements/NoUselessAliasesStandard.xml +0 -30
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/AnonClassKeywordSpacingStandard.xml +0 -31
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/CommaSpacingStandard.xml +0 -94
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/DisallowInlineTabsStandard.xml +0 -25
- package/vendor/phpcsstandards/phpcsextra/Universal/Docs/WhiteSpace/PrecisionAlignmentStandard.xml +0 -29
- package/vendor/phpcsstandards/phpcsextra/Universal/Helpers/DummyTokenizer.php +0 -60
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php +0 -89
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/DuplicateArrayKeySniff.php +0 -297
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedArrayKeyTypesSniff.php +0 -174
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Arrays/MixedKeyedUnkeyedArraySniff.php +0 -134
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowAnonClassParenthesesSniff.php +0 -112
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/DisallowFinalClassSniff.php +0 -116
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/ModifierKeywordOrderSniff.php +0 -188
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireAnonClassParenthesesSniff.php +0 -81
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Classes/RequireFinalClassSniff.php +0 -102
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ConstructorDestructorReturnSniff.php +0 -211
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/ForeachUniqueAssignmentSniff.php +0 -153
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoDoubleNegativeSniff.php +0 -269
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/NoEchoSprintfSniff.php +0 -131
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/CodeAnalysis/StaticInFinalClassSniff.php +0 -216
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/LowercaseClassResolutionKeywordSniff.php +0 -106
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/ModifierKeywordOrderSniff.php +0 -199
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Constants/UppercaseMagicConstantsSniff.php +0 -89
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowAlternativeSyntaxSniff.php +0 -216
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/DisallowLonelyIfSniff.php +0 -348
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/ControlStructures/IfElseDeclarationSniff.php +0 -164
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Files/SeparateFunctionsFromOOSniff.php +0 -190
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/NoLongClosuresSniff.php +0 -233
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/FunctionDeclarations/RequireFinalMethodsInTraitsSniff.php +0 -120
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowLongListSyntaxSniff.php +0 -71
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Lists/DisallowShortListSyntaxSniff.php +0 -86
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowCurlyBraceSyntaxSniff.php +0 -81
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/DisallowDeclarationWithoutNameSniff.php +0 -80
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/EnforceCurlyBraceSyntaxSniff.php +0 -81
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Namespaces/OneDeclarationPerFileSniff.php +0 -96
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/NamingConventions/NoReservedKeywordParameterNamesSniff.php +0 -190
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/OOStructures/AlphabeticExtendsImplementsSniff.php +0 -275
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/ConcatPositionSniff.php +0 -204
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowLogicalAndOrSniff.php +0 -112
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowShortTernarySniff.php +0 -76
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/DisallowStandalonePostIncrementDecrementSniff.php +0 -197
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/StrictComparisonsSniff.php +0 -116
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/Operators/TypeSeparatorSpacingSniff.php +0 -85
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/LowercasePHPTagSniff.php +0 -87
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/OneStatementInShortEchoTagSniff.php +0 -101
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowMixedGroupUseSniff.php +0 -248
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseClassSniff.php +0 -211
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseConstSniff.php +0 -211
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/DisallowUseFunctionSniff.php +0 -211
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/KeywordSpacingSniff.php +0 -207
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/LowercaseFunctionConstSniff.php +0 -156
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoLeadingBackslashSniff.php +0 -170
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/UseStatements/NoUselessAliasesSniff.php +0 -155
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/AnonClassKeywordSpacingSniff.php +0 -79
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/CommaSpacingSniff.php +0 -408
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/DisallowInlineTabsSniff.php +0 -173
- package/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php +0 -445
- package/vendor/phpcsstandards/phpcsextra/Universal/ruleset.xml +0 -5
- package/vendor/phpcsstandards/phpcsextra/composer.json +0 -69
- package/vendor/phpcsstandards/phpcsutils/.phpdoc.xml.dist +0 -36
- package/vendor/phpcsstandards/phpcsutils/CHANGELOG.md +0 -1106
- package/vendor/phpcsstandards/phpcsutils/LICENSE +0 -165
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php +0 -551
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php +0 -781
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php +0 -123
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/Helper.php +0 -202
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/InvalidTokenArray.php +0 -44
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestFileNotFound.php +0 -47
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestMarkerNotFound.php +0 -43
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Exceptions/TestTargetNotFound.php +0 -50
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Fixers/SpacesFixer.php +0 -246
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/Cache.php +0 -218
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/IsShortArrayOrList.php +0 -687
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/IsShortArrayOrListWithCache.php +0 -269
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/NoFileCache.php +0 -164
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Internal/StableCollections.php +0 -75
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/UtilityMethodTestCase.php +0 -459
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/Collections.php +0 -837
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/TokenHelper.php +0 -55
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Arrays.php +0 -227
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Conditions.php +0 -156
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Context.php +0 -232
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ControlStructures.php +0 -276
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/FunctionDeclarations.php +0 -828
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/GetTokensAsString.php +0 -262
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Lists.php +0 -359
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/MessageHelper.php +0 -145
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Namespaces.php +0 -389
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/NamingConventions.php +0 -116
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Numbers.php +0 -322
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ObjectDeclarations.php +0 -359
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Operators.php +0 -252
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Orthography.php +0 -120
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Parentheses.php +0 -419
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/PassedParameters.php +0 -510
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Scopes.php +0 -143
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/TextStrings.php +0 -331
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/UseStatements.php +0 -432
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Variables.php +0 -333
- package/vendor/phpcsstandards/phpcsutils/PHPCSUtils/ruleset.xml +0 -4
- package/vendor/phpcsstandards/phpcsutils/README.md +0 -297
- package/vendor/phpcsstandards/phpcsutils/composer.json +0 -92
- package/vendor/phpcsstandards/phpcsutils/phpcsutils-autoload.php +0 -68
- package/vendor/wp-coding-standards/wpcs/CHANGELOG.md +0 -1654
- package/vendor/wp-coding-standards/wpcs/LICENSE +0 -21
- package/vendor/wp-coding-standards/wpcs/README.md +0 -261
- package/vendor/wp-coding-standards/wpcs/WordPress/AbstractArrayAssignmentRestrictionsSniff.php +0 -261
- package/vendor/wp-coding-standards/wpcs/WordPress/AbstractClassRestrictionsSniff.php +0 -257
- package/vendor/wp-coding-standards/wpcs/WordPress/AbstractFunctionParameterSniff.php +0 -111
- package/vendor/wp-coding-standards/wpcs/WordPress/AbstractFunctionRestrictionsSniff.php +0 -358
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/ArrayIndentationStandard.xml +0 -116
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/ArrayKeySpacingRestrictionsStandard.xml +0 -31
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Arrays/MultipleStatementAlignmentStandard.xml +0 -50
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/CodeAnalysis/EscapedNotTranslatedStandard.xml +0 -24
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/DateTime/CurrentTimeTimestampStandard.xml +0 -35
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/DateTime/RestrictedFunctionsStandard.xml +0 -54
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/PrefixAllGlobalsStandard.xml +0 -119
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/ValidHookNameStandard.xml +0 -35
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/ValidPostTypeSlugStandard.xml +0 -121
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/PHP/IniSetStandard.xml +0 -40
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/PHP/StrictInArrayStandard.xml +0 -53
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/PHP/YodaConditionsStandard.xml +0 -27
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/Security/SafeRedirectStandard.xml +0 -23
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/CapabilitiesStandard.xml +0 -69
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/CapitalPDangitStandard.xml +0 -43
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/ClassNameCaseStandard.xml +0 -23
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/CronIntervalStandard.xml +0 -45
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedClassesStandard.xml +0 -23
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedFunctionsStandard.xml +0 -23
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedParameterValuesStandard.xml +0 -23
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/DeprecatedParametersStandard.xml +0 -40
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/EnqueuedResourceParametersStandard.xml +0 -92
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/EnqueuedResourcesStandard.xml +0 -57
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WP/PostsPerPageStandard.xml +0 -73
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/CastStructureSpacingStandard.xml +0 -27
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/ControlStructureSpacingStandard.xml +0 -150
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/ObjectOperatorSpacingStandard.xml +0 -19
- package/vendor/wp-coding-standards/wpcs/WordPress/Docs/WhiteSpace/OperatorSpacingStandard.xml +0 -61
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ArrayWalkingFunctionsHelper.php +0 -108
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ConstantsHelper.php +0 -135
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ContextHelper.php +0 -394
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/DeprecationHelper.php +0 -84
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/EscapingFunctionsTrait.php +0 -256
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/FormattingFunctionsHelper.php +0 -60
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/IsUnitTestTrait.php +0 -238
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ListHelper.php +0 -101
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/MinimumWPVersionTrait.php +0 -159
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/PrintingFunctionsTrait.php +0 -122
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/RulesetPropertyHelper.php +0 -73
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/SanitizationHelperTrait.php +0 -418
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/SnakeCaseHelper.php +0 -60
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/UnslashingFunctionsHelper.php +0 -59
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/ValidationHelper.php +0 -349
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/VariableHelper.php +0 -262
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/WPDBTrait.php +0 -115
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/WPGlobalVariablesHelper.php +0 -312
- package/vendor/wp-coding-standards/wpcs/WordPress/Helpers/WPHookHelper.php +0 -113
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniff.php +0 -72
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/ArrayDeclarationSpacingSniff.php +0 -252
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/ArrayIndentationSniff.php +0 -550
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/ArrayKeySpacingRestrictionsSniff.php +0 -174
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/MultipleStatementAlignmentSniff.php +0 -583
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/CodeAnalysis/AssignmentInTernaryConditionSniff.php +0 -173
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/CodeAnalysis/EscapedNotTranslatedSniff.php +0 -89
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/DirectDatabaseQuerySniff.php +0 -301
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/PreparedSQLPlaceholdersSniff.php +0 -761
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/PreparedSQLSniff.php +0 -242
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/RestrictedClassesSniff.php +0 -57
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/RestrictedFunctionsSniff.php +0 -63
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DB/SlowDBQuerySniff.php +0 -58
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DateTime/CurrentTimeTimestampSniff.php +0 -168
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/DateTime/RestrictedFunctionsSniff.php +0 -59
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Files/FileNameSniff.php +0 -313
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php +0 -1297
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidFunctionNameSniff.php +0 -188
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidHookNameSniff.php +0 -277
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidPostTypeSlugSniff.php +0 -230
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/NamingConventions/ValidVariableNameSniff.php +0 -289
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/DevelopmentFunctionsSniff.php +0 -63
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/DiscouragedPHPFunctionsSniff.php +0 -100
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/DontExtractSniff.php +0 -52
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/IniSetSniff.php +0 -193
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/NoSilencedErrorsSniff.php +0 -245
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/POSIXFunctionsSniff.php +0 -73
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/PregQuoteDelimiterSniff.php +0 -70
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/RestrictedPHPFunctionsSniff.php +0 -45
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/StrictInArraySniff.php +0 -122
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/TypeCastsSniff.php +0 -90
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/PHP/YodaConditionsSniff.php +0 -124
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/EscapeOutputSniff.php +0 -903
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/NonceVerificationSniff.php +0 -422
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/PluginMenuSlugSniff.php +0 -126
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/SafeRedirectSniff.php +0 -45
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Security/ValidatedSanitizedInputSniff.php +0 -244
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php +0 -862
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/AlternativeFunctionsSniff.php +0 -371
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/CapabilitiesSniff.php +0 -478
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/CapitalPDangitSniff.php +0 -315
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/ClassNameCaseSniff.php +0 -897
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/CronIntervalSniff.php +0 -321
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedClassesSniff.php +0 -152
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedFunctionsSniff.php +0 -1708
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedParameterValuesSniff.php +0 -291
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DeprecatedParametersSniff.php +0 -509
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DiscouragedConstantsSniff.php +0 -160
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/DiscouragedFunctionsSniff.php +0 -54
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/EnqueuedResourceParametersSniff.php +0 -241
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/EnqueuedResourcesSniff.php +0 -108
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/GlobalVariablesOverrideSniff.php +0 -436
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/I18nSniff.php +0 -977
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WP/PostsPerPageSniff.php +0 -102
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/CastStructureSpacingSniff.php +0 -59
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php +0 -486
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/ObjectOperatorSpacingSniff.php +0 -63
- package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/OperatorSpacingSniff.php +0 -60
- package/vendor/wp-coding-standards/wpcs/WordPress/ruleset.xml +0 -13
- package/vendor/wp-coding-standards/wpcs/WordPress-Core/ruleset.xml +0 -948
- package/vendor/wp-coding-standards/wpcs/WordPress-Docs/ruleset.xml +0 -109
- package/vendor/wp-coding-standards/wpcs/WordPress-Extra/ruleset.xml +0 -199
- package/vendor/wp-coding-standards/wpcs/composer.json +0 -88
- package/vendor/wp-coding-standards/wpcs/phpcs.xml.dist.sample +0 -153
|
@@ -1,262 +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
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Utility functions to retrieve the content of a set of tokens as a string.
|
|
19
|
-
*
|
|
20
|
-
* In contrast to the PHPCS native {@see \PHP_CodeSniffer\Files\File::getTokensAsString()} method,
|
|
21
|
-
* which has `$length` as the third parameter, all methods in this class expect a stack pointer to
|
|
22
|
-
* an `$end` token (inclusive) as the third parameter.
|
|
23
|
-
*
|
|
24
|
-
* @since 1.0.0 The principle of this class is loosely based on and inspired by the
|
|
25
|
-
* {@see \PHP_CodeSniffer\Files\File::getTokensAsString()} method in the
|
|
26
|
-
* PHPCS native `File` class.
|
|
27
|
-
* Also see {@see \PHPCSUtils\BackCompat\BCFile::getTokensAsString()}.
|
|
28
|
-
*/
|
|
29
|
-
final class GetTokensAsString
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Retrieve the tab-replaced content of the tokens from the specified start position in
|
|
34
|
-
* the token stack to the specified end position (inclusive).
|
|
35
|
-
*
|
|
36
|
-
* Alias for the {@see \PHPCSUtils\Utils\GetTokensAsString::tabReplaced()} method.
|
|
37
|
-
*
|
|
38
|
-
* @since 1.0.0
|
|
39
|
-
*
|
|
40
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
41
|
-
* @param int $start The position to start from in the token stack.
|
|
42
|
-
* @param int $end The position to end at in the token stack (inclusive).
|
|
43
|
-
*
|
|
44
|
-
* @return string The token contents.
|
|
45
|
-
*
|
|
46
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified start position does not exist.
|
|
47
|
-
*/
|
|
48
|
-
public static function normal(File $phpcsFile, $start, $end)
|
|
49
|
-
{
|
|
50
|
-
return self::tabReplaced($phpcsFile, $start, $end);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Retrieve the tab-replaced content of the tokens from the specified start position in
|
|
55
|
-
* the token stack to the specified end position (inclusive).
|
|
56
|
-
*
|
|
57
|
-
* This is the default behaviour for PHPCS.
|
|
58
|
-
*
|
|
59
|
-
* If the `tabWidth` is set, either via a (custom) ruleset, the config file or by passing it
|
|
60
|
-
* on the command-line, PHPCS will automatically replace tabs with spaces.
|
|
61
|
-
* The `'content'` index key in the `$tokens` array will contain the tab-replaced content.
|
|
62
|
-
* The `'orig_content'` index key in the `$tokens` array will contain the original content.
|
|
63
|
-
*
|
|
64
|
-
* @see \PHP_CodeSniffer\Files\File::getTokensAsString() Similar length-based function.
|
|
65
|
-
* @see \PHPCSUtils\BackCompat\BCFile::getTokensAsString() Cross-version compatible version of the original.
|
|
66
|
-
*
|
|
67
|
-
* @since 1.0.0
|
|
68
|
-
*
|
|
69
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
70
|
-
* @param int $start The position to start from in the token stack.
|
|
71
|
-
* @param int $end The position to end at in the token stack (inclusive).
|
|
72
|
-
*
|
|
73
|
-
* @return string The token contents.
|
|
74
|
-
*
|
|
75
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified start position does not exist.
|
|
76
|
-
*/
|
|
77
|
-
public static function tabReplaced(File $phpcsFile, $start, $end)
|
|
78
|
-
{
|
|
79
|
-
return self::getString($phpcsFile, $start, $end);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Retrieve the original content of the tokens from the specified start position in
|
|
84
|
-
* the token stack to the specified end position (inclusive).
|
|
85
|
-
*
|
|
86
|
-
* In contrast to the {@see GetTokensAsString::tabReplaced()} method, this method will return
|
|
87
|
-
* the original token content for the specified tokens.
|
|
88
|
-
* That means that if the original content contained tabs, the return value of this function
|
|
89
|
-
* will also contain tabs.
|
|
90
|
-
*
|
|
91
|
-
* The same can be achieved in PHPCS since version 3.3.0, by calling the
|
|
92
|
-
* {@see \PHP_CodeSniffer\Files\File::getTokensAsString()} method and passing `true` as the
|
|
93
|
-
* value for the `$origContent` parameter.
|
|
94
|
-
*
|
|
95
|
-
* @see \PHP_CodeSniffer\Files\File::getTokensAsString() Similar length-based function.
|
|
96
|
-
* @see \PHPCSUtils\BackCompat\BCFile::getTokensAsString() Cross-version compatible version of the original.
|
|
97
|
-
*
|
|
98
|
-
* @since 1.0.0
|
|
99
|
-
*
|
|
100
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
101
|
-
* @param int $start The position to start from in the token stack.
|
|
102
|
-
* @param int $end The position to end at in the token stack (inclusive).
|
|
103
|
-
*
|
|
104
|
-
* @return string The token contents.
|
|
105
|
-
*
|
|
106
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified start position does not exist.
|
|
107
|
-
*/
|
|
108
|
-
public static function origContent(File $phpcsFile, $start, $end)
|
|
109
|
-
{
|
|
110
|
-
return self::getString($phpcsFile, $start, $end, true);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Retrieve the content of the tokens from the specified start position in the token
|
|
115
|
-
* stack to the specified end position (inclusive) without comments.
|
|
116
|
-
*
|
|
117
|
-
* @see \PHP_CodeSniffer\Files\File::getTokensAsString() Loosely related function.
|
|
118
|
-
*
|
|
119
|
-
* @since 1.0.0
|
|
120
|
-
*
|
|
121
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
122
|
-
* @param int $start The position to start from in the token stack.
|
|
123
|
-
* @param int $end The position to end at in the token stack (inclusive).
|
|
124
|
-
*
|
|
125
|
-
* @return string The token contents stripped off comments.
|
|
126
|
-
*
|
|
127
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified start position does not exist.
|
|
128
|
-
*/
|
|
129
|
-
public static function noComments(File $phpcsFile, $start, $end)
|
|
130
|
-
{
|
|
131
|
-
return self::getString($phpcsFile, $start, $end, false, true);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Retrieve the code-tokens only content of the tokens from the specified start position
|
|
136
|
-
* in the token stack to the specified end position (inclusive) without whitespace or comments.
|
|
137
|
-
*
|
|
138
|
-
* This is useful, for instance, to retrieve a namespace name without stray whitespace or comments.
|
|
139
|
-
* Use this function selectively and with care!
|
|
140
|
-
*
|
|
141
|
-
* @see \PHP_CodeSniffer\Files\File::getTokensAsString() Loosely related function.
|
|
142
|
-
*
|
|
143
|
-
* @since 1.0.0
|
|
144
|
-
*
|
|
145
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
146
|
-
* @param int $start The position to start from in the token stack.
|
|
147
|
-
* @param int $end The position to end at in the token stack (inclusive).
|
|
148
|
-
*
|
|
149
|
-
* @return string The token contents stripped off comments and whitespace.
|
|
150
|
-
*
|
|
151
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified start position does not exist.
|
|
152
|
-
*/
|
|
153
|
-
public static function noEmpties(File $phpcsFile, $start, $end)
|
|
154
|
-
{
|
|
155
|
-
return self::getString($phpcsFile, $start, $end, false, true, true);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Retrieve the content of the tokens from the specified start position in the token
|
|
160
|
-
* stack to the specified end position (inclusive) with all consecutive whitespace tokens - tabs,
|
|
161
|
-
* new lines, multiple spaces - replaced by a single space and optionally without comments.
|
|
162
|
-
*
|
|
163
|
-
* @see \PHP_CodeSniffer\Files\File::getTokensAsString() Loosely related function.
|
|
164
|
-
*
|
|
165
|
-
* @since 1.0.0
|
|
166
|
-
*
|
|
167
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
168
|
-
* @param int $start The position to start from in the token stack.
|
|
169
|
-
* @param int $end The position to end at in the token stack (inclusive).
|
|
170
|
-
* @param bool $stripComments Whether comments should be stripped from the contents.
|
|
171
|
-
* Defaults to `false`.
|
|
172
|
-
*
|
|
173
|
-
* @return string The token contents with compacted whitespace and optionally stripped off comments.
|
|
174
|
-
*
|
|
175
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified start position does not exist.
|
|
176
|
-
*/
|
|
177
|
-
public static function compact(File $phpcsFile, $start, $end, $stripComments = false)
|
|
178
|
-
{
|
|
179
|
-
return self::getString($phpcsFile, $start, $end, false, $stripComments, false, true);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Retrieve the content of the tokens from the specified start position in the token stack
|
|
184
|
-
* to the specified end position (inclusive).
|
|
185
|
-
*
|
|
186
|
-
* @since 1.0.0
|
|
187
|
-
*
|
|
188
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
189
|
-
* @param int $start The position to start from in the token stack.
|
|
190
|
-
* @param int $end The position to end at in the token stack (inclusive).
|
|
191
|
-
* @param bool $origContent Whether the original content or the tab replaced
|
|
192
|
-
* content should be used.
|
|
193
|
-
* Defaults to `false` (= tabs replaced with spaces).
|
|
194
|
-
* @param bool $stripComments Whether comments should be stripped from the contents.
|
|
195
|
-
* Defaults to `false`.
|
|
196
|
-
* @param bool $stripWhitespace Whether whitespace should be stripped from the contents.
|
|
197
|
-
* Defaults to `false`.
|
|
198
|
-
* @param bool $compact Whether all consecutive whitespace tokens should be
|
|
199
|
-
* replaced with a single space. Defaults to `false`.
|
|
200
|
-
*
|
|
201
|
-
* @return string The token contents.
|
|
202
|
-
*
|
|
203
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified start position does not exist.
|
|
204
|
-
*/
|
|
205
|
-
protected static function getString(
|
|
206
|
-
File $phpcsFile,
|
|
207
|
-
$start,
|
|
208
|
-
$end,
|
|
209
|
-
$origContent = false,
|
|
210
|
-
$stripComments = false,
|
|
211
|
-
$stripWhitespace = false,
|
|
212
|
-
$compact = false
|
|
213
|
-
) {
|
|
214
|
-
$tokens = $phpcsFile->getTokens();
|
|
215
|
-
|
|
216
|
-
if (\is_int($start) === false || isset($tokens[$start]) === false) {
|
|
217
|
-
throw new RuntimeException(
|
|
218
|
-
'The $start position for GetTokensAsString methods must exist in the token stack'
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (\is_int($end) === false || $end < $start) {
|
|
223
|
-
return '';
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
$str = '';
|
|
227
|
-
if ($end >= $phpcsFile->numTokens) {
|
|
228
|
-
$end = ($phpcsFile->numTokens - 1);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
$lastAdded = null;
|
|
232
|
-
for ($i = $start; $i <= $end; $i++) {
|
|
233
|
-
if ($stripComments === true && isset(Tokens::$commentTokens[$tokens[$i]['code']])) {
|
|
234
|
-
continue;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
if ($stripWhitespace === true && $tokens[$i]['code'] === \T_WHITESPACE) {
|
|
238
|
-
continue;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
if ($compact === true && $tokens[$i]['code'] === \T_WHITESPACE) {
|
|
242
|
-
if (isset($lastAdded) === false || $tokens[$lastAdded]['code'] !== \T_WHITESPACE) {
|
|
243
|
-
$str .= ' ';
|
|
244
|
-
$lastAdded = $i;
|
|
245
|
-
}
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// If tabs are being converted to spaces by the tokenizer, the
|
|
250
|
-
// original content should be used instead of the converted content.
|
|
251
|
-
if ($origContent === true && isset($tokens[$i]['orig_content']) === true) {
|
|
252
|
-
$str .= $tokens[$i]['orig_content'];
|
|
253
|
-
} else {
|
|
254
|
-
$str .= $tokens[$i]['content'];
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
$lastAdded = $i;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return $str;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
@@ -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\Internal\Cache;
|
|
17
|
-
use PHPCSUtils\Internal\IsShortArrayOrListWithCache;
|
|
18
|
-
use PHPCSUtils\Tokens\Collections;
|
|
19
|
-
use PHPCSUtils\Utils\GetTokensAsString;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Utility functions to retrieve information when working with lists.
|
|
23
|
-
*
|
|
24
|
-
* @since 1.0.0
|
|
25
|
-
*/
|
|
26
|
-
final class Lists
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Default values for individual list items.
|
|
31
|
-
*
|
|
32
|
-
* Used by the `getAssignments()` method.
|
|
33
|
-
*
|
|
34
|
-
* @since 1.0.0
|
|
35
|
-
*
|
|
36
|
-
* @var array<string, mixed>
|
|
37
|
-
*/
|
|
38
|
-
private static $listItemDefaults = [
|
|
39
|
-
'raw' => '',
|
|
40
|
-
'assignment' => '',
|
|
41
|
-
'is_empty' => false,
|
|
42
|
-
'is_nested_list' => false,
|
|
43
|
-
'variable' => false,
|
|
44
|
-
'assignment_token' => false,
|
|
45
|
-
'assignment_end_token' => false,
|
|
46
|
-
'assign_by_reference' => false,
|
|
47
|
-
'reference_token' => false,
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Determine whether a T_OPEN/CLOSE_SHORT_ARRAY token is a short list() construct.
|
|
52
|
-
*
|
|
53
|
-
* This method also accepts `T_OPEN/CLOSE_SQUARE_BRACKET` tokens to allow it to be
|
|
54
|
-
* PHPCS cross-version compatible as the short array tokenizing has been plagued by
|
|
55
|
-
* a number of bugs over time, which affects the short list determination.
|
|
56
|
-
*
|
|
57
|
-
* @since 1.0.0
|
|
58
|
-
*
|
|
59
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
60
|
-
* @param int $stackPtr The position of the short array bracket token.
|
|
61
|
-
*
|
|
62
|
-
* @return bool `TRUE` if the token passed is the open/close bracket of a short list.
|
|
63
|
-
* `FALSE` if the token is a short array bracket or plain square bracket
|
|
64
|
-
* or not one of the accepted tokens.
|
|
65
|
-
*/
|
|
66
|
-
public static function isShortList(File $phpcsFile, $stackPtr)
|
|
67
|
-
{
|
|
68
|
-
return IsShortArrayOrListWithCache::isShortList($phpcsFile, $stackPtr);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Find the list opener and closer based on a T_LIST or T_OPEN_SHORT_ARRAY token.
|
|
73
|
-
*
|
|
74
|
-
* This method also accepts `T_OPEN_SQUARE_BRACKET` tokens to allow it to be
|
|
75
|
-
* PHPCS cross-version compatible as the short array tokenizing has been plagued by
|
|
76
|
-
* a number of bugs over time, which affects the short list determination.
|
|
77
|
-
*
|
|
78
|
-
* @since 1.0.0
|
|
79
|
-
*
|
|
80
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
81
|
-
* @param int $stackPtr The position of the T_LIST or T_OPEN_SHORT_ARRAY
|
|
82
|
-
* token in the stack.
|
|
83
|
-
* @param true|null $isShortList Short-circuit the short list check for T_OPEN_SHORT_ARRAY
|
|
84
|
-
* tokens if it isn't necessary.
|
|
85
|
-
* Efficiency tweak for when this has already been established,
|
|
86
|
-
* i.e. when encountering a nested list while walking the
|
|
87
|
-
* tokens in a list.
|
|
88
|
-
* Use with care.
|
|
89
|
-
*
|
|
90
|
-
* @return array<string, int>|false An array with the token pointers; or `FALSE` if this is not a (short) list
|
|
91
|
-
* token or if the opener/closer could not be determined.
|
|
92
|
-
* The format of the array return value is:
|
|
93
|
-
* ```php
|
|
94
|
-
* array(
|
|
95
|
-
* 'opener' => integer, // Stack pointer to the list open bracket.
|
|
96
|
-
* 'closer' => integer, // Stack pointer to the list close bracket.
|
|
97
|
-
* )
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
public static function getOpenClose(File $phpcsFile, $stackPtr, $isShortList = null)
|
|
101
|
-
{
|
|
102
|
-
$tokens = $phpcsFile->getTokens();
|
|
103
|
-
|
|
104
|
-
// Is this one of the tokens this function handles ?
|
|
105
|
-
if (isset($tokens[$stackPtr]) === false
|
|
106
|
-
|| isset(Collections::listOpenTokensBC()[$tokens[$stackPtr]['code']]) === false
|
|
107
|
-
) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
switch ($tokens[ $stackPtr ]['code']) {
|
|
112
|
-
case \T_LIST:
|
|
113
|
-
if (isset($tokens[$stackPtr]['parenthesis_opener'])) {
|
|
114
|
-
$opener = $tokens[$stackPtr]['parenthesis_opener'];
|
|
115
|
-
|
|
116
|
-
if (isset($tokens[$opener]['parenthesis_closer'])) {
|
|
117
|
-
$closer = $tokens[$opener]['parenthesis_closer'];
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
break;
|
|
121
|
-
|
|
122
|
-
case \T_OPEN_SHORT_ARRAY:
|
|
123
|
-
case \T_OPEN_SQUARE_BRACKET:
|
|
124
|
-
if ($isShortList === true || self::isShortList($phpcsFile, $stackPtr) === true) {
|
|
125
|
-
$opener = $stackPtr;
|
|
126
|
-
$closer = $tokens[$stackPtr]['bracket_closer'];
|
|
127
|
-
}
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (isset($opener, $closer)) {
|
|
132
|
-
return [
|
|
133
|
-
'opener' => $opener,
|
|
134
|
-
'closer' => $closer,
|
|
135
|
-
];
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Retrieves information on the assignments made in the specified (long/short) list.
|
|
143
|
-
*
|
|
144
|
-
* This method also accepts `T_OPEN_SQUARE_BRACKET` tokens to allow it to be
|
|
145
|
-
* PHPCS cross-version compatible as the short array tokenizing has been plagued by
|
|
146
|
-
* a number of bugs over time, which affects the short list determination.
|
|
147
|
-
*
|
|
148
|
-
* The returned array will contain the following basic information for each assignment:
|
|
149
|
-
*
|
|
150
|
-
* ```php
|
|
151
|
-
* 0 => array(
|
|
152
|
-
* 'raw' => string, // The full content of the variable definition,
|
|
153
|
-
* // including whitespace and comments.
|
|
154
|
-
* // This may be an empty string when a list
|
|
155
|
-
* // item is being skipped.
|
|
156
|
-
* 'assignment' => string, // The content of the assignment part,
|
|
157
|
-
* // cleaned of comments.
|
|
158
|
-
* // This may be an empty string for an empty
|
|
159
|
-
* // list item; it could also be a nested list
|
|
160
|
-
* // represented as a string.
|
|
161
|
-
* 'is_empty' => bool, // Whether this is an empty list item, i.e.
|
|
162
|
-
* // the second item in `list($a, , $b)`.
|
|
163
|
-
* 'is_nested_list' => bool, // Whether this is a nested list.
|
|
164
|
-
* 'variable' => string|false, // The base variable being assigned to; or
|
|
165
|
-
* // FALSE in case of a nested list or
|
|
166
|
-
* // a variable variable.
|
|
167
|
-
* // I.e. `$a` in `list($a['key'])`.
|
|
168
|
-
* 'assignment_token' => int|false, // The start pointer for the assignment.
|
|
169
|
-
* // For a nested list, this will be the pointer
|
|
170
|
-
* // to the `list` keyword or the open square
|
|
171
|
-
* // bracket in case of a short list.
|
|
172
|
-
* 'assignment_end_token' => int|false, // The end pointer for the assignment.
|
|
173
|
-
* 'assign_by_reference' => bool, // Is the variable assigned by reference?
|
|
174
|
-
* 'reference_token' => int|false, // The stack pointer to the reference operator;
|
|
175
|
-
* // or FALSE when not a reference assignment.
|
|
176
|
-
* )
|
|
177
|
-
* ```
|
|
178
|
-
*
|
|
179
|
-
* Assignments with keys will have the following additional array indexes set:
|
|
180
|
-
* ```php
|
|
181
|
-
* 'key' => string, // The content of the key, cleaned of comments.
|
|
182
|
-
* 'key_token' => int, // The stack pointer to the start of the key.
|
|
183
|
-
* 'key_end_token' => int, // The stack pointer to the end of the key.
|
|
184
|
-
* 'double_arrow_token' => int, // The stack pointer to the double arrow.
|
|
185
|
-
* ```
|
|
186
|
-
*
|
|
187
|
-
* @since 1.0.0
|
|
188
|
-
*
|
|
189
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
190
|
-
* @param int $stackPtr The position in the stack of the function token
|
|
191
|
-
* to acquire the parameters for.
|
|
192
|
-
*
|
|
193
|
-
* @return array<int, array<string, mixed>>
|
|
194
|
-
* An array with information on each assignment made, including skipped assignments (empty),
|
|
195
|
-
* or an empty array if no assignments are made at all (fatal error in PHP >= 7.0).
|
|
196
|
-
*
|
|
197
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified $stackPtr is not of
|
|
198
|
-
* type T_LIST, T_OPEN_SHORT_ARRAY or
|
|
199
|
-
* T_OPEN_SQUARE_BRACKET.
|
|
200
|
-
*/
|
|
201
|
-
public static function getAssignments(File $phpcsFile, $stackPtr)
|
|
202
|
-
{
|
|
203
|
-
$openClose = self::getOpenClose($phpcsFile, $stackPtr);
|
|
204
|
-
if ($openClose === false) {
|
|
205
|
-
// The `getOpenClose()` method does the $stackPtr validation.
|
|
206
|
-
throw new RuntimeException('The Lists::getAssignments() method expects a long/short list token.');
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (Cache::isCached($phpcsFile, __METHOD__, $stackPtr) === true) {
|
|
210
|
-
return Cache::get($phpcsFile, __METHOD__, $stackPtr);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
$opener = $openClose['opener'];
|
|
214
|
-
$closer = $openClose['closer'];
|
|
215
|
-
|
|
216
|
-
$tokens = $phpcsFile->getTokens();
|
|
217
|
-
|
|
218
|
-
$vars = [];
|
|
219
|
-
$start = null;
|
|
220
|
-
$lastNonEmpty = null;
|
|
221
|
-
$reference = null;
|
|
222
|
-
$list = null;
|
|
223
|
-
$lastComma = $opener;
|
|
224
|
-
$keys = [];
|
|
225
|
-
|
|
226
|
-
for ($i = ($opener + 1); $i <= $closer; $i++) {
|
|
227
|
-
if (isset(Tokens::$emptyTokens[$tokens[$i]['code']])) {
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
switch ($tokens[$i]['code']) {
|
|
232
|
-
case \T_DOUBLE_ARROW:
|
|
233
|
-
$keys['key'] = GetTokensAsString::compact($phpcsFile, $start, $lastNonEmpty, true);
|
|
234
|
-
$keys['key_token'] = $start;
|
|
235
|
-
$keys['key_end_token'] = $lastNonEmpty;
|
|
236
|
-
$keys['double_arrow_token'] = $i;
|
|
237
|
-
|
|
238
|
-
// Partial reset.
|
|
239
|
-
$start = null;
|
|
240
|
-
$lastNonEmpty = null;
|
|
241
|
-
$list = null; // Prevent confusion when short array was used as the key.
|
|
242
|
-
$reference = null;
|
|
243
|
-
break;
|
|
244
|
-
|
|
245
|
-
case \T_COMMA:
|
|
246
|
-
case $tokens[$closer]['code']:
|
|
247
|
-
// Check if this is the end of the list or only a token with the same type as the list closer.
|
|
248
|
-
if ($tokens[$i]['code'] === $tokens[$closer]['code']) {
|
|
249
|
-
if ($i !== $closer) {
|
|
250
|
-
/*
|
|
251
|
-
* Shouldn't be possible anymore now nested brackets are being skipped over,
|
|
252
|
-
* but keep it just in case.
|
|
253
|
-
*/
|
|
254
|
-
// @codeCoverageIgnoreStart
|
|
255
|
-
$lastNonEmpty = $i;
|
|
256
|
-
break;
|
|
257
|
-
// @codeCoverageIgnoreEnd
|
|
258
|
-
} elseif ($start === null && $lastComma === $opener) {
|
|
259
|
-
// This is an empty list.
|
|
260
|
-
break 2;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Ok, so this is actually the end of the list item.
|
|
265
|
-
$current = self::$listItemDefaults;
|
|
266
|
-
$current['raw'] = \trim(GetTokensAsString::normal($phpcsFile, ($lastComma + 1), ($i - 1)));
|
|
267
|
-
|
|
268
|
-
if ($start === null) {
|
|
269
|
-
$current['is_empty'] = true;
|
|
270
|
-
} else {
|
|
271
|
-
$current['assignment'] = \trim(
|
|
272
|
-
GetTokensAsString::compact($phpcsFile, $start, $lastNonEmpty, true)
|
|
273
|
-
);
|
|
274
|
-
$current['is_nested_list'] = isset($list);
|
|
275
|
-
|
|
276
|
-
$current['variable'] = false;
|
|
277
|
-
if (isset($list) === false && $tokens[$start]['code'] === \T_VARIABLE) {
|
|
278
|
-
$current['variable'] = $tokens[$start]['content'];
|
|
279
|
-
}
|
|
280
|
-
$current['assignment_token'] = $start;
|
|
281
|
-
$current['assignment_end_token'] = $lastNonEmpty;
|
|
282
|
-
|
|
283
|
-
if (isset($reference)) {
|
|
284
|
-
$current['assign_by_reference'] = true;
|
|
285
|
-
$current['reference_token'] = $reference;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (empty($keys) === false) {
|
|
290
|
-
$current += $keys;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
$vars[] = $current;
|
|
294
|
-
|
|
295
|
-
// Reset.
|
|
296
|
-
$start = null;
|
|
297
|
-
$lastNonEmpty = null;
|
|
298
|
-
$reference = null;
|
|
299
|
-
$list = null;
|
|
300
|
-
$lastComma = $i;
|
|
301
|
-
$keys = [];
|
|
302
|
-
|
|
303
|
-
break;
|
|
304
|
-
|
|
305
|
-
case \T_LIST:
|
|
306
|
-
case \T_OPEN_SHORT_ARRAY:
|
|
307
|
-
if ($start === null) {
|
|
308
|
-
$start = $i;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/*
|
|
312
|
-
* As the top level list has an open/close, we know we don't have a parse error and
|
|
313
|
-
* any nested (short) arrays/lists will be tokenized correctly, so no need for extra checks here.
|
|
314
|
-
*/
|
|
315
|
-
$nestedOpenClose = self::getOpenClose($phpcsFile, $i, true);
|
|
316
|
-
$list = $i;
|
|
317
|
-
$i = $nestedOpenClose['closer'];
|
|
318
|
-
|
|
319
|
-
$lastNonEmpty = $i;
|
|
320
|
-
break;
|
|
321
|
-
|
|
322
|
-
case \T_BITWISE_AND:
|
|
323
|
-
$reference = $i;
|
|
324
|
-
$lastNonEmpty = $i;
|
|
325
|
-
break;
|
|
326
|
-
|
|
327
|
-
default:
|
|
328
|
-
if ($start === null) {
|
|
329
|
-
$start = $i;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// Skip over everything within all types of brackets which may be used in keys.
|
|
333
|
-
if (isset($tokens[$i]['bracket_opener'], $tokens[$i]['bracket_closer'])
|
|
334
|
-
&& $i === $tokens[$i]['bracket_opener']
|
|
335
|
-
) {
|
|
336
|
-
$i = $tokens[$i]['bracket_closer'];
|
|
337
|
-
} elseif ($tokens[$i]['code'] === \T_OPEN_PARENTHESIS
|
|
338
|
-
&& isset($tokens[$i]['parenthesis_closer'])
|
|
339
|
-
) {
|
|
340
|
-
$i = $tokens[$i]['parenthesis_closer'];
|
|
341
|
-
} elseif (isset($tokens[$i]['scope_condition'], $tokens[$i]['scope_closer'])
|
|
342
|
-
&& $tokens[$i]['scope_condition'] === $i
|
|
343
|
-
) {
|
|
344
|
-
$i = $tokens[$i]['scope_closer'];
|
|
345
|
-
} elseif ($tokens[$i]['code'] === \T_ATTRIBUTE
|
|
346
|
-
&& isset($tokens[$i]['attribute_closer'])
|
|
347
|
-
) {
|
|
348
|
-
$i = $tokens[$i]['attribute_closer'];
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
$lastNonEmpty = $i;
|
|
352
|
-
break;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
Cache::set($phpcsFile, __METHOD__, $stackPtr, $vars);
|
|
357
|
-
return $vars;
|
|
358
|
-
}
|
|
359
|
-
}
|