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
package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/Arrays/MultipleStatementAlignmentSniff.php
DELETED
|
@@ -1,583 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* WordPress Coding Standard.
|
|
4
|
-
*
|
|
5
|
-
* @package WPCS\WordPressCodingStandards
|
|
6
|
-
* @link https://github.com/WordPress/WordPress-Coding-Standards
|
|
7
|
-
* @license https://opensource.org/licenses/MIT MIT
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
namespace WordPressCS\WordPress\Sniffs\Arrays;
|
|
11
|
-
|
|
12
|
-
use PHPCSUtils\Tokens\Collections;
|
|
13
|
-
use PHPCSUtils\Utils\Arrays;
|
|
14
|
-
use PHPCSUtils\Utils\PassedParameters;
|
|
15
|
-
use WordPressCS\WordPress\Sniff;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Enforces alignment of the double arrow assignment operator for multi-item, multi-line arrays.
|
|
19
|
-
*
|
|
20
|
-
* - Align the double arrow operator to the same column for each item in a multi-item array.
|
|
21
|
-
* - Allows for setting a maxColumn property to aid in managing line-length.
|
|
22
|
-
* - Allows for new line(s) before a double arrow (configurable).
|
|
23
|
-
* - Allows for handling multi-line array items differently if so desired (configurable).
|
|
24
|
-
*
|
|
25
|
-
* @link https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#indentation
|
|
26
|
-
*
|
|
27
|
-
* @since 0.14.0
|
|
28
|
-
*
|
|
29
|
-
* {@internal This sniff should eventually be pulled upstream as part of a solution
|
|
30
|
-
* for https://github.com/squizlabs/PHP_CodeSniffer/issues/582 }}
|
|
31
|
-
*/
|
|
32
|
-
final class MultipleStatementAlignmentSniff extends Sniff {
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Whether or not to ignore an array item for the purpose of alignment
|
|
36
|
-
* when a new line is found between the array key and the double arrow.
|
|
37
|
-
*
|
|
38
|
-
* @since 0.14.0
|
|
39
|
-
*
|
|
40
|
-
* @var bool
|
|
41
|
-
*/
|
|
42
|
-
public $ignoreNewlines = true;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Whether the alignment should be exact.
|
|
46
|
-
*
|
|
47
|
-
* Exact in this context means "largest index key + 1 space".
|
|
48
|
-
* When `false`, that is seen as the minimum alignment.
|
|
49
|
-
*
|
|
50
|
-
* @since 0.14.0
|
|
51
|
-
*
|
|
52
|
-
* @var bool
|
|
53
|
-
*/
|
|
54
|
-
public $exact = true;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The maximum column on which the double arrow alignment should be set.
|
|
58
|
-
*
|
|
59
|
-
* This property allows for limiting the whitespace padding to prevent
|
|
60
|
-
* overly long lines.
|
|
61
|
-
*
|
|
62
|
-
* If this value is set to, for instance, 60, it will:
|
|
63
|
-
* - if the expected column < 60, align at the expected column.
|
|
64
|
-
* - if the expected column >= 60, align at column 60.
|
|
65
|
-
* - for the outliers, i.e. the array indexes where the end position
|
|
66
|
-
* goes past column 60, it will not align the arrow, the sniff will
|
|
67
|
-
* just make sure there is only one space between the end of the
|
|
68
|
-
* array index and the double arrow.
|
|
69
|
-
*
|
|
70
|
-
* The column value is regarded as a hard value, i.e. includes indentation,
|
|
71
|
-
* so setting it very low is not a good idea.
|
|
72
|
-
*
|
|
73
|
-
* @since 0.14.0
|
|
74
|
-
*
|
|
75
|
-
* @var int
|
|
76
|
-
*/
|
|
77
|
-
public $maxColumn = 1000;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Whether or not to align the arrow operator for multi-line array items.
|
|
81
|
-
*
|
|
82
|
-
* Whether or not an item is regarded as multi-line is based on the **value**
|
|
83
|
-
* of the item, not the key.
|
|
84
|
-
*
|
|
85
|
-
* Valid values are:
|
|
86
|
-
* - 'always': Default. Align all arrays items regardless of single/multi-line.
|
|
87
|
-
* - 'never': Never align array items which span multiple lines.
|
|
88
|
-
* This will enforce one space between the array index and the
|
|
89
|
-
* double arrow operator for multi-line array items, independently
|
|
90
|
-
* of the alignment of the rest of the array items.
|
|
91
|
-
* Multi-line items where the arrow is already aligned with the
|
|
92
|
-
* "expected" alignment, however, will be left alone.
|
|
93
|
-
* - operator : Only align the operator for multi-line arrays items if the
|
|
94
|
-
* + number percentage of multi-line items passes the comparison.
|
|
95
|
-
* - As it is a percentage, the number has to be between 0 and 100.
|
|
96
|
-
* - Supported operators: <, <=, >, >=, ==, =, !=, <>
|
|
97
|
-
* - The percentage is calculated against all array items
|
|
98
|
-
* (with and without assignment operator).
|
|
99
|
-
* - The (new) expected alignment will be calculated based only
|
|
100
|
-
* on the items being aligned.
|
|
101
|
-
* - Multi-line items where the arrow is already aligned with the
|
|
102
|
-
* (new) "expected" alignment, however, will be left alone.
|
|
103
|
-
* Examples:
|
|
104
|
-
* * Setting this to `!=100` or `<100` means that alignment will
|
|
105
|
-
* be enforced, unless *all* array items are multi-line.
|
|
106
|
-
* This is probably the most commonly desired situation.
|
|
107
|
-
* * Setting this to `=100` means that alignment will only
|
|
108
|
-
* be enforced, if *all* array items are multi-line.
|
|
109
|
-
* * Setting this to `<50` means that the majority of array items
|
|
110
|
-
* need to be single line before alignment is enforced for
|
|
111
|
-
* multi-line items in the array.
|
|
112
|
-
* * Setting this to `=0` is useless as in that case there are
|
|
113
|
-
* no multi-line items in the array anyway.
|
|
114
|
-
*
|
|
115
|
-
* This setting will respect the `ignoreNewlines` and `maxColumnn` settings.
|
|
116
|
-
*
|
|
117
|
-
* @since 0.14.0
|
|
118
|
-
*
|
|
119
|
-
* @var string|int
|
|
120
|
-
*/
|
|
121
|
-
public $alignMultilineItems = 'always';
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Storage for parsed $alignMultilineItems operator part.
|
|
125
|
-
*
|
|
126
|
-
* @since 0.14.0
|
|
127
|
-
*
|
|
128
|
-
* @var string
|
|
129
|
-
*/
|
|
130
|
-
private $operator;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Storage for parsed $alignMultilineItems numeric part.
|
|
134
|
-
*
|
|
135
|
-
* Stored as a string as the comparison will be done string based.
|
|
136
|
-
*
|
|
137
|
-
* @since 0.14.0
|
|
138
|
-
*
|
|
139
|
-
* @var string
|
|
140
|
-
*/
|
|
141
|
-
private $number;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Returns an array of tokens this test wants to listen for.
|
|
145
|
-
*
|
|
146
|
-
* @since 0.14.0
|
|
147
|
-
*
|
|
148
|
-
* @return array
|
|
149
|
-
*/
|
|
150
|
-
public function register() {
|
|
151
|
-
return Collections::arrayOpenTokensBC();
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Processes this test, when one of its tokens is encountered.
|
|
156
|
-
*
|
|
157
|
-
* @since 0.14.0
|
|
158
|
-
*
|
|
159
|
-
* @param int $stackPtr The position of the current token in the stack.
|
|
160
|
-
*
|
|
161
|
-
* @return int|void Integer stack pointer to skip forward or void to continue
|
|
162
|
-
* normal file processing.
|
|
163
|
-
*/
|
|
164
|
-
public function process_token( $stackPtr ) {
|
|
165
|
-
|
|
166
|
-
if ( isset( Collections::shortArrayListOpenTokensBC()[ $this->tokens[ $stackPtr ]['code'] ] )
|
|
167
|
-
&& Arrays::isShortArray( $this->phpcsFile, $stackPtr ) === false
|
|
168
|
-
) {
|
|
169
|
-
// Short list, not short array.
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/*
|
|
174
|
-
* Determine the array opener & closer.
|
|
175
|
-
*/
|
|
176
|
-
$array_open_close = Arrays::getOpenClose( $this->phpcsFile, $stackPtr );
|
|
177
|
-
if ( false === $array_open_close ) {
|
|
178
|
-
// Array open/close could not be determined.
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
$opener = $array_open_close['opener'];
|
|
183
|
-
$closer = $array_open_close['closer'];
|
|
184
|
-
|
|
185
|
-
$array_items = PassedParameters::getParameters( $this->phpcsFile, $stackPtr );
|
|
186
|
-
if ( empty( $array_items ) ) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Pass off to either the single line or multi-line array analysis.
|
|
191
|
-
if ( $this->tokens[ $opener ]['line'] === $this->tokens[ $closer ]['line'] ) {
|
|
192
|
-
return $this->process_single_line_array( $stackPtr, $array_items, $opener, $closer );
|
|
193
|
-
} else {
|
|
194
|
-
return $this->process_multi_line_array( $stackPtr, $array_items, $opener, $closer );
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Process a single-line array.
|
|
200
|
-
*
|
|
201
|
-
* While the WP standard does not allow single line multi-item associative arrays,
|
|
202
|
-
* this sniff should function independently of that.
|
|
203
|
-
*
|
|
204
|
-
* The `WordPress.WhiteSpace.OperatorSpacing` sniff already covers checking that
|
|
205
|
-
* there is a space between the array key and the double arrow, but doesn't
|
|
206
|
-
* enforce it to be exactly one space for single line arrays.
|
|
207
|
-
* That is what this method covers.
|
|
208
|
-
*
|
|
209
|
-
* @since 0.14.0
|
|
210
|
-
*
|
|
211
|
-
* @param int $stackPtr The position of the current token in the stack.
|
|
212
|
-
* @param array $items Info array containing information on each array item.
|
|
213
|
-
* @param int $opener The position of the array opener.
|
|
214
|
-
* @param int $closer The position of the array closer.
|
|
215
|
-
*
|
|
216
|
-
* @return int|void Integer stack pointer to skip forward or void to continue
|
|
217
|
-
* normal file processing.
|
|
218
|
-
*/
|
|
219
|
-
protected function process_single_line_array( $stackPtr, $items, $opener, $closer ) {
|
|
220
|
-
/*
|
|
221
|
-
* For single line arrays, we don't care about what level the arrow is from.
|
|
222
|
-
* Just find and fix them all.
|
|
223
|
-
*/
|
|
224
|
-
$next_arrow = $this->phpcsFile->findNext(
|
|
225
|
-
\T_DOUBLE_ARROW,
|
|
226
|
-
( $opener + 1 ),
|
|
227
|
-
$closer
|
|
228
|
-
);
|
|
229
|
-
|
|
230
|
-
while ( false !== $next_arrow ) {
|
|
231
|
-
if ( \T_WHITESPACE === $this->tokens[ ( $next_arrow - 1 ) ]['code'] ) {
|
|
232
|
-
$space_length = $this->tokens[ ( $next_arrow - 1 ) ]['length'];
|
|
233
|
-
if ( 1 !== $space_length ) {
|
|
234
|
-
$error = 'Expected 1 space between "%s" and double arrow; %s found';
|
|
235
|
-
$data = array(
|
|
236
|
-
$this->tokens[ ( $next_arrow - 2 ) ]['content'],
|
|
237
|
-
$space_length,
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
$fix = $this->phpcsFile->addFixableWarning( $error, $next_arrow, 'SpaceBeforeDoubleArrow', $data );
|
|
241
|
-
if ( true === $fix ) {
|
|
242
|
-
$this->phpcsFile->fixer->replaceToken( ( $next_arrow - 1 ), ' ' );
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// Find the position of the next double arrow.
|
|
248
|
-
$next_arrow = $this->phpcsFile->findNext(
|
|
249
|
-
\T_DOUBLE_ARROW,
|
|
250
|
-
( $next_arrow + 1 ),
|
|
251
|
-
$closer
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// Ignore any child-arrays as the double arrows in these will already have been handled.
|
|
256
|
-
return ( $closer + 1 );
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Process a multi-line array.
|
|
261
|
-
*
|
|
262
|
-
* @since 0.14.0
|
|
263
|
-
*
|
|
264
|
-
* @param int $stackPtr The position of the current token in the stack.
|
|
265
|
-
* @param array $items Info array containing information on each array item.
|
|
266
|
-
* @param int $opener The position of the array opener.
|
|
267
|
-
* @param int $closer The position of the array closer.
|
|
268
|
-
*
|
|
269
|
-
* @return void
|
|
270
|
-
*/
|
|
271
|
-
protected function process_multi_line_array( $stackPtr, $items, $opener, $closer ) {
|
|
272
|
-
|
|
273
|
-
$this->maxColumn = (int) $this->maxColumn;
|
|
274
|
-
$this->validate_align_multiline_items();
|
|
275
|
-
|
|
276
|
-
/*
|
|
277
|
-
* Determine what the spacing before the arrow should be.
|
|
278
|
-
*
|
|
279
|
-
* Will unset any array items without double arrow and with new line whitespace
|
|
280
|
-
* if newlines are to be ignored, so the second foreach loop only has to deal
|
|
281
|
-
* with items which need attention.
|
|
282
|
-
*
|
|
283
|
-
* This sniff does not take incorrect indentation of array keys into account.
|
|
284
|
-
* That's for the `WordPress.Arrays.ArrayIndentation` sniff to fix.
|
|
285
|
-
* If that would affect the alignment, a second (or third) loop of the fixer
|
|
286
|
-
* will correct it (again) after the indentation has been fixed.
|
|
287
|
-
*/
|
|
288
|
-
$index_end_cols = array(); // Keep track of the end column position of index keys.
|
|
289
|
-
$double_arrow_cols = array(); // Keep track of arrow column position and count.
|
|
290
|
-
$multi_line_count = 0;
|
|
291
|
-
$total_items = \count( $items );
|
|
292
|
-
|
|
293
|
-
foreach ( $items as $key => $item ) {
|
|
294
|
-
// Find the double arrow if there is one.
|
|
295
|
-
$double_arrow = Arrays::getDoubleArrowPtr( $this->phpcsFile, $item['start'], $item['end'] );
|
|
296
|
-
if ( false === $double_arrow ) {
|
|
297
|
-
unset( $items[ $key ] );
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// Find the end of the array key.
|
|
302
|
-
$last_index_token = $this->phpcsFile->findPrevious(
|
|
303
|
-
\T_WHITESPACE,
|
|
304
|
-
( $double_arrow - 1 ),
|
|
305
|
-
$item['start'],
|
|
306
|
-
true
|
|
307
|
-
);
|
|
308
|
-
|
|
309
|
-
if ( true === $this->ignoreNewlines
|
|
310
|
-
&& $this->tokens[ $last_index_token ]['line'] !== $this->tokens[ $double_arrow ]['line']
|
|
311
|
-
) {
|
|
312
|
-
// Ignore this item as it has a new line between the item key and the double arrow.
|
|
313
|
-
unset( $items[ $key ] );
|
|
314
|
-
continue;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
$index_end_position = ( $this->tokens[ $last_index_token ]['column'] + ( $this->tokens[ $last_index_token ]['length'] - 1 ) );
|
|
318
|
-
$items[ $key ]['operatorPtr'] = $double_arrow;
|
|
319
|
-
$items[ $key ]['last_index_token'] = $last_index_token;
|
|
320
|
-
$items[ $key ]['last_index_col'] = $index_end_position;
|
|
321
|
-
|
|
322
|
-
if ( $this->tokens[ $last_index_token ]['line'] === $this->tokens[ $item['end'] ]['line'] ) {
|
|
323
|
-
$items[ $key ]['single_line'] = true;
|
|
324
|
-
} else {
|
|
325
|
-
$items[ $key ]['single_line'] = false;
|
|
326
|
-
++$multi_line_count;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
if ( ( $index_end_position + 2 ) <= $this->maxColumn ) {
|
|
330
|
-
$index_end_cols[] = $index_end_position;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
if ( ! isset( $double_arrow_cols[ $this->tokens[ $double_arrow ]['column'] ] ) ) {
|
|
334
|
-
$double_arrow_cols[ $this->tokens[ $double_arrow ]['column'] ] = 1;
|
|
335
|
-
} else {
|
|
336
|
-
++$double_arrow_cols[ $this->tokens[ $double_arrow ]['column'] ];
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
unset( $key, $item, $double_arrow, $last_index_token );
|
|
340
|
-
|
|
341
|
-
if ( empty( $items ) || empty( $index_end_cols ) ) {
|
|
342
|
-
// No actionable array items found.
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/*
|
|
347
|
-
* Determine whether the operators for multi-line items should be aligned.
|
|
348
|
-
*/
|
|
349
|
-
if ( 'always' === $this->alignMultilineItems ) {
|
|
350
|
-
$alignMultilineItems = true;
|
|
351
|
-
} elseif ( 'never' === $this->alignMultilineItems ) {
|
|
352
|
-
$alignMultilineItems = false;
|
|
353
|
-
} else {
|
|
354
|
-
$percentage = (string) round( ( $multi_line_count / $total_items ) * 100, 0 );
|
|
355
|
-
|
|
356
|
-
// Bit hacky, but this is the only comparison function in PHP which allows to
|
|
357
|
-
// pass the comparison operator. And hey, it works ;-).
|
|
358
|
-
$alignMultilineItems = version_compare( $percentage, $this->number, $this->operator );
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/*
|
|
362
|
-
* If necessary, rebuild the $index_end_cols and $double_arrow_cols arrays
|
|
363
|
-
* excluding multi-line items.
|
|
364
|
-
*/
|
|
365
|
-
if ( false === $alignMultilineItems ) {
|
|
366
|
-
$select_index_end_cols = array();
|
|
367
|
-
$double_arrow_cols = array();
|
|
368
|
-
|
|
369
|
-
foreach ( $items as $item ) {
|
|
370
|
-
if ( false === $item['single_line'] ) {
|
|
371
|
-
continue;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
if ( ( $item['last_index_col'] + 2 ) <= $this->maxColumn ) {
|
|
375
|
-
$select_index_end_cols[] = $item['last_index_col'];
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
if ( ! isset( $double_arrow_cols[ $this->tokens[ $item['operatorPtr'] ]['column'] ] ) ) {
|
|
379
|
-
$double_arrow_cols[ $this->tokens[ $item['operatorPtr'] ]['column'] ] = 1;
|
|
380
|
-
} else {
|
|
381
|
-
++$double_arrow_cols[ $this->tokens[ $item['operatorPtr'] ]['column'] ];
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
/*
|
|
387
|
-
* Determine the expected position of the double arrows.
|
|
388
|
-
*/
|
|
389
|
-
if ( ! empty( $select_index_end_cols ) ) {
|
|
390
|
-
$max_index_width = max( $select_index_end_cols );
|
|
391
|
-
} else {
|
|
392
|
-
$max_index_width = max( $index_end_cols );
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
$expected_col = ( $max_index_width + 2 );
|
|
396
|
-
|
|
397
|
-
if ( false === $this->exact && ! empty( $double_arrow_cols ) ) {
|
|
398
|
-
/*
|
|
399
|
-
* If the alignment does not have to be exact, see if a majority
|
|
400
|
-
* group of the arrows is already at an acceptable position.
|
|
401
|
-
*/
|
|
402
|
-
arsort( $double_arrow_cols, \SORT_NUMERIC );
|
|
403
|
-
reset( $double_arrow_cols );
|
|
404
|
-
$count = current( $double_arrow_cols );
|
|
405
|
-
|
|
406
|
-
if ( $count > 1 || ( 1 === $count && \count( $items ) === 1 ) ) {
|
|
407
|
-
// Allow for several groups of arrows having the same $count.
|
|
408
|
-
$filtered_double_arrow_cols = array_keys( $double_arrow_cols, $count, true );
|
|
409
|
-
|
|
410
|
-
foreach ( $filtered_double_arrow_cols as $col ) {
|
|
411
|
-
if ( $col > $expected_col && $col <= $this->maxColumn ) {
|
|
412
|
-
$expected_col = $col;
|
|
413
|
-
break;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
unset( $max_index_width, $count, $filtered_double_arrow_cols, $col );
|
|
419
|
-
|
|
420
|
-
/*
|
|
421
|
-
* Verify and correct the spacing around the double arrows.
|
|
422
|
-
*/
|
|
423
|
-
foreach ( $items as $item ) {
|
|
424
|
-
if ( $this->tokens[ $item['operatorPtr'] ]['column'] === $expected_col
|
|
425
|
-
&& $this->tokens[ $item['operatorPtr'] ]['line'] === $this->tokens[ $item['last_index_token'] ]['line']
|
|
426
|
-
) {
|
|
427
|
-
// Already correctly aligned.
|
|
428
|
-
continue;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
if ( \T_WHITESPACE !== $this->tokens[ ( $item['operatorPtr'] - 1 ) ]['code'] ) {
|
|
432
|
-
$before = 0;
|
|
433
|
-
} elseif ( $this->tokens[ $item['last_index_token'] ]['line'] !== $this->tokens[ $item['operatorPtr'] ]['line'] ) {
|
|
434
|
-
$before = 'newline';
|
|
435
|
-
} else {
|
|
436
|
-
$before = $this->tokens[ ( $item['operatorPtr'] - 1 ) ]['length'];
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/*
|
|
440
|
-
* Deal with index sizes larger than maxColumn and with multi-line
|
|
441
|
-
* array items which should not be aligned.
|
|
442
|
-
*/
|
|
443
|
-
if ( ( $item['last_index_col'] + 2 ) > $this->maxColumn
|
|
444
|
-
|| ( false === $alignMultilineItems && false === $item['single_line'] )
|
|
445
|
-
) {
|
|
446
|
-
|
|
447
|
-
if ( ( $item['last_index_col'] + 2 ) === $this->tokens[ $item['operatorPtr'] ]['column']
|
|
448
|
-
&& $this->tokens[ $item['operatorPtr'] ]['line'] === $this->tokens[ $item['last_index_token'] ]['line']
|
|
449
|
-
) {
|
|
450
|
-
// MaxColumn/Multi-line item exception, already correctly aligned.
|
|
451
|
-
continue;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
$prefix = 'LongIndex';
|
|
455
|
-
if ( false === $alignMultilineItems && false === $item['single_line'] ) {
|
|
456
|
-
$prefix = 'MultilineItem';
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
$error_code = $prefix . 'SpaceBeforeDoubleArrow';
|
|
460
|
-
if ( 0 === $before ) {
|
|
461
|
-
$error_code = $prefix . 'NoSpaceBeforeDoubleArrow';
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
$fix = $this->phpcsFile->addFixableWarning(
|
|
465
|
-
'Expected 1 space between "%s" and double arrow; %s found.',
|
|
466
|
-
$item['operatorPtr'],
|
|
467
|
-
$error_code,
|
|
468
|
-
array(
|
|
469
|
-
$this->tokens[ $item['last_index_token'] ]['content'],
|
|
470
|
-
$before,
|
|
471
|
-
)
|
|
472
|
-
);
|
|
473
|
-
|
|
474
|
-
if ( true === $fix ) {
|
|
475
|
-
$this->phpcsFile->fixer->beginChangeset();
|
|
476
|
-
|
|
477
|
-
// Remove whitespace tokens between the end of the index and the arrow, if any.
|
|
478
|
-
for ( $i = ( $item['last_index_token'] + 1 ); $i < $item['operatorPtr']; $i++ ) {
|
|
479
|
-
$this->phpcsFile->fixer->replaceToken( $i, '' );
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
// Add the correct whitespace.
|
|
483
|
-
$this->phpcsFile->fixer->addContent( $item['last_index_token'], ' ' );
|
|
484
|
-
|
|
485
|
-
$this->phpcsFile->fixer->endChangeset();
|
|
486
|
-
}
|
|
487
|
-
continue;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/*
|
|
491
|
-
* Deal with the space before double arrows in all other cases.
|
|
492
|
-
*/
|
|
493
|
-
$expected_whitespace = $expected_col - ( $this->tokens[ $item['last_index_token'] ]['column'] + $this->tokens[ $item['last_index_token'] ]['length'] );
|
|
494
|
-
|
|
495
|
-
$fix = $this->phpcsFile->addFixableWarning(
|
|
496
|
-
'Array double arrow not aligned correctly; expected %s space(s) between "%s" and double arrow, but found %s.',
|
|
497
|
-
$item['operatorPtr'],
|
|
498
|
-
'DoubleArrowNotAligned',
|
|
499
|
-
array(
|
|
500
|
-
$expected_whitespace,
|
|
501
|
-
$this->tokens[ $item['last_index_token'] ]['content'],
|
|
502
|
-
$before,
|
|
503
|
-
)
|
|
504
|
-
);
|
|
505
|
-
|
|
506
|
-
if ( true === $fix ) {
|
|
507
|
-
if ( 0 === $before || 'newline' === $before ) {
|
|
508
|
-
$this->phpcsFile->fixer->beginChangeset();
|
|
509
|
-
|
|
510
|
-
// Remove whitespace tokens between the end of the index and the arrow, if any.
|
|
511
|
-
for ( $i = ( $item['last_index_token'] + 1 ); $i < $item['operatorPtr']; $i++ ) {
|
|
512
|
-
$this->phpcsFile->fixer->replaceToken( $i, '' );
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
// Add the correct whitespace.
|
|
516
|
-
$this->phpcsFile->fixer->addContent(
|
|
517
|
-
$item['last_index_token'],
|
|
518
|
-
str_repeat( ' ', $expected_whitespace )
|
|
519
|
-
);
|
|
520
|
-
|
|
521
|
-
$this->phpcsFile->fixer->endChangeset();
|
|
522
|
-
} elseif ( $expected_whitespace > $before ) {
|
|
523
|
-
// Add to the existing whitespace to prevent replacing tabs with spaces.
|
|
524
|
-
// That's the concern of another sniff.
|
|
525
|
-
$this->phpcsFile->fixer->addContent(
|
|
526
|
-
( $item['operatorPtr'] - 1 ),
|
|
527
|
-
str_repeat( ' ', ( $expected_whitespace - $before ) )
|
|
528
|
-
);
|
|
529
|
-
} else {
|
|
530
|
-
// Too much whitespace found.
|
|
531
|
-
$this->phpcsFile->fixer->replaceToken(
|
|
532
|
-
( $item['operatorPtr'] - 1 ),
|
|
533
|
-
str_repeat( ' ', $expected_whitespace )
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* Validate that a valid value has been received for the alignMultilineItems property.
|
|
542
|
-
*
|
|
543
|
-
* This message may be thrown more than once if the property is being changed inline in a file.
|
|
544
|
-
*
|
|
545
|
-
* @since 0.14.0
|
|
546
|
-
*
|
|
547
|
-
* @return void
|
|
548
|
-
*/
|
|
549
|
-
protected function validate_align_multiline_items() {
|
|
550
|
-
$alignMultilineItems = $this->alignMultilineItems;
|
|
551
|
-
|
|
552
|
-
if ( 'always' === $alignMultilineItems || 'never' === $alignMultilineItems ) {
|
|
553
|
-
return;
|
|
554
|
-
} else {
|
|
555
|
-
// Correct for a potentially added % sign.
|
|
556
|
-
$alignMultilineItems = rtrim( $alignMultilineItems, '%' );
|
|
557
|
-
|
|
558
|
-
if ( preg_match( '`^([=<>!]{1,2})(100|[0-9]{1,2})$`', $alignMultilineItems, $matches ) > 0 ) {
|
|
559
|
-
$operator = $matches[1];
|
|
560
|
-
$number = (int) $matches[2];
|
|
561
|
-
|
|
562
|
-
if ( \in_array( $operator, array( '<', '<=', '>', '>=', '==', '=', '!=', '<>' ), true ) === true
|
|
563
|
-
&& ( $number >= 0 && $number <= 100 )
|
|
564
|
-
) {
|
|
565
|
-
$this->alignMultilineItems = $alignMultilineItems;
|
|
566
|
-
$this->number = (string) $number;
|
|
567
|
-
$this->operator = $operator;
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
$this->phpcsFile->addError(
|
|
574
|
-
'Invalid property value passed: "%s". The value for the "alignMultilineItems" property for the "WordPress.Arrays.MultipleStatementAlignment" sniff should be either "always", "never" or an comparison operator + a number between 0 and 100.',
|
|
575
|
-
0,
|
|
576
|
-
'InvalidPropertyPassed',
|
|
577
|
-
array( $this->alignMultilineItems )
|
|
578
|
-
);
|
|
579
|
-
|
|
580
|
-
// Reset to the default if an invalid value was received.
|
|
581
|
-
$this->alignMultilineItems = 'always';
|
|
582
|
-
}
|
|
583
|
-
}
|