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,135 +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\Helpers;
|
|
11
|
-
|
|
12
|
-
use PHP_CodeSniffer\Files\File;
|
|
13
|
-
use PHP_CodeSniffer\Util\Tokens;
|
|
14
|
-
use PHPCSUtils\Tokens\Collections;
|
|
15
|
-
use PHPCSUtils\Utils\Scopes;
|
|
16
|
-
use WordPressCS\WordPress\Helpers\ContextHelper;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Helper utilities for checking the context in which a token is used.
|
|
20
|
-
*
|
|
21
|
-
* ---------------------------------------------------------------------------------------------
|
|
22
|
-
* This class is only intended for internal use by WordPressCS and is not part of the public API.
|
|
23
|
-
* This also means that it has no promise of backward compatibility. Use at your own risk.
|
|
24
|
-
* ---------------------------------------------------------------------------------------------
|
|
25
|
-
*
|
|
26
|
-
* {@internal The functionality in this class will likely be replaced at some point in
|
|
27
|
-
* the future by functions from PHPCSUtils.}
|
|
28
|
-
*
|
|
29
|
-
* @internal
|
|
30
|
-
*
|
|
31
|
-
* @since 3.0.0 The method in this class was previously contained in the
|
|
32
|
-
* `WordPressCS\WordPress\Sniff` class and has been moved here.
|
|
33
|
-
*/
|
|
34
|
-
final class ConstantsHelper {
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Determine whether an arbitrary T_STRING token is the use of a global constant.
|
|
38
|
-
*
|
|
39
|
-
* @since 1.0.0
|
|
40
|
-
* @since 3.0.0 - Moved from the Sniff class to this class.
|
|
41
|
-
* - The method was changed to be `static`.
|
|
42
|
-
* - The `$phpcsFile` parameter was added.
|
|
43
|
-
*
|
|
44
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
45
|
-
* @param int $stackPtr The position of the function call token.
|
|
46
|
-
*
|
|
47
|
-
* @return bool
|
|
48
|
-
*/
|
|
49
|
-
public static function is_use_of_global_constant( File $phpcsFile, $stackPtr ) {
|
|
50
|
-
$tokens = $phpcsFile->getTokens();
|
|
51
|
-
|
|
52
|
-
// Check for the existence of the token.
|
|
53
|
-
if ( ! isset( $tokens[ $stackPtr ] ) ) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Is this one of the tokens this function handles ?
|
|
58
|
-
if ( \T_STRING !== $tokens[ $stackPtr ]['code'] ) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
$next = $phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
|
|
63
|
-
if ( false !== $next
|
|
64
|
-
&& ( \T_OPEN_PARENTHESIS === $tokens[ $next ]['code']
|
|
65
|
-
|| \T_DOUBLE_COLON === $tokens[ $next ]['code'] )
|
|
66
|
-
) {
|
|
67
|
-
// Function call or declaration.
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Array of tokens which if found preceding the $stackPtr indicate that a T_STRING is not a global constant.
|
|
72
|
-
$tokens_to_ignore = array(
|
|
73
|
-
\T_NAMESPACE => true,
|
|
74
|
-
\T_USE => true,
|
|
75
|
-
\T_EXTENDS => true,
|
|
76
|
-
\T_IMPLEMENTS => true,
|
|
77
|
-
\T_NEW => true,
|
|
78
|
-
\T_FUNCTION => true,
|
|
79
|
-
\T_INSTANCEOF => true,
|
|
80
|
-
\T_INSTEADOF => true,
|
|
81
|
-
\T_GOTO => true,
|
|
82
|
-
);
|
|
83
|
-
$tokens_to_ignore += Tokens::$ooScopeTokens;
|
|
84
|
-
$tokens_to_ignore += Collections::objectOperators();
|
|
85
|
-
$tokens_to_ignore += Tokens::$scopeModifiers;
|
|
86
|
-
|
|
87
|
-
$prev = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true );
|
|
88
|
-
if ( isset( $tokens_to_ignore[ $tokens[ $prev ]['code'] ] ) ) {
|
|
89
|
-
// Not the use of a constant.
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if ( ContextHelper::is_token_namespaced( $phpcsFile, $stackPtr ) === true ) {
|
|
94
|
-
// Namespaced constant of the same name.
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if ( \T_CONST === $tokens[ $prev ]['code']
|
|
99
|
-
&& Scopes::isOOConstant( $phpcsFile, $prev )
|
|
100
|
-
) {
|
|
101
|
-
// Class constant declaration of the same name.
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/*
|
|
106
|
-
* Deal with a number of variations of use statements.
|
|
107
|
-
*/
|
|
108
|
-
for ( $i = $stackPtr; $i > 0; $i-- ) {
|
|
109
|
-
if ( $tokens[ $i ]['line'] !== $tokens[ $stackPtr ]['line'] ) {
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
$firstOnLine = $phpcsFile->findNext( Tokens::$emptyTokens, ( $i + 1 ), null, true );
|
|
115
|
-
if ( false !== $firstOnLine && \T_USE === $tokens[ $firstOnLine ]['code'] ) {
|
|
116
|
-
$nextOnLine = $phpcsFile->findNext( Tokens::$emptyTokens, ( $firstOnLine + 1 ), null, true );
|
|
117
|
-
if ( false !== $nextOnLine ) {
|
|
118
|
-
if ( \T_STRING === $tokens[ $nextOnLine ]['code']
|
|
119
|
-
&& 'const' === $tokens[ $nextOnLine ]['content']
|
|
120
|
-
) {
|
|
121
|
-
$hasNsSep = $phpcsFile->findNext( \T_NS_SEPARATOR, ( $nextOnLine + 1 ), $stackPtr );
|
|
122
|
-
if ( false !== $hasNsSep ) {
|
|
123
|
-
// Namespaced const (group) use statement.
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
} else {
|
|
127
|
-
// Not a const use statement.
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return true;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
@@ -1,394 +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\Helpers;
|
|
11
|
-
|
|
12
|
-
use PHP_CodeSniffer\Files\File;
|
|
13
|
-
use PHP_CodeSniffer\Util\Tokens;
|
|
14
|
-
use PHPCSUtils\Tokens\Collections;
|
|
15
|
-
use PHPCSUtils\Utils\Parentheses;
|
|
16
|
-
use PHPCSUtils\Utils\PassedParameters;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Helper utilities for checking the context in which a token is used.
|
|
20
|
-
*
|
|
21
|
-
* ---------------------------------------------------------------------------------------------
|
|
22
|
-
* This class is only intended for internal use by WordPressCS and is not part of the public API.
|
|
23
|
-
* This also means that it has no promise of backward compatibility. Use at your own risk.
|
|
24
|
-
* ---------------------------------------------------------------------------------------------
|
|
25
|
-
*
|
|
26
|
-
* @internal
|
|
27
|
-
*
|
|
28
|
-
* @since 3.0.0 The methods in this class were previously contained in the
|
|
29
|
-
* `WordPressCS\WordPress\Sniff` class and have been moved here.
|
|
30
|
-
*/
|
|
31
|
-
final class ContextHelper {
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Tokens which when they preceed code indicate the value is safely casted.
|
|
35
|
-
*
|
|
36
|
-
* @since 1.1.0
|
|
37
|
-
* @since 3.0.0 - Moved from the Sniff class to this class.
|
|
38
|
-
* - The property visibility was changed from `protected` to `private static`.
|
|
39
|
-
*
|
|
40
|
-
* @var array<int|string, true> Key is token constant, value irrelevant.
|
|
41
|
-
*/
|
|
42
|
-
private static $safe_casts = array(
|
|
43
|
-
\T_INT_CAST => true,
|
|
44
|
-
\T_DOUBLE_CAST => true,
|
|
45
|
-
\T_BOOL_CAST => true,
|
|
46
|
-
\T_UNSET_CAST => true,
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* List of PHP native functions to test the type of a variable.
|
|
51
|
-
*
|
|
52
|
-
* Using these functions is safe in combination with superglobals without
|
|
53
|
-
* unslashing or sanitization.
|
|
54
|
-
*
|
|
55
|
-
* They should, however, not be regarded as unslashing or sanitization functions.
|
|
56
|
-
*
|
|
57
|
-
* @since 2.1.0
|
|
58
|
-
* @since 3.0.0 - Moved from the Sniff class to this class.
|
|
59
|
-
* - The property visibility was changed from `protected` to `private static`.
|
|
60
|
-
*
|
|
61
|
-
* @var array<string, true> Key is function name, value irrelevant.
|
|
62
|
-
*/
|
|
63
|
-
private static $typeTestFunctions = array(
|
|
64
|
-
'is_array' => true,
|
|
65
|
-
'is_bool' => true,
|
|
66
|
-
'is_callable' => true,
|
|
67
|
-
'is_countable' => true,
|
|
68
|
-
'is_double' => true,
|
|
69
|
-
'is_float' => true,
|
|
70
|
-
'is_int' => true,
|
|
71
|
-
'is_integer' => true,
|
|
72
|
-
'is_iterable' => true,
|
|
73
|
-
'is_long' => true,
|
|
74
|
-
'is_null' => true,
|
|
75
|
-
'is_numeric' => true,
|
|
76
|
-
'is_object' => true,
|
|
77
|
-
'is_real' => true,
|
|
78
|
-
'is_resource' => true,
|
|
79
|
-
'is_scalar' => true,
|
|
80
|
-
'is_string' => true,
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* List of PHP native functions to check if an array index exists.
|
|
85
|
-
*
|
|
86
|
-
* @since 3.0.0
|
|
87
|
-
*
|
|
88
|
-
* @var array<string, true> Key is function name, value irrelevant.
|
|
89
|
-
*/
|
|
90
|
-
private static $key_exists_functions = array(
|
|
91
|
-
'array_key_exists' => true,
|
|
92
|
-
'key_exists' => true, // Alias.
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Array functions to compare a $needle to a predefined set of values.
|
|
97
|
-
*
|
|
98
|
-
* If the value is set to an array, the parameter specified in the array is
|
|
99
|
-
* required for the function call to be considered as a comparison.
|
|
100
|
-
*
|
|
101
|
-
* @since 2.1.0
|
|
102
|
-
* @since 3.0.0 - Moved from the Sniff class to this class.
|
|
103
|
-
* - The property visibility was changed from `protected` to `private static`.
|
|
104
|
-
*
|
|
105
|
-
* @var array<string, bool|array>
|
|
106
|
-
*/
|
|
107
|
-
private static $arrayCompareFunctions = array(
|
|
108
|
-
'in_array' => true,
|
|
109
|
-
'array_search' => true,
|
|
110
|
-
'array_keys' => array(
|
|
111
|
-
'position' => 2,
|
|
112
|
-
'name' => 'filter_value',
|
|
113
|
-
),
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Check if a particular token acts - statically or non-statically - on an object.
|
|
118
|
-
*
|
|
119
|
-
* {@internal Note: this may still mistake a namespaced function imported via a `use` statement for
|
|
120
|
-
* a global function!}
|
|
121
|
-
*
|
|
122
|
-
* @since 2.1.0
|
|
123
|
-
* @since 3.0.0 - Moved from the Sniff class to this class.
|
|
124
|
-
* - The method was renamed from `is_class_object_call() to `has_object_operator_before()`.
|
|
125
|
-
* - The method visibility was changed from `protected` to `public static`.
|
|
126
|
-
* - The `$phpcsFile` parameter was added.
|
|
127
|
-
*
|
|
128
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
129
|
-
* @param int $stackPtr The index of the token in the stack.
|
|
130
|
-
*
|
|
131
|
-
* @return bool
|
|
132
|
-
*/
|
|
133
|
-
public static function has_object_operator_before( File $phpcsFile, $stackPtr ) {
|
|
134
|
-
$tokens = $phpcsFile->getTokens();
|
|
135
|
-
if ( isset( $tokens[ $stackPtr ] ) === false ) {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
$before = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true );
|
|
140
|
-
|
|
141
|
-
return isset( Collections::objectOperators()[ $tokens[ $before ]['code'] ] );
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Check if a particular token is prefixed with a namespace.
|
|
146
|
-
*
|
|
147
|
-
* {@internal This will give a false positive if the file is not namespaced and the token is prefixed
|
|
148
|
-
* with `namespace\`.}
|
|
149
|
-
*
|
|
150
|
-
* @since 2.1.0
|
|
151
|
-
* @since 3.0.0 - Moved from the Sniff class to this class.
|
|
152
|
-
* - The method visibility was changed from `protected` to `public static`.
|
|
153
|
-
* - The `$phpcsFile` parameter was added.
|
|
154
|
-
*
|
|
155
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
156
|
-
* @param int $stackPtr The index of the token in the stack.
|
|
157
|
-
*
|
|
158
|
-
* @return bool
|
|
159
|
-
*/
|
|
160
|
-
public static function is_token_namespaced( File $phpcsFile, $stackPtr ) {
|
|
161
|
-
$tokens = $phpcsFile->getTokens();
|
|
162
|
-
if ( isset( $tokens[ $stackPtr ] ) === false ) {
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
$prev = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true );
|
|
167
|
-
|
|
168
|
-
if ( \T_NS_SEPARATOR !== $tokens[ $prev ]['code'] ) {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
$before_prev = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $prev - 1 ), null, true );
|
|
173
|
-
if ( \T_STRING !== $tokens[ $before_prev ]['code']
|
|
174
|
-
&& \T_NAMESPACE !== $tokens[ $before_prev ]['code']
|
|
175
|
-
) {
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Check if a token is (part of) a parameter for a function call to a select list of functions.
|
|
184
|
-
*
|
|
185
|
-
* This is useful, for instance, when trying to determine the context a variable is used in.
|
|
186
|
-
*
|
|
187
|
-
* For example: this function could be used to determine if the variable `$foo` is used
|
|
188
|
-
* in a global function call to the function `is_foo()`.
|
|
189
|
-
* In that case, a call to this function would return the stackPtr to the T_STRING `is_foo`
|
|
190
|
-
* for code like: `is_foo( $foo, 'some_other_param' )`, while it would return `false` for
|
|
191
|
-
* the following code `is_bar( $foo, 'some_other_param' )`.
|
|
192
|
-
*
|
|
193
|
-
* @since 2.1.0
|
|
194
|
-
* @since 3.0.0 - Moved from the Sniff class to this class.
|
|
195
|
-
* - The method visibility was changed from `protected` to `public static`.
|
|
196
|
-
* - The `$phpcsFile` parameter was added.
|
|
197
|
-
* - The `$global` parameter was renamed to `$global_function`.
|
|
198
|
-
*
|
|
199
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
200
|
-
* @param int $stackPtr The index of the token in the stack.
|
|
201
|
-
* @param array $valid_functions List of valid function names.
|
|
202
|
-
* Note: The keys to this array should be the function names
|
|
203
|
-
* in lowercase. Values are irrelevant.
|
|
204
|
-
* @param bool $global_function Optional. Whether to make sure that the function call is
|
|
205
|
-
* to a global function. If `false`, calls to methods, be it static
|
|
206
|
-
* `Class::method()` or via an object `$obj->method()`, and
|
|
207
|
-
* namespaced function calls, like `MyNS\function_name()` will
|
|
208
|
-
* also be accepted.
|
|
209
|
-
* Defaults to `true`.
|
|
210
|
-
* @param bool $allow_nested Optional. Whether to allow for nested function calls within the
|
|
211
|
-
* call to this function.
|
|
212
|
-
* I.e. when checking whether a token is within a function call
|
|
213
|
-
* to `strtolower()`, whether to accept `strtolower( trim( $var ) )`
|
|
214
|
-
* or only `strtolower( $var )`.
|
|
215
|
-
* Defaults to `false`.
|
|
216
|
-
*
|
|
217
|
-
* @return int|bool Stack pointer to the function call T_STRING token or false otherwise.
|
|
218
|
-
*/
|
|
219
|
-
public static function is_in_function_call( File $phpcsFile, $stackPtr, array $valid_functions, $global_function = true, $allow_nested = false ) {
|
|
220
|
-
$tokens = $phpcsFile->getTokens();
|
|
221
|
-
if ( ! isset( $tokens[ $stackPtr ]['nested_parenthesis'] ) ) {
|
|
222
|
-
return false;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
$nested_parenthesis = $tokens[ $stackPtr ]['nested_parenthesis'];
|
|
226
|
-
if ( false === $allow_nested ) {
|
|
227
|
-
$nested_parenthesis = array_reverse( $nested_parenthesis, true );
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
foreach ( $nested_parenthesis as $open => $close ) {
|
|
231
|
-
$prev_non_empty = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $open - 1 ), null, true );
|
|
232
|
-
if ( false === $prev_non_empty || \T_STRING !== $tokens[ $prev_non_empty ]['code'] ) {
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if ( isset( $valid_functions[ strtolower( $tokens[ $prev_non_empty ]['content'] ) ] ) === false ) {
|
|
237
|
-
if ( false === $allow_nested ) {
|
|
238
|
-
// Function call encountered, but not to one of the allowed functions.
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if ( false === $global_function ) {
|
|
246
|
-
return $prev_non_empty;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/*
|
|
250
|
-
* Now, make sure it is a global function.
|
|
251
|
-
*/
|
|
252
|
-
if ( self::has_object_operator_before( $phpcsFile, $prev_non_empty ) === true ) {
|
|
253
|
-
continue;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
if ( self::is_token_namespaced( $phpcsFile, $prev_non_empty ) === true ) {
|
|
257
|
-
continue;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return $prev_non_empty;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return false;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Check if a token is inside of an is_...() statement.
|
|
268
|
-
*
|
|
269
|
-
* @since 2.1.0
|
|
270
|
-
* @since 3.0.0 - Moved from the Sniff class to this class.
|
|
271
|
-
* - The method visibility was changed from `protected` to `public static`.
|
|
272
|
-
* - The `$phpcsFile` parameter was added.
|
|
273
|
-
*
|
|
274
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
275
|
-
* @param int $stackPtr The index of the token in the stack.
|
|
276
|
-
*
|
|
277
|
-
* @return bool Whether the token is being type tested.
|
|
278
|
-
*/
|
|
279
|
-
public static function is_in_type_test( File $phpcsFile, $stackPtr ) {
|
|
280
|
-
/*
|
|
281
|
-
* Casting the potential integer stack pointer return value to boolean here is fine.
|
|
282
|
-
* The return can never be `0` as there will always be a PHP open tag before the
|
|
283
|
-
* function call.
|
|
284
|
-
*/
|
|
285
|
-
return (bool) self::is_in_function_call( $phpcsFile, $stackPtr, self::$typeTestFunctions );
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Check if a token is inside of an isset(), empty() or array_key_exists() statement.
|
|
290
|
-
*
|
|
291
|
-
* @since 0.5.0
|
|
292
|
-
* @since 2.1.0 Now checks for the token being used as the array parameter
|
|
293
|
-
* in function calls to array_key_exists() and key_exists() as well.
|
|
294
|
-
* @since 3.0.0 - Moved from the Sniff class to this class.
|
|
295
|
-
* - The method visibility was changed from `protected` to `public static`.
|
|
296
|
-
* - The `$phpcsFile` parameter was added.
|
|
297
|
-
*
|
|
298
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
299
|
-
* @param int $stackPtr The index of the token in the stack.
|
|
300
|
-
*
|
|
301
|
-
* @return bool Whether the token is inside an isset() or empty() statement.
|
|
302
|
-
*/
|
|
303
|
-
public static function is_in_isset_or_empty( File $phpcsFile, $stackPtr ) {
|
|
304
|
-
if ( Parentheses::lastOwnerIn( $phpcsFile, $stackPtr, array( \T_ISSET, \T_EMPTY ) ) !== false ) {
|
|
305
|
-
return true;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
$functionPtr = self::is_in_function_call( $phpcsFile, $stackPtr, self::$key_exists_functions );
|
|
309
|
-
if ( false !== $functionPtr ) {
|
|
310
|
-
/*
|
|
311
|
-
* Both functions being checked have the same parameters. If the function list would
|
|
312
|
-
* be expanded, this needs to be revisited.
|
|
313
|
-
*/
|
|
314
|
-
$array_param = PassedParameters::getParameter( $phpcsFile, $functionPtr, 2, 'array' );
|
|
315
|
-
if ( false !== $array_param
|
|
316
|
-
&& ( $stackPtr >= $array_param['start'] && $stackPtr <= $array_param['end'] )
|
|
317
|
-
) {
|
|
318
|
-
return true;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Retrieve a list of the tokens which are regarded as "safe casts".
|
|
327
|
-
*
|
|
328
|
-
* @since 3.0.0
|
|
329
|
-
*
|
|
330
|
-
* @return array<int|string, true>
|
|
331
|
-
*/
|
|
332
|
-
public static function get_safe_cast_tokens() {
|
|
333
|
-
return self::$safe_casts;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Check if something is being casted to a safe value.
|
|
338
|
-
*
|
|
339
|
-
* @since 0.5.0
|
|
340
|
-
* @since 3.0.0 - Moved from the Sniff class to this class.
|
|
341
|
-
* - The method visibility was changed from `protected` to `public static`.
|
|
342
|
-
* - The `$phpcsFile` parameter was added.
|
|
343
|
-
*
|
|
344
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
345
|
-
* @param int $stackPtr The index of the token in the stack.
|
|
346
|
-
*
|
|
347
|
-
* @return bool Whether the token being casted.
|
|
348
|
-
*/
|
|
349
|
-
public static function is_safe_casted( File $phpcsFile, $stackPtr ) {
|
|
350
|
-
$tokens = $phpcsFile->getTokens();
|
|
351
|
-
if ( isset( $tokens[ $stackPtr ] ) === false ) {
|
|
352
|
-
return false;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
$prev = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true );
|
|
356
|
-
|
|
357
|
-
return isset( self::$safe_casts[ $tokens[ $prev ]['code'] ] );
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Check if a token is inside of an array-value comparison function.
|
|
362
|
-
*
|
|
363
|
-
* @since 2.1.0
|
|
364
|
-
* @since 3.0.0 - Moved from the Sniff class to this class.
|
|
365
|
-
* - The method visibility was changed from `protected` to `public static`.
|
|
366
|
-
* - The `$phpcsFile` parameter was added.
|
|
367
|
-
*
|
|
368
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
369
|
-
* @param int $stackPtr The index of the token in the stack.
|
|
370
|
-
*
|
|
371
|
-
* @return bool Whether the token is (part of) a parameter to an
|
|
372
|
-
* array-value comparison function.
|
|
373
|
-
*/
|
|
374
|
-
public static function is_in_array_comparison( File $phpcsFile, $stackPtr ) {
|
|
375
|
-
$function_ptr = self::is_in_function_call( $phpcsFile, $stackPtr, self::$arrayCompareFunctions, true, true );
|
|
376
|
-
if ( false === $function_ptr ) {
|
|
377
|
-
return false;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
$tokens = $phpcsFile->getTokens();
|
|
381
|
-
$function_name = strtolower( $tokens[ $function_ptr ]['content'] );
|
|
382
|
-
if ( true === self::$arrayCompareFunctions[ $function_name ] ) {
|
|
383
|
-
return true;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
$target_param = self::$arrayCompareFunctions[ $function_name ];
|
|
387
|
-
$found_param = PassedParameters::getParameter( $phpcsFile, $function_ptr, $target_param['position'], $target_param['name'] );
|
|
388
|
-
if ( false !== $found_param ) {
|
|
389
|
-
return true;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
@@ -1,84 +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\Helpers;
|
|
11
|
-
|
|
12
|
-
use PHP_CodeSniffer\Files\File;
|
|
13
|
-
use PHP_CodeSniffer\Util\Tokens;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Helper utilities for checking whether something has been marked as deprecated.
|
|
17
|
-
*
|
|
18
|
-
* ---------------------------------------------------------------------------------------------
|
|
19
|
-
* This class is only intended for internal use by WordPressCS and is not part of the public API.
|
|
20
|
-
* This also means that it has no promise of backward compatibility. Use at your own risk.
|
|
21
|
-
* ---------------------------------------------------------------------------------------------
|
|
22
|
-
*
|
|
23
|
-
* {@internal The functionality in this class will likely be replaced at some point in
|
|
24
|
-
* the future by functions from PHPCSUtils.}
|
|
25
|
-
*
|
|
26
|
-
* @internal
|
|
27
|
-
*
|
|
28
|
-
* @since 3.0.0 The method in this class was previously contained in the
|
|
29
|
-
* `WordPressCS\WordPress\Sniff` class and has been moved here.
|
|
30
|
-
*/
|
|
31
|
-
final class DeprecationHelper {
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Check whether a function has been marked as deprecated via a @deprecated tag
|
|
35
|
-
* in the function docblock.
|
|
36
|
-
*
|
|
37
|
-
* @since 2.2.0
|
|
38
|
-
* @since 3.0.0 Moved from the Sniff class to this class.
|
|
39
|
-
*
|
|
40
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
41
|
-
* @param int $stackPtr The position of a T_FUNCTION
|
|
42
|
-
* token in the stack.
|
|
43
|
-
*
|
|
44
|
-
* @return bool
|
|
45
|
-
*/
|
|
46
|
-
public static function is_function_deprecated( File $phpcsFile, $stackPtr ) {
|
|
47
|
-
$tokens = $phpcsFile->getTokens();
|
|
48
|
-
if ( isset( $tokens[ $stackPtr ] ) === false ) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
$ignore = Tokens::$methodPrefixes;
|
|
53
|
-
$ignore[ \T_WHITESPACE ] = \T_WHITESPACE;
|
|
54
|
-
|
|
55
|
-
for ( $comment_end = ( $stackPtr - 1 ); $comment_end >= 0; $comment_end-- ) {
|
|
56
|
-
if ( isset( $ignore[ $tokens[ $comment_end ]['code'] ] ) === true ) {
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if ( \T_ATTRIBUTE_END === $tokens[ $comment_end ]['code']
|
|
61
|
-
&& isset( $tokens[ $comment_end ]['attribute_opener'] ) === true
|
|
62
|
-
) {
|
|
63
|
-
$comment_end = $tokens[ $comment_end ]['attribute_opener'];
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if ( \T_DOC_COMMENT_CLOSE_TAG !== $tokens[ $comment_end ]['code'] ) {
|
|
71
|
-
// Function doesn't have a doc comment or is using the wrong type of comment.
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
$comment_start = $tokens[ $comment_end ]['comment_opener'];
|
|
76
|
-
foreach ( $tokens[ $comment_start ]['comment_tags'] as $tag ) {
|
|
77
|
-
if ( '@deprecated' === $tokens[ $tag ]['content'] ) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
}
|