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,432 +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\Utils\Conditions;
|
|
18
|
-
use PHPCSUtils\Utils\Parentheses;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Utility functions for examining use statements.
|
|
22
|
-
*
|
|
23
|
-
* @since 1.0.0
|
|
24
|
-
*/
|
|
25
|
-
final class UseStatements
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Determine what a T_USE token is used for.
|
|
30
|
-
*
|
|
31
|
-
* @since 1.0.0
|
|
32
|
-
*
|
|
33
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
34
|
-
* @param int $stackPtr The position of the `T_USE` token.
|
|
35
|
-
*
|
|
36
|
-
* @return string Either `'closure'`, `'import'` or `'trait'`.
|
|
37
|
-
* An empty string will be returned if the token is used in an
|
|
38
|
-
* invalid context or if it couldn't be reliably determined what
|
|
39
|
-
* the `T_USE` token is used for. An empty string being returned will
|
|
40
|
-
* normally mean the code being examined contains a parse error.
|
|
41
|
-
*
|
|
42
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
|
|
43
|
-
* `T_USE` token.
|
|
44
|
-
*/
|
|
45
|
-
public static function getType(File $phpcsFile, $stackPtr)
|
|
46
|
-
{
|
|
47
|
-
$tokens = $phpcsFile->getTokens();
|
|
48
|
-
|
|
49
|
-
if (isset($tokens[$stackPtr]) === false
|
|
50
|
-
|| $tokens[$stackPtr]['code'] !== \T_USE
|
|
51
|
-
) {
|
|
52
|
-
throw new RuntimeException('$stackPtr must be of type T_USE');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
|
56
|
-
if ($next === false) {
|
|
57
|
-
// Live coding or parse error.
|
|
58
|
-
return '';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// More efficient & simpler check for closure use in PHPCS 4.x.
|
|
62
|
-
if (isset($tokens[$stackPtr]['parenthesis_owner'])
|
|
63
|
-
&& $tokens[$stackPtr]['parenthesis_owner'] === $stackPtr
|
|
64
|
-
) {
|
|
65
|
-
return 'closure';
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
|
69
|
-
if ($prev !== false && $tokens[$prev]['code'] === \T_CLOSE_PARENTHESIS
|
|
70
|
-
&& Parentheses::isOwnerIn($phpcsFile, $prev, \T_CLOSURE) === true
|
|
71
|
-
) {
|
|
72
|
-
return 'closure';
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
$lastCondition = Conditions::getLastCondition($phpcsFile, $stackPtr);
|
|
76
|
-
if ($lastCondition === false || $tokens[$lastCondition]['code'] === \T_NAMESPACE) {
|
|
77
|
-
// Global or scoped namespace and not a closure use statement.
|
|
78
|
-
return 'import';
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
$traitScopes = Tokens::$ooScopeTokens;
|
|
82
|
-
// Only classes, traits and enums can import traits.
|
|
83
|
-
unset($traitScopes[\T_INTERFACE]);
|
|
84
|
-
|
|
85
|
-
if (isset($traitScopes[$tokens[$lastCondition]['code']]) === true) {
|
|
86
|
-
return 'trait';
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return '';
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Determine whether a T_USE token represents a closure use statement.
|
|
94
|
-
*
|
|
95
|
-
* @since 1.0.0
|
|
96
|
-
*
|
|
97
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
98
|
-
* @param int $stackPtr The position of the `T_USE` token.
|
|
99
|
-
*
|
|
100
|
-
* @return bool `TRUE` if the token passed is a closure use statement.
|
|
101
|
-
* `FALSE` if it's not.
|
|
102
|
-
*
|
|
103
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
|
|
104
|
-
* `T_USE` token.
|
|
105
|
-
*/
|
|
106
|
-
public static function isClosureUse(File $phpcsFile, $stackPtr)
|
|
107
|
-
{
|
|
108
|
-
return (self::getType($phpcsFile, $stackPtr) === 'closure');
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Determine whether a T_USE token represents a class/function/constant import use statement.
|
|
113
|
-
*
|
|
114
|
-
* @since 1.0.0
|
|
115
|
-
*
|
|
116
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
117
|
-
* @param int $stackPtr The position of the `T_USE` token.
|
|
118
|
-
*
|
|
119
|
-
* @return bool `TRUE` if the token passed is an import use statement.
|
|
120
|
-
* `FALSE` if it's not.
|
|
121
|
-
*
|
|
122
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
|
|
123
|
-
* `T_USE` token.
|
|
124
|
-
*/
|
|
125
|
-
public static function isImportUse(File $phpcsFile, $stackPtr)
|
|
126
|
-
{
|
|
127
|
-
return (self::getType($phpcsFile, $stackPtr) === 'import');
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Determine whether a T_USE token represents a trait use statement.
|
|
132
|
-
*
|
|
133
|
-
* @since 1.0.0
|
|
134
|
-
*
|
|
135
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
136
|
-
* @param int $stackPtr The position of the `T_USE` token.
|
|
137
|
-
*
|
|
138
|
-
* @return bool `TRUE` if the token passed is a trait use statement.
|
|
139
|
-
* `FALSE` if it's not.
|
|
140
|
-
*
|
|
141
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
|
|
142
|
-
* `T_USE` token.
|
|
143
|
-
*/
|
|
144
|
-
public static function isTraitUse(File $phpcsFile, $stackPtr)
|
|
145
|
-
{
|
|
146
|
-
return (self::getType($phpcsFile, $stackPtr) === 'trait');
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Split an import use statement into individual imports.
|
|
151
|
-
*
|
|
152
|
-
* Handles single import, multi-import and group-import use statements.
|
|
153
|
-
*
|
|
154
|
-
* @since 1.0.0
|
|
155
|
-
*
|
|
156
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
|
|
157
|
-
* @param int $stackPtr The position in the stack of the `T_USE` token.
|
|
158
|
-
*
|
|
159
|
-
* @return array<string, array<string, string>>
|
|
160
|
-
* A multi-level array containing information about the use statement.
|
|
161
|
-
* The first level is `'name'`, `'function'` and `'const'`. These keys will always exist.
|
|
162
|
-
* If any statements are found for any of these categories, the second level
|
|
163
|
-
* will contain the alias/name as the key and the full original use name as the
|
|
164
|
-
* value for each of the found imports or an empty array if no imports were found
|
|
165
|
-
* in this use statement for a particular category.
|
|
166
|
-
*
|
|
167
|
-
* For example, for this function group use statement:
|
|
168
|
-
* ```php
|
|
169
|
-
* use function Vendor\Package\{
|
|
170
|
-
* LevelA\Name as Alias,
|
|
171
|
-
* LevelB\Another_Name,
|
|
172
|
-
* };
|
|
173
|
-
* ```
|
|
174
|
-
* the return value would look like this:
|
|
175
|
-
* ```php
|
|
176
|
-
* array(
|
|
177
|
-
* 'name' => array(),
|
|
178
|
-
* 'function' => array(
|
|
179
|
-
* 'Alias' => 'Vendor\Package\LevelA\Name',
|
|
180
|
-
* 'Another_Name' => 'Vendor\Package\LevelB\Another_Name',
|
|
181
|
-
* ),
|
|
182
|
-
* 'const' => array(),
|
|
183
|
-
* )
|
|
184
|
-
* ```
|
|
185
|
-
*
|
|
186
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
|
|
187
|
-
* `T_USE` token.
|
|
188
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the `T_USE` token is not for an import
|
|
189
|
-
* use statement.
|
|
190
|
-
*/
|
|
191
|
-
public static function splitImportUseStatement(File $phpcsFile, $stackPtr)
|
|
192
|
-
{
|
|
193
|
-
$tokens = $phpcsFile->getTokens();
|
|
194
|
-
|
|
195
|
-
if (self::isImportUse($phpcsFile, $stackPtr) === false) {
|
|
196
|
-
throw new RuntimeException('$stackPtr must be an import use statement');
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (Cache::isCached($phpcsFile, __METHOD__, $stackPtr) === true) {
|
|
200
|
-
return Cache::get($phpcsFile, __METHOD__, $stackPtr);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
$statements = [
|
|
204
|
-
'name' => [],
|
|
205
|
-
'function' => [],
|
|
206
|
-
'const' => [],
|
|
207
|
-
];
|
|
208
|
-
|
|
209
|
-
$endOfStatement = $phpcsFile->findNext([\T_SEMICOLON, \T_CLOSE_TAG], ($stackPtr + 1));
|
|
210
|
-
if ($endOfStatement === false) {
|
|
211
|
-
// Live coding or parse error.
|
|
212
|
-
Cache::set($phpcsFile, __METHOD__, $stackPtr, $statements);
|
|
213
|
-
return $statements;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
++$endOfStatement;
|
|
217
|
-
|
|
218
|
-
$start = true;
|
|
219
|
-
$useGroup = false;
|
|
220
|
-
$hasAlias = false;
|
|
221
|
-
$baseName = '';
|
|
222
|
-
$name = '';
|
|
223
|
-
$type = '';
|
|
224
|
-
$fixedType = false;
|
|
225
|
-
$alias = '';
|
|
226
|
-
|
|
227
|
-
for ($i = ($stackPtr + 1); $i < $endOfStatement; $i++) {
|
|
228
|
-
if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === true) {
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
$tokenCode = $tokens[$i]['code'];
|
|
233
|
-
switch ($tokenCode) {
|
|
234
|
-
case \T_STRING:
|
|
235
|
-
// Only when either at the start of the statement or at the start of a new sub within a group.
|
|
236
|
-
if ($start === true && $fixedType === false) {
|
|
237
|
-
$content = \strtolower($tokens[$i]['content']);
|
|
238
|
-
if ($content === 'function'
|
|
239
|
-
|| $content === 'const'
|
|
240
|
-
) {
|
|
241
|
-
$type = $content;
|
|
242
|
-
$start = false;
|
|
243
|
-
if ($useGroup === false) {
|
|
244
|
-
$fixedType = true;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
break;
|
|
248
|
-
} else {
|
|
249
|
-
$type = 'name';
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
$start = false;
|
|
254
|
-
|
|
255
|
-
if ($hasAlias === false) {
|
|
256
|
-
$name .= $tokens[$i]['content'];
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
$alias = $tokens[$i]['content'];
|
|
260
|
-
break;
|
|
261
|
-
|
|
262
|
-
case \T_NAME_QUALIFIED:
|
|
263
|
-
case \T_NAME_FULLY_QUALIFIED: // This would be a parse error, but handle it anyway.
|
|
264
|
-
/*
|
|
265
|
-
* PHPCS 4.x.
|
|
266
|
-
*
|
|
267
|
-
* These tokens can only be encountered when either at the start of the statement
|
|
268
|
-
* or at the start of a new sub within a group.
|
|
269
|
-
*/
|
|
270
|
-
if ($start === true && $fixedType === false) {
|
|
271
|
-
$type = 'name';
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
$start = false;
|
|
275
|
-
|
|
276
|
-
if ($hasAlias === false) {
|
|
277
|
-
$name .= $tokens[$i]['content'];
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
$alias = \substr($tokens[$i]['content'], (\strrpos($tokens[$i]['content'], '\\') + 1));
|
|
281
|
-
break;
|
|
282
|
-
|
|
283
|
-
case \T_AS:
|
|
284
|
-
$hasAlias = true;
|
|
285
|
-
break;
|
|
286
|
-
|
|
287
|
-
case \T_OPEN_USE_GROUP:
|
|
288
|
-
$start = true;
|
|
289
|
-
$useGroup = true;
|
|
290
|
-
$baseName = $name;
|
|
291
|
-
$name = '';
|
|
292
|
-
break;
|
|
293
|
-
|
|
294
|
-
case \T_SEMICOLON:
|
|
295
|
-
case \T_CLOSE_TAG:
|
|
296
|
-
case \T_CLOSE_USE_GROUP:
|
|
297
|
-
case \T_COMMA:
|
|
298
|
-
if ($name !== '') {
|
|
299
|
-
if ($useGroup === true) {
|
|
300
|
-
$statements[$type][$alias] = \ltrim($baseName, '\\') . $name;
|
|
301
|
-
} else {
|
|
302
|
-
$statements[$type][$alias] = \ltrim($name, '\\');
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
if ($tokenCode !== \T_COMMA) {
|
|
307
|
-
break 2;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// Reset.
|
|
311
|
-
$start = true;
|
|
312
|
-
$name = '';
|
|
313
|
-
$hasAlias = false;
|
|
314
|
-
if ($fixedType === false) {
|
|
315
|
-
$type = '';
|
|
316
|
-
}
|
|
317
|
-
break;
|
|
318
|
-
|
|
319
|
-
case \T_NS_SEPARATOR:
|
|
320
|
-
$name .= $tokens[$i]['content'];
|
|
321
|
-
break;
|
|
322
|
-
|
|
323
|
-
/*
|
|
324
|
-
* Fall back in case reserved keyword is (illegally) used in name.
|
|
325
|
-
* Parse error, but not our concern.
|
|
326
|
-
*/
|
|
327
|
-
default:
|
|
328
|
-
if ($hasAlias === false) {
|
|
329
|
-
// Defensive coding, just in case. Should no longer be possible since PHPCS 3.7.0.
|
|
330
|
-
$name .= $tokens[$i]['content']; // @codeCoverageIgnore
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
$alias = $tokens[$i]['content'];
|
|
334
|
-
break;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
Cache::set($phpcsFile, __METHOD__, $stackPtr, $statements);
|
|
339
|
-
return $statements;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Split an import use statement into individual imports and merge it with an array of previously
|
|
344
|
-
* seen import use statements.
|
|
345
|
-
*
|
|
346
|
-
* Beware: this method should only be used to combine the import use statements found in *one* file.
|
|
347
|
-
* Do NOT combine the statements of multiple files as the result will be inaccurate and unreliable.
|
|
348
|
-
*
|
|
349
|
-
* In most cases when tempted to use this method, the {@see \PHPCSUtils\AbstractSniffs\AbstractFileContextSniff}
|
|
350
|
-
* (upcoming) should be used instead.
|
|
351
|
-
*
|
|
352
|
-
* @see \PHPCSUtils\AbstractSniffs\AbstractFileContextSniff
|
|
353
|
-
* @see \PHPCSUtils\Utils\UseStatements::splitImportUseStatement()
|
|
354
|
-
* @see \PHPCSUtils\Utils\UseStatements::mergeImportUseStatements()
|
|
355
|
-
*
|
|
356
|
-
* @since 1.0.0
|
|
357
|
-
*
|
|
358
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
|
|
359
|
-
* @param int $stackPtr The position in the stack of the
|
|
360
|
-
* `T_USE` token.
|
|
361
|
-
* @param array<string, array<string, string>> $previousUseStatements The import `use` statements collected so far.
|
|
362
|
-
* This should be either the output of a
|
|
363
|
-
* previous call to this method or the output of
|
|
364
|
-
* an earlier call to the
|
|
365
|
-
* {@see UseStatements::splitImportUseStatement()}
|
|
366
|
-
* method.
|
|
367
|
-
*
|
|
368
|
-
* @return array<string, array<string, string>>
|
|
369
|
-
* A multi-level array containing information about the current `use` statement combined with
|
|
370
|
-
* the previously collected `use` statement information.
|
|
371
|
-
* See {@see UseStatements::splitImportUseStatement()} for more details about the array format.
|
|
372
|
-
*/
|
|
373
|
-
public static function splitAndMergeImportUseStatement(File $phpcsFile, $stackPtr, array $previousUseStatements)
|
|
374
|
-
{
|
|
375
|
-
try {
|
|
376
|
-
$useStatements = self::splitImportUseStatement($phpcsFile, $stackPtr);
|
|
377
|
-
$previousUseStatements = self::mergeImportUseStatements($previousUseStatements, $useStatements);
|
|
378
|
-
} catch (RuntimeException $e) {
|
|
379
|
-
// Not an import use statement.
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
return $previousUseStatements;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Merge two import use statement arrays.
|
|
387
|
-
*
|
|
388
|
-
* Beware: this method should only be used to combine the import use statements found in *one* file.
|
|
389
|
-
* Do NOT combine the statements of multiple files as the result will be inaccurate and unreliable.
|
|
390
|
-
*
|
|
391
|
-
* @see \PHPCSUtils\Utils\UseStatements::splitImportUseStatement()
|
|
392
|
-
*
|
|
393
|
-
* @since 1.0.0
|
|
394
|
-
*
|
|
395
|
-
* @param array<string, array<string, string>> $previousUseStatements The import `use` statements collected so far.
|
|
396
|
-
* This should be either the output of a
|
|
397
|
-
* previous call to this method or the output of
|
|
398
|
-
* an earlier call to the
|
|
399
|
-
* {@see UseStatements::splitImportUseStatement()}
|
|
400
|
-
* method.
|
|
401
|
-
* @param array<string, array<string, string>> $currentUseStatement The parsed import `use` statements to merge with
|
|
402
|
-
* the previously collected use statements.
|
|
403
|
-
* This should be the output of a call to the
|
|
404
|
-
* {@see UseStatements::splitImportUseStatement()}
|
|
405
|
-
* method.
|
|
406
|
-
*
|
|
407
|
-
* @return array<string, array<string, string>>
|
|
408
|
-
* A multi-level array containing information about the current `use` statement combined with
|
|
409
|
-
* the previously collected `use` statement information.
|
|
410
|
-
* See {@see UseStatements::splitImportUseStatement()} for more details about the array format.
|
|
411
|
-
*/
|
|
412
|
-
public static function mergeImportUseStatements(array $previousUseStatements, array $currentUseStatement)
|
|
413
|
-
{
|
|
414
|
-
if (isset($previousUseStatements['name']) === false) {
|
|
415
|
-
$previousUseStatements['name'] = $currentUseStatement['name'];
|
|
416
|
-
} else {
|
|
417
|
-
$previousUseStatements['name'] += $currentUseStatement['name'];
|
|
418
|
-
}
|
|
419
|
-
if (isset($previousUseStatements['function']) === false) {
|
|
420
|
-
$previousUseStatements['function'] = $currentUseStatement['function'];
|
|
421
|
-
} else {
|
|
422
|
-
$previousUseStatements['function'] += $currentUseStatement['function'];
|
|
423
|
-
}
|
|
424
|
-
if (isset($previousUseStatements['const']) === false) {
|
|
425
|
-
$previousUseStatements['const'] = $currentUseStatement['const'];
|
|
426
|
-
} else {
|
|
427
|
-
$previousUseStatements['const'] += $currentUseStatement['const'];
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
return $previousUseStatements;
|
|
431
|
-
}
|
|
432
|
-
}
|