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,246 +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\Fixers;
|
|
12
|
-
|
|
13
|
-
use PHP_CodeSniffer\Exceptions\RuntimeException;
|
|
14
|
-
use PHP_CodeSniffer\Files\File;
|
|
15
|
-
use PHP_CodeSniffer\Util\Tokens;
|
|
16
|
-
use PHPCSUtils\Utils\Numbers;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Utility to check and, if necessary, fix the whitespace between two tokens.
|
|
20
|
-
*
|
|
21
|
-
* @since 1.0.0
|
|
22
|
-
*/
|
|
23
|
-
final class SpacesFixer
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Check the whitespace between two tokens, throw an error if it doesn't match the
|
|
28
|
-
* expected whitespace and if relevant, fix it.
|
|
29
|
-
*
|
|
30
|
-
* Note:
|
|
31
|
-
* - This method will not auto-fix if there is anything but whitespace between the two
|
|
32
|
-
* tokens. In that case, it will throw a non-fixable error/warning.
|
|
33
|
-
* - If `'newline'` is expected and _no_ new line is encountered, a new line will be added,
|
|
34
|
-
* but no assumptions will be made about the intended indentation of the code.
|
|
35
|
-
* This should be handled by a (separate) indentation sniff.
|
|
36
|
-
* - If `'newline'` is expected and multiple new lines are encountered, this will be accepted
|
|
37
|
-
* as valid.
|
|
38
|
-
* No assumptions are made about whether additional blank lines are allowed or not.
|
|
39
|
-
* If _exactly_ one line is desired, combine this fixer with the {@see \PHPCSUtils\Fixers\BlankLineFixer}
|
|
40
|
-
* (upcoming).
|
|
41
|
-
* - The fixer will not leave behind any trailing spaces on the original line when fixing
|
|
42
|
-
* to `'newline'`, but it will not correct _existing_ trailing spaces when there already
|
|
43
|
-
* is a new line in place.
|
|
44
|
-
* - This method can optionally record a metric for this check which will be displayed
|
|
45
|
-
* when the end-user requests the "info" report.
|
|
46
|
-
*
|
|
47
|
-
* @since 1.0.0
|
|
48
|
-
*
|
|
49
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
50
|
-
* @param int $stackPtr The position of the token which should be used
|
|
51
|
-
* when reporting an issue.
|
|
52
|
-
* @param int $secondPtr The stack pointer to the second token.
|
|
53
|
-
* This token can be before or after the `$stackPtr`,
|
|
54
|
-
* but should only be separated from the `$stackPtr`
|
|
55
|
-
* by whitespace and/or comments/annotations.
|
|
56
|
-
* @param string|int $expectedSpaces Number of spaces to enforce.
|
|
57
|
-
* Valid values:
|
|
58
|
-
* - (int) Number of spaces. Must be `0` or more.
|
|
59
|
-
* - (string) `'newline'`.
|
|
60
|
-
* @param string $errorTemplate Error message template.
|
|
61
|
-
* Note: _The placeholder replacement phrase will be
|
|
62
|
-
* in human readable English and include "spaces"/
|
|
63
|
-
* "new line", so no need to include that in the template._
|
|
64
|
-
* This string should contain two placeholders:
|
|
65
|
-
* - `%1$s` = expected spaces phrase.
|
|
66
|
-
* - `%2$s` = found spaces phrase.
|
|
67
|
-
* @param string $errorCode A violation code unique to the sniff message.
|
|
68
|
-
* Defaults to `"Found"`.
|
|
69
|
-
* It is strongly recommended to change this if
|
|
70
|
-
* this fixer is used for different errors in the
|
|
71
|
-
* same sniff.
|
|
72
|
-
* @param string $errorType Optional. Whether to report the issue as a
|
|
73
|
-
* `"warning"` or an `"error"`. Defaults to `"error"`.
|
|
74
|
-
* @param int $errorSeverity Optional. The severity level for this message.
|
|
75
|
-
* A value of `0` will be converted into the default
|
|
76
|
-
* severity level.
|
|
77
|
-
* @param string $metricName Optional. The name of the metric to record.
|
|
78
|
-
* This can be a short description phrase.
|
|
79
|
-
* Leave empty to not record metrics.
|
|
80
|
-
*
|
|
81
|
-
* @return void
|
|
82
|
-
*
|
|
83
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the tokens passed do not exist or are whitespace
|
|
84
|
-
* tokens.
|
|
85
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If `$expectedSpaces` is not a valid value.
|
|
86
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the tokens passed are separated by more than just
|
|
87
|
-
* empty (whitespace + comments/annotations) tokens.
|
|
88
|
-
*/
|
|
89
|
-
public static function checkAndFix(
|
|
90
|
-
File $phpcsFile,
|
|
91
|
-
$stackPtr,
|
|
92
|
-
$secondPtr,
|
|
93
|
-
$expectedSpaces,
|
|
94
|
-
$errorTemplate,
|
|
95
|
-
$errorCode = 'Found',
|
|
96
|
-
$errorType = 'error',
|
|
97
|
-
$errorSeverity = 0,
|
|
98
|
-
$metricName = ''
|
|
99
|
-
) {
|
|
100
|
-
$tokens = $phpcsFile->getTokens();
|
|
101
|
-
|
|
102
|
-
/*
|
|
103
|
-
* Validate the received function input.
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
if (isset($tokens[$stackPtr], $tokens[$secondPtr]) === false
|
|
107
|
-
|| $tokens[$stackPtr]['code'] === \T_WHITESPACE
|
|
108
|
-
|| $tokens[$secondPtr]['code'] === \T_WHITESPACE
|
|
109
|
-
) {
|
|
110
|
-
throw new RuntimeException('The $stackPtr and the $secondPtr token must exist and not be whitespace');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
$expected = false;
|
|
114
|
-
if ($expectedSpaces === 'newline') {
|
|
115
|
-
$expected = $expectedSpaces;
|
|
116
|
-
} elseif (\is_int($expectedSpaces) === true && $expectedSpaces >= 0) {
|
|
117
|
-
$expected = $expectedSpaces;
|
|
118
|
-
} elseif (\is_string($expectedSpaces) === true && Numbers::isDecimalInt($expectedSpaces) === true) {
|
|
119
|
-
$expected = (int) $expectedSpaces;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if ($expected === false) {
|
|
123
|
-
throw new RuntimeException(
|
|
124
|
-
'The $expectedSpaces setting should be either "newline", 0 or a positive integer'
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
$ptrA = $stackPtr;
|
|
129
|
-
$ptrB = $secondPtr;
|
|
130
|
-
if ($stackPtr > $secondPtr) {
|
|
131
|
-
$ptrA = $secondPtr;
|
|
132
|
-
$ptrB = $stackPtr;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($ptrA + 1), null, true);
|
|
136
|
-
if ($nextNonEmpty !== false && $nextNonEmpty < $ptrB) {
|
|
137
|
-
throw new RuntimeException(
|
|
138
|
-
'The $stackPtr and the $secondPtr token must be adjacent tokens separated only'
|
|
139
|
-
. ' by whitespace and/or comments'
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/*
|
|
144
|
-
* Determine how many spaces are between the two tokens.
|
|
145
|
-
*/
|
|
146
|
-
|
|
147
|
-
$found = 0;
|
|
148
|
-
$foundPhrase = 'no spaces';
|
|
149
|
-
if ($tokens[$ptrA]['line'] !== $tokens[$ptrB]['line']) {
|
|
150
|
-
$found = 'newline';
|
|
151
|
-
$foundPhrase = 'a new line';
|
|
152
|
-
if (($tokens[$ptrA]['line'] + 1) !== $tokens[$ptrB]['line']) {
|
|
153
|
-
$foundPhrase = 'multiple new lines';
|
|
154
|
-
}
|
|
155
|
-
} elseif (($ptrA + 1) !== $ptrB) {
|
|
156
|
-
if ($tokens[($ptrA + 1)]['code'] === \T_WHITESPACE) {
|
|
157
|
-
$found = $tokens[($ptrA + 1)]['length'];
|
|
158
|
-
$foundPhrase = $found . (($found === 1) ? ' space' : ' spaces');
|
|
159
|
-
} else {
|
|
160
|
-
$found = 'non-whitespace tokens';
|
|
161
|
-
$foundPhrase = 'non-whitespace tokens';
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if ($metricName !== '') {
|
|
166
|
-
$phpcsFile->recordMetric($stackPtr, $metricName, $foundPhrase);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if ($found === $expected) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/*
|
|
174
|
-
* Handle the violation message.
|
|
175
|
-
*/
|
|
176
|
-
|
|
177
|
-
$expectedPhrase = 'no space';
|
|
178
|
-
if ($expected === 'newline') {
|
|
179
|
-
$expectedPhrase = 'a new line';
|
|
180
|
-
} elseif ($expected === 1) {
|
|
181
|
-
$expectedPhrase = $expected . ' space';
|
|
182
|
-
} elseif ($expected > 1) {
|
|
183
|
-
$expectedPhrase = $expected . ' spaces';
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
$fixable = true;
|
|
187
|
-
$nextNonWhitespace = $phpcsFile->findNext(\T_WHITESPACE, ($ptrA + 1), null, true);
|
|
188
|
-
if ($nextNonWhitespace !== $ptrB) {
|
|
189
|
-
// Comment found between the tokens and we don't know where it should go, so don't auto-fix.
|
|
190
|
-
$fixable = false;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if ($found === 'newline'
|
|
194
|
-
&& $tokens[$ptrA]['code'] === \T_COMMENT
|
|
195
|
-
&& \substr($tokens[$ptrA]['content'], -2) !== '*/'
|
|
196
|
-
) {
|
|
197
|
-
/*
|
|
198
|
-
* $ptrA is a slash-style trailing comment, removing the new line would comment out
|
|
199
|
-
* the code, so don't auto-fix.
|
|
200
|
-
*/
|
|
201
|
-
$fixable = false;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
$method = 'add';
|
|
205
|
-
$method .= ($fixable === true) ? 'Fixable' : '';
|
|
206
|
-
$method .= ($errorType === 'error') ? 'Error' : 'Warning';
|
|
207
|
-
|
|
208
|
-
$recorded = $phpcsFile->$method(
|
|
209
|
-
$errorTemplate,
|
|
210
|
-
$stackPtr,
|
|
211
|
-
$errorCode,
|
|
212
|
-
[$expectedPhrase, $foundPhrase],
|
|
213
|
-
$errorSeverity
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
if ($fixable === false || $recorded === false) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/*
|
|
221
|
-
* Fix the violation.
|
|
222
|
-
*/
|
|
223
|
-
|
|
224
|
-
$phpcsFile->fixer->beginChangeset();
|
|
225
|
-
|
|
226
|
-
/*
|
|
227
|
-
* Remove existing whitespace. No need to check if it's whitespace as otherwise the fixer
|
|
228
|
-
* wouldn't have kicked in.
|
|
229
|
-
*/
|
|
230
|
-
for ($i = ($ptrA + 1); $i < $ptrB; $i++) {
|
|
231
|
-
$phpcsFile->fixer->replaceToken($i, '');
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// If necessary: add the correct amount whitespace.
|
|
235
|
-
if ($expected !== 0) {
|
|
236
|
-
if ($expected === 'newline') {
|
|
237
|
-
$phpcsFile->fixer->addContent($ptrA, $phpcsFile->eolChar);
|
|
238
|
-
} else {
|
|
239
|
-
$replacement = $tokens[$ptrA]['content'] . \str_repeat(' ', $expected);
|
|
240
|
-
$phpcsFile->fixer->replaceToken($ptrA, $replacement);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
$phpcsFile->fixer->endChangeset();
|
|
245
|
-
}
|
|
246
|
-
}
|
|
@@ -1,218 +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\Internal;
|
|
12
|
-
|
|
13
|
-
use PHP_CodeSniffer\Files\File;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Results cache.
|
|
17
|
-
*
|
|
18
|
-
* Allows to cache the return value of utility functions which do a lot of token walking.
|
|
19
|
-
* Those type of utilities can significantly slow down file scanning, especially
|
|
20
|
-
* with large files and when multiple sniffs use the same utility function.
|
|
21
|
-
*
|
|
22
|
-
* Caching the results can significantly speed things up, though it can also eat memory,
|
|
23
|
-
* so use with care.
|
|
24
|
-
*
|
|
25
|
-
* Typical usage:
|
|
26
|
-
* ```php
|
|
27
|
-
* function doSomething()
|
|
28
|
-
* {
|
|
29
|
-
* if (Cache::isCached($phpcsFile, __METHOD__, $stackPtr) === true) {
|
|
30
|
-
* return Cache::get($phpcsFile, __METHOD__, $stackPtr);
|
|
31
|
-
* }
|
|
32
|
-
*
|
|
33
|
-
* // Do something.
|
|
34
|
-
*
|
|
35
|
-
* Cache::set($phpcsFile, __METHOD__, $stackPtr, $returnValue);
|
|
36
|
-
* return $returnValue;
|
|
37
|
-
* }
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* ---------------------------------------------------------------------------------------------
|
|
41
|
-
* This class is only intended for internal use by PHPCSUtils and is not part of the public API.
|
|
42
|
-
* This also means that it has no promise of backward compatibility.
|
|
43
|
-
* ---------------------------------------------------------------------------------------------
|
|
44
|
-
*
|
|
45
|
-
* @internal
|
|
46
|
-
*
|
|
47
|
-
* @since 1.0.0
|
|
48
|
-
*/
|
|
49
|
-
final class Cache
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Whether caching is enabled or not.
|
|
54
|
-
*
|
|
55
|
-
* Note: this switch is ONLY intended for use within test suites and should never
|
|
56
|
-
* be touched in any other circumstances!
|
|
57
|
-
*
|
|
58
|
-
* Don't forget to always turn the cache back on in a `tear_down()` method!
|
|
59
|
-
*
|
|
60
|
-
* @since 1.0.0
|
|
61
|
-
*
|
|
62
|
-
* @var bool
|
|
63
|
-
*/
|
|
64
|
-
public static $enabled = true;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Results cache.
|
|
68
|
-
*
|
|
69
|
-
* @since 1.0.0
|
|
70
|
-
*
|
|
71
|
-
* @var array<int, array<string, array<string, array<string|int, mixed>>>>
|
|
72
|
-
* Format: $cache[$loop][$fileName][$key][$id] = mixed $value;
|
|
73
|
-
*/
|
|
74
|
-
private static $cache = [];
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Check whether a result has been cached for a certain utility function.
|
|
78
|
-
*
|
|
79
|
-
* @since 1.0.0
|
|
80
|
-
*
|
|
81
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
82
|
-
* @param string $key The key to identify a particular set of results.
|
|
83
|
-
* It is recommended to pass __METHOD__ to this parameter.
|
|
84
|
-
* @param int|string $id Unique identifier for these results.
|
|
85
|
-
* Generally speaking this will be the $stackPtr passed
|
|
86
|
-
* to the utility function, but it can also something else,
|
|
87
|
-
* like a serialization of args passed to a function or an
|
|
88
|
-
* md5 hash of an input.
|
|
89
|
-
*
|
|
90
|
-
* @return bool
|
|
91
|
-
*/
|
|
92
|
-
public static function isCached(File $phpcsFile, $key, $id)
|
|
93
|
-
{
|
|
94
|
-
if (self::$enabled === false) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
$fileName = $phpcsFile->getFilename();
|
|
99
|
-
$loop = $phpcsFile->fixer->enabled === true ? $phpcsFile->fixer->loops : 0;
|
|
100
|
-
|
|
101
|
-
return isset(self::$cache[$loop][$fileName][$key])
|
|
102
|
-
&& \array_key_exists($id, self::$cache[$loop][$fileName][$key]);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Retrieve a previously cached result for a certain utility function.
|
|
107
|
-
*
|
|
108
|
-
* @since 1.0.0
|
|
109
|
-
*
|
|
110
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
111
|
-
* @param string $key The key to identify a particular set of results.
|
|
112
|
-
* It is recommended to pass __METHOD__ to this parameter.
|
|
113
|
-
* @param int|string $id Unique identifier for these results.
|
|
114
|
-
* Generally speaking this will be the $stackPtr passed
|
|
115
|
-
* to the utility function, but it can also something else,
|
|
116
|
-
* like a serialization of args passed to a function or an
|
|
117
|
-
* md5 hash of an input.
|
|
118
|
-
*
|
|
119
|
-
* @return mixed
|
|
120
|
-
*/
|
|
121
|
-
public static function get(File $phpcsFile, $key, $id)
|
|
122
|
-
{
|
|
123
|
-
if (self::$enabled === false) {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
$fileName = $phpcsFile->getFilename();
|
|
128
|
-
$loop = $phpcsFile->fixer->enabled === true ? $phpcsFile->fixer->loops : 0;
|
|
129
|
-
|
|
130
|
-
if (isset(self::$cache[$loop][$fileName][$key])
|
|
131
|
-
&& \array_key_exists($id, self::$cache[$loop][$fileName][$key])
|
|
132
|
-
) {
|
|
133
|
-
return self::$cache[$loop][$fileName][$key][$id];
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Retrieve all previously cached results for a certain utility function and a certain file.
|
|
141
|
-
*
|
|
142
|
-
* @since 1.0.0
|
|
143
|
-
*
|
|
144
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
145
|
-
* @param string $key The key to identify a particular set of results.
|
|
146
|
-
* It is recommended to pass __METHOD__ to this parameter.
|
|
147
|
-
*
|
|
148
|
-
* @return array<string|int, mixed>
|
|
149
|
-
*/
|
|
150
|
-
public static function getForFile(File $phpcsFile, $key)
|
|
151
|
-
{
|
|
152
|
-
if (self::$enabled === false) {
|
|
153
|
-
return [];
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
$fileName = $phpcsFile->getFilename();
|
|
157
|
-
$loop = $phpcsFile->fixer->enabled === true ? $phpcsFile->fixer->loops : 0;
|
|
158
|
-
|
|
159
|
-
if (isset(self::$cache[$loop][$fileName])
|
|
160
|
-
&& \array_key_exists($key, self::$cache[$loop][$fileName])
|
|
161
|
-
) {
|
|
162
|
-
return self::$cache[$loop][$fileName][$key];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return [];
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Cache the result for a certain utility function.
|
|
170
|
-
*
|
|
171
|
-
* @since 1.0.0
|
|
172
|
-
*
|
|
173
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
174
|
-
* @param string $key The key to identify a particular set of results.
|
|
175
|
-
* It is recommended to pass __METHOD__ to this parameter.
|
|
176
|
-
* @param int|string $id Unique identifier for these results.
|
|
177
|
-
* Generally speaking this will be the $stackPtr passed
|
|
178
|
-
* to the utility function, but it can also something else,
|
|
179
|
-
* like a serialization of args passed to a function or an
|
|
180
|
-
* md5 hash of an input.
|
|
181
|
-
* @param mixed $value An arbitrary value to write to the cache.
|
|
182
|
-
*
|
|
183
|
-
* @return mixed
|
|
184
|
-
*/
|
|
185
|
-
public static function set(File $phpcsFile, $key, $id, $value)
|
|
186
|
-
{
|
|
187
|
-
if (self::$enabled === false) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
$fileName = $phpcsFile->getFilename();
|
|
192
|
-
$loop = $phpcsFile->fixer->enabled === true ? $phpcsFile->fixer->loops : 0;
|
|
193
|
-
|
|
194
|
-
/*
|
|
195
|
-
* If this is a phpcbf run and we've reached the next loop, clear the cache
|
|
196
|
-
* of all previous loops to free up memory.
|
|
197
|
-
*/
|
|
198
|
-
if (isset(self::$cache[$loop]) === false
|
|
199
|
-
&& empty(self::$cache) === false
|
|
200
|
-
) {
|
|
201
|
-
self::clear();
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
self::$cache[$loop][$fileName][$key][$id] = $value;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Clear the cache.
|
|
209
|
-
*
|
|
210
|
-
* @since 1.0.0
|
|
211
|
-
*
|
|
212
|
-
* @return void
|
|
213
|
-
*/
|
|
214
|
-
public static function clear()
|
|
215
|
-
{
|
|
216
|
-
self::$cache = [];
|
|
217
|
-
}
|
|
218
|
-
}
|