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,781 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* PHPCSUtils, utility functions and classes for PHP_CodeSniffer sniff developers.
|
|
4
|
-
*
|
|
5
|
-
* @package PHPCSUtils
|
|
6
|
-
* @copyright 2019-2020 PHPCSUtils Contributors
|
|
7
|
-
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
|
8
|
-
* @link https://github.com/PHPCSStandards/PHPCSUtils
|
|
9
|
-
*
|
|
10
|
-
* The methods in this class are imported from the PHP_CodeSniffer project.
|
|
11
|
-
* Note: this is not a one-on-one import of the `File` class!
|
|
12
|
-
*
|
|
13
|
-
* Copyright of the original code in this class as per the import:
|
|
14
|
-
* @author Greg Sherwood <gsherwood@squiz.net>
|
|
15
|
-
* @author Jaroslav Hanslík <kukulich@kukulich.cz>
|
|
16
|
-
* @author jdavis <jdavis@bamboohr.com>
|
|
17
|
-
* @author Klaus Purer <klaus.purer@gmail.com>
|
|
18
|
-
* @author Juliette Reinders Folmer <jrf@phpcodesniffer.info>
|
|
19
|
-
* @author Nick Wilde <nick@briarmoon.ca>
|
|
20
|
-
* @author Martin Hujer <mhujer@gmail.com>
|
|
21
|
-
* @author Chris Wilkinson <c.wilkinson@elifesciences.org>
|
|
22
|
-
*
|
|
23
|
-
* With documentation contributions from:
|
|
24
|
-
* @author Pascal Borreli <pascal@borreli.com>
|
|
25
|
-
* @author Diogo Oliveira de Melo <dmelo87@gmail.com>
|
|
26
|
-
* @author Stefano Kowalke <blueduck@gmx.net>
|
|
27
|
-
* @author George Mponos <gmponos@gmail.com>
|
|
28
|
-
* @author Tyson Andre <tysonandre775@hotmail.com>
|
|
29
|
-
* @author Klaus Purer <klaus.purer@protonmail.ch>
|
|
30
|
-
*
|
|
31
|
-
* @copyright 2006-2019 Squiz Pty Ltd (ABN 77 084 670 600)
|
|
32
|
-
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
namespace PHPCSUtils\BackCompat;
|
|
36
|
-
|
|
37
|
-
use PHP_CodeSniffer\Exceptions\RuntimeException;
|
|
38
|
-
use PHP_CodeSniffer\Files\File;
|
|
39
|
-
use PHP_CodeSniffer\Util\Tokens;
|
|
40
|
-
use PHPCSUtils\Tokens\Collections;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* PHPCS native utility functions.
|
|
44
|
-
*
|
|
45
|
-
* Backport of the latest versions of PHPCS native utility functions to make them
|
|
46
|
-
* available in older PHPCS versions without the bugs and other quirks that the
|
|
47
|
-
* older versions of the native functions had.
|
|
48
|
-
*
|
|
49
|
-
* Additionally, this class works round the following tokenizer issues for
|
|
50
|
-
* any affected utility functions:
|
|
51
|
-
* - `readonly` classes.
|
|
52
|
-
* - Constructor property promotion with `readonly` without visibility.
|
|
53
|
-
* - OO methods called `self`, `parent` or `static`.
|
|
54
|
-
*
|
|
55
|
-
* Most functions in this class will have a related twin-function in the relevant
|
|
56
|
-
* class in the `PHPCSUtils\Utils` namespace.
|
|
57
|
-
* These will be indicated with `@see` tags in the docblock of the function.
|
|
58
|
-
*
|
|
59
|
-
* The PHPCSUtils native twin-functions will often have additional features and/or
|
|
60
|
-
* improved functionality, but will generally be fully compatible with the PHPCS
|
|
61
|
-
* native functions.
|
|
62
|
-
* The differences between the functions here and the twin functions are documented
|
|
63
|
-
* in the docblock of the respective twin-function.
|
|
64
|
-
*
|
|
65
|
-
* @see \PHP_CodeSniffer\Files\File Original source of these utility methods.
|
|
66
|
-
*
|
|
67
|
-
* @since 1.0.0
|
|
68
|
-
*/
|
|
69
|
-
final class BCFile
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Returns the declaration name for classes, interfaces, traits, enums, and functions.
|
|
74
|
-
*
|
|
75
|
-
* PHPCS cross-version compatible version of the `File::getDeclarationName()` method.
|
|
76
|
-
*
|
|
77
|
-
* Changelog for the PHPCS native function:
|
|
78
|
-
* - Introduced in PHPCS 0.0.5.
|
|
79
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
80
|
-
*
|
|
81
|
-
* @see \PHP_CodeSniffer\Files\File::getDeclarationName() Original source.
|
|
82
|
-
* @see \PHPCSUtils\Utils\ObjectDeclarations::getName() PHPCSUtils native improved version.
|
|
83
|
-
*
|
|
84
|
-
* @since 1.0.0
|
|
85
|
-
*
|
|
86
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
87
|
-
* @param int $stackPtr The position of the declaration token
|
|
88
|
-
* which declared the class, interface,
|
|
89
|
-
* trait, enum or function.
|
|
90
|
-
*
|
|
91
|
-
* @return string|null The name of the class, interface, trait, enum, or function;
|
|
92
|
-
* or `NULL` if the function or class is anonymous or
|
|
93
|
-
* in case of a parse error/live coding.
|
|
94
|
-
*
|
|
95
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified token is not of type
|
|
96
|
-
* `T_FUNCTION`, `T_CLASS`, `T_ANON_CLASS`,
|
|
97
|
-
* `T_CLOSURE`, `T_TRAIT`, `T_ENUM` or `T_INTERFACE`.
|
|
98
|
-
*/
|
|
99
|
-
public static function getDeclarationName(File $phpcsFile, $stackPtr)
|
|
100
|
-
{
|
|
101
|
-
return $phpcsFile->getDeclarationName($stackPtr);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Returns the method parameters for the specified function token.
|
|
106
|
-
*
|
|
107
|
-
* Also supports passing in a `T_USE` token for a closure use group.
|
|
108
|
-
*
|
|
109
|
-
* Each parameter is in the following format:
|
|
110
|
-
* ```php
|
|
111
|
-
* 0 => array(
|
|
112
|
-
* 'name' => string, // The variable name.
|
|
113
|
-
* 'token' => integer, // The stack pointer to the variable name.
|
|
114
|
-
* 'content' => string, // The full content of the variable definition.
|
|
115
|
-
* 'has_attributes' => boolean, // Does the parameter have one or more attributes attached ?
|
|
116
|
-
* 'pass_by_reference' => boolean, // Is the variable passed by reference?
|
|
117
|
-
* 'reference_token' => integer|false, // The stack pointer to the reference operator
|
|
118
|
-
* // or FALSE if the param is not passed by reference.
|
|
119
|
-
* 'variable_length' => boolean, // Is the param of variable length through use of `...` ?
|
|
120
|
-
* 'variadic_token' => integer|false, // The stack pointer to the ... operator
|
|
121
|
-
* // or FALSE if the param is not variable length.
|
|
122
|
-
* 'type_hint' => string, // The type hint for the variable.
|
|
123
|
-
* 'type_hint_token' => integer|false, // The stack pointer to the start of the type hint
|
|
124
|
-
* // or FALSE if there is no type hint.
|
|
125
|
-
* 'type_hint_end_token' => integer|false, // The stack pointer to the end of the type hint
|
|
126
|
-
* // or FALSE if there is no type hint.
|
|
127
|
-
* 'nullable_type' => boolean, // TRUE if the param type is preceded by the nullability
|
|
128
|
-
* // operator.
|
|
129
|
-
* 'comma_token' => integer|false, // The stack pointer to the comma after the param
|
|
130
|
-
* // or FALSE if this is the last param.
|
|
131
|
-
* )
|
|
132
|
-
* ```
|
|
133
|
-
*
|
|
134
|
-
* Parameters with default values have the following additional array indexes:
|
|
135
|
-
* ```php
|
|
136
|
-
* 'default' => string, // The full content of the default value.
|
|
137
|
-
* 'default_token' => integer, // The stack pointer to the start of the default value.
|
|
138
|
-
* 'default_equal_token' => integer, // The stack pointer to the equals sign.
|
|
139
|
-
* ```
|
|
140
|
-
*
|
|
141
|
-
* Parameters declared using PHP 8 constructor property promotion, have these additional array indexes:
|
|
142
|
-
* ```php
|
|
143
|
-
* 'property_visibility' => string, // The property visibility as declared.
|
|
144
|
-
* 'visibility_token' => integer|false, // The stack pointer to the visibility modifier token.
|
|
145
|
-
* // or FALSE if the visibility is not explicitly declared.
|
|
146
|
-
* 'property_readonly' => boolean, // TRUE if the readonly keyword was found.
|
|
147
|
-
* 'readonly_token' => integer, // The stack pointer to the readonly modifier token.
|
|
148
|
-
* // This index will only be set if the property is readonly.
|
|
149
|
-
* ```
|
|
150
|
-
*
|
|
151
|
-
* PHPCS cross-version compatible version of the `File::getMethodParameters()` method.
|
|
152
|
-
*
|
|
153
|
-
* Changelog for the PHPCS native function:
|
|
154
|
-
* - Introduced in PHPCS 0.0.5.
|
|
155
|
-
* - PHPCS 3.8.0: Added support for constructor property promotion with readonly without explicit visibility.
|
|
156
|
-
*
|
|
157
|
-
* @see \PHP_CodeSniffer\Files\File::getMethodParameters() Original source.
|
|
158
|
-
* @see \PHPCSUtils\Utils\FunctionDeclarations::getParameters() PHPCSUtils native improved version.
|
|
159
|
-
*
|
|
160
|
-
* @since 1.0.0
|
|
161
|
-
* @since 1.0.6 Sync with PHPCS 3.8.0, support for readonly properties without explicit visibility. PHPCS#3801.
|
|
162
|
-
*
|
|
163
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
164
|
-
* @param int $stackPtr The position in the stack of the function token
|
|
165
|
-
* to acquire the parameters for.
|
|
166
|
-
*
|
|
167
|
-
* @return array<int, array<string, mixed>>
|
|
168
|
-
*
|
|
169
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified `$stackPtr` is not of
|
|
170
|
-
* type `T_FUNCTION`, `T_CLOSURE`, `T_USE`,
|
|
171
|
-
* or `T_FN`.
|
|
172
|
-
*/
|
|
173
|
-
public static function getMethodParameters(File $phpcsFile, $stackPtr)
|
|
174
|
-
{
|
|
175
|
-
$tokens = $phpcsFile->getTokens();
|
|
176
|
-
|
|
177
|
-
if (isset(Collections::functionDeclarationTokens()[$tokens[$stackPtr]['code']]) === false
|
|
178
|
-
&& $tokens[$stackPtr]['code'] !== T_USE
|
|
179
|
-
) {
|
|
180
|
-
throw new RuntimeException('$stackPtr must be of type T_FUNCTION or T_CLOSURE or T_USE or T_FN');
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if ($tokens[$stackPtr]['code'] === T_USE) {
|
|
184
|
-
$opener = $phpcsFile->findNext(T_OPEN_PARENTHESIS, ($stackPtr + 1));
|
|
185
|
-
if ($opener === false
|
|
186
|
-
|| (isset($tokens[$opener]['parenthesis_owner']) === true
|
|
187
|
-
// BC: as of PHPCS 4.x, closure use tokens are parentheses owners.
|
|
188
|
-
&& $tokens[$opener]['parenthesis_owner'] !== $stackPtr)
|
|
189
|
-
) {
|
|
190
|
-
throw new RuntimeException('$stackPtr was not a valid T_USE');
|
|
191
|
-
}
|
|
192
|
-
} else {
|
|
193
|
-
if (isset($tokens[$stackPtr]['parenthesis_opener']) === false) {
|
|
194
|
-
// Live coding or syntax error, so no params to find.
|
|
195
|
-
return [];
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
$opener = $tokens[$stackPtr]['parenthesis_opener'];
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (isset($tokens[$opener]['parenthesis_closer']) === false) {
|
|
202
|
-
// Live coding or syntax error, so no params to find.
|
|
203
|
-
return [];
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
$closer = $tokens[$opener]['parenthesis_closer'];
|
|
207
|
-
|
|
208
|
-
$vars = [];
|
|
209
|
-
$currVar = null;
|
|
210
|
-
$paramStart = ($opener + 1);
|
|
211
|
-
$defaultStart = null;
|
|
212
|
-
$equalToken = null;
|
|
213
|
-
$paramCount = 0;
|
|
214
|
-
$hasAttributes = false;
|
|
215
|
-
$passByReference = false;
|
|
216
|
-
$referenceToken = false;
|
|
217
|
-
$variableLength = false;
|
|
218
|
-
$variadicToken = false;
|
|
219
|
-
$typeHint = '';
|
|
220
|
-
$typeHintToken = false;
|
|
221
|
-
$typeHintEndToken = false;
|
|
222
|
-
$nullableType = false;
|
|
223
|
-
$visibilityToken = null;
|
|
224
|
-
$readonlyToken = null;
|
|
225
|
-
|
|
226
|
-
for ($i = $paramStart; $i <= $closer; $i++) {
|
|
227
|
-
// Check to see if this token has a parenthesis or bracket opener. If it does
|
|
228
|
-
// it's likely to be an array which might have arguments in it. This
|
|
229
|
-
// could cause problems in our parsing below, so lets just skip to the
|
|
230
|
-
// end of it.
|
|
231
|
-
if ($tokens[$i]['code'] !== T_TYPE_OPEN_PARENTHESIS
|
|
232
|
-
&& isset($tokens[$i]['parenthesis_opener']) === true
|
|
233
|
-
) {
|
|
234
|
-
// Don't do this if it's the close parenthesis for the method.
|
|
235
|
-
if ($i !== $tokens[$i]['parenthesis_closer']) {
|
|
236
|
-
$i = ($tokens[$i]['parenthesis_closer'] + 1);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (isset($tokens[$i]['bracket_opener']) === true) {
|
|
241
|
-
// Don't do this if it's the close parenthesis for the method.
|
|
242
|
-
if ($i !== $tokens[$i]['bracket_closer']) {
|
|
243
|
-
$i = ($tokens[$i]['bracket_closer'] + 1);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
switch ($tokens[$i]['code']) {
|
|
248
|
-
case T_ATTRIBUTE:
|
|
249
|
-
$hasAttributes = true;
|
|
250
|
-
|
|
251
|
-
// Skip to the end of the attribute.
|
|
252
|
-
$i = $tokens[$i]['attribute_closer'];
|
|
253
|
-
break;
|
|
254
|
-
case T_BITWISE_AND:
|
|
255
|
-
if ($defaultStart === null) {
|
|
256
|
-
$passByReference = true;
|
|
257
|
-
$referenceToken = $i;
|
|
258
|
-
}
|
|
259
|
-
break;
|
|
260
|
-
case T_VARIABLE:
|
|
261
|
-
$currVar = $i;
|
|
262
|
-
break;
|
|
263
|
-
case T_ELLIPSIS:
|
|
264
|
-
$variableLength = true;
|
|
265
|
-
$variadicToken = $i;
|
|
266
|
-
break;
|
|
267
|
-
case T_CALLABLE:
|
|
268
|
-
if ($typeHintToken === false) {
|
|
269
|
-
$typeHintToken = $i;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
$typeHint .= $tokens[$i]['content'];
|
|
273
|
-
$typeHintEndToken = $i;
|
|
274
|
-
break;
|
|
275
|
-
case T_SELF:
|
|
276
|
-
case T_PARENT:
|
|
277
|
-
case T_STATIC:
|
|
278
|
-
// Self and parent are valid, static invalid, but was probably intended as type hint.
|
|
279
|
-
if (isset($defaultStart) === false) {
|
|
280
|
-
if ($typeHintToken === false) {
|
|
281
|
-
$typeHintToken = $i;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
$typeHint .= $tokens[$i]['content'];
|
|
285
|
-
$typeHintEndToken = $i;
|
|
286
|
-
}
|
|
287
|
-
break;
|
|
288
|
-
case T_STRING:
|
|
289
|
-
case T_NAME_QUALIFIED:
|
|
290
|
-
case T_NAME_FULLY_QUALIFIED:
|
|
291
|
-
case T_NAME_RELATIVE:
|
|
292
|
-
// This is an identifier name, so it may be a type declaration, but it could
|
|
293
|
-
// also be a constant used as a default value.
|
|
294
|
-
$prevComma = false;
|
|
295
|
-
for ($t = $i; $t >= $opener; $t--) {
|
|
296
|
-
if ($tokens[$t]['code'] === T_COMMA) {
|
|
297
|
-
$prevComma = $t;
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if ($prevComma !== false) {
|
|
303
|
-
$nextEquals = false;
|
|
304
|
-
for ($t = $prevComma; $t < $i; $t++) {
|
|
305
|
-
if ($tokens[$t]['code'] === T_EQUAL) {
|
|
306
|
-
$nextEquals = $t;
|
|
307
|
-
break;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
if ($nextEquals !== false) {
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
if ($defaultStart === null) {
|
|
317
|
-
if ($typeHintToken === false) {
|
|
318
|
-
$typeHintToken = $i;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
$typeHint .= $tokens[$i]['content'];
|
|
322
|
-
$typeHintEndToken = $i;
|
|
323
|
-
}
|
|
324
|
-
break;
|
|
325
|
-
case T_NAMESPACE:
|
|
326
|
-
case T_NS_SEPARATOR:
|
|
327
|
-
case T_TYPE_UNION:
|
|
328
|
-
case T_TYPE_INTERSECTION:
|
|
329
|
-
case T_TYPE_OPEN_PARENTHESIS:
|
|
330
|
-
case T_TYPE_CLOSE_PARENTHESIS:
|
|
331
|
-
case T_FALSE:
|
|
332
|
-
case T_TRUE:
|
|
333
|
-
case T_NULL:
|
|
334
|
-
// Part of a type hint or default value.
|
|
335
|
-
if ($defaultStart === null) {
|
|
336
|
-
if ($typeHintToken === false) {
|
|
337
|
-
$typeHintToken = $i;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
$typeHint .= $tokens[$i]['content'];
|
|
341
|
-
$typeHintEndToken = $i;
|
|
342
|
-
}
|
|
343
|
-
break;
|
|
344
|
-
case T_NULLABLE:
|
|
345
|
-
if ($defaultStart === null) {
|
|
346
|
-
$nullableType = true;
|
|
347
|
-
$typeHint .= $tokens[$i]['content'];
|
|
348
|
-
$typeHintEndToken = $i;
|
|
349
|
-
}
|
|
350
|
-
break;
|
|
351
|
-
case T_PUBLIC:
|
|
352
|
-
case T_PROTECTED:
|
|
353
|
-
case T_PRIVATE:
|
|
354
|
-
if ($defaultStart === null) {
|
|
355
|
-
$visibilityToken = $i;
|
|
356
|
-
}
|
|
357
|
-
break;
|
|
358
|
-
case T_READONLY:
|
|
359
|
-
if ($defaultStart === null) {
|
|
360
|
-
$readonlyToken = $i;
|
|
361
|
-
}
|
|
362
|
-
break;
|
|
363
|
-
case T_CLOSE_PARENTHESIS:
|
|
364
|
-
case T_COMMA:
|
|
365
|
-
// If it's null, then there must be no parameters for this
|
|
366
|
-
// method.
|
|
367
|
-
if ($currVar === null) {
|
|
368
|
-
continue 2;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
$vars[$paramCount] = [];
|
|
372
|
-
$vars[$paramCount]['token'] = $currVar;
|
|
373
|
-
$vars[$paramCount]['name'] = $tokens[$currVar]['content'];
|
|
374
|
-
$vars[$paramCount]['content'] = trim($phpcsFile->getTokensAsString($paramStart, ($i - $paramStart)));
|
|
375
|
-
|
|
376
|
-
if ($defaultStart !== null) {
|
|
377
|
-
$vars[$paramCount]['default'] = trim($phpcsFile->getTokensAsString($defaultStart, ($i - $defaultStart)));
|
|
378
|
-
$vars[$paramCount]['default_token'] = $defaultStart;
|
|
379
|
-
$vars[$paramCount]['default_equal_token'] = $equalToken;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
$vars[$paramCount]['has_attributes'] = $hasAttributes;
|
|
383
|
-
$vars[$paramCount]['pass_by_reference'] = $passByReference;
|
|
384
|
-
$vars[$paramCount]['reference_token'] = $referenceToken;
|
|
385
|
-
$vars[$paramCount]['variable_length'] = $variableLength;
|
|
386
|
-
$vars[$paramCount]['variadic_token'] = $variadicToken;
|
|
387
|
-
$vars[$paramCount]['type_hint'] = $typeHint;
|
|
388
|
-
$vars[$paramCount]['type_hint_token'] = $typeHintToken;
|
|
389
|
-
$vars[$paramCount]['type_hint_end_token'] = $typeHintEndToken;
|
|
390
|
-
$vars[$paramCount]['nullable_type'] = $nullableType;
|
|
391
|
-
|
|
392
|
-
if ($visibilityToken !== null || $readonlyToken !== null) {
|
|
393
|
-
$vars[$paramCount]['property_visibility'] = 'public';
|
|
394
|
-
$vars[$paramCount]['visibility_token'] = false;
|
|
395
|
-
$vars[$paramCount]['property_readonly'] = false;
|
|
396
|
-
|
|
397
|
-
if ($visibilityToken !== null) {
|
|
398
|
-
$vars[$paramCount]['property_visibility'] = $tokens[$visibilityToken]['content'];
|
|
399
|
-
$vars[$paramCount]['visibility_token'] = $visibilityToken;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
if ($readonlyToken !== null) {
|
|
403
|
-
$vars[$paramCount]['property_readonly'] = true;
|
|
404
|
-
$vars[$paramCount]['readonly_token'] = $readonlyToken;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
if ($tokens[$i]['code'] === T_COMMA) {
|
|
409
|
-
$vars[$paramCount]['comma_token'] = $i;
|
|
410
|
-
} else {
|
|
411
|
-
$vars[$paramCount]['comma_token'] = false;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
// Reset the vars, as we are about to process the next parameter.
|
|
415
|
-
$currVar = null;
|
|
416
|
-
$paramStart = ($i + 1);
|
|
417
|
-
$defaultStart = null;
|
|
418
|
-
$equalToken = null;
|
|
419
|
-
$hasAttributes = false;
|
|
420
|
-
$passByReference = false;
|
|
421
|
-
$referenceToken = false;
|
|
422
|
-
$variableLength = false;
|
|
423
|
-
$variadicToken = false;
|
|
424
|
-
$typeHint = '';
|
|
425
|
-
$typeHintToken = false;
|
|
426
|
-
$typeHintEndToken = false;
|
|
427
|
-
$nullableType = false;
|
|
428
|
-
$visibilityToken = null;
|
|
429
|
-
$readonlyToken = null;
|
|
430
|
-
|
|
431
|
-
++$paramCount;
|
|
432
|
-
break;
|
|
433
|
-
case T_EQUAL:
|
|
434
|
-
$defaultStart = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true);
|
|
435
|
-
$equalToken = $i;
|
|
436
|
-
break;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
return $vars;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Returns the visibility and implementation properties of a method.
|
|
445
|
-
*
|
|
446
|
-
* The format of the return value is:
|
|
447
|
-
* ```php
|
|
448
|
-
* array(
|
|
449
|
-
* 'scope' => string, // Public, private, or protected
|
|
450
|
-
* 'scope_specified' => boolean, // TRUE if the scope keyword was found.
|
|
451
|
-
* 'return_type' => string, // The return type of the method.
|
|
452
|
-
* 'return_type_token' => integer|false, // The stack pointer to the start of the return type
|
|
453
|
-
* // or FALSE if there is no return type.
|
|
454
|
-
* 'return_type_end_token' => integer|false, // The stack pointer to the end of the return type
|
|
455
|
-
* // or FALSE if there is no return type.
|
|
456
|
-
* 'nullable_return_type' => boolean, // TRUE if the return type is preceded by
|
|
457
|
-
* // the nullability operator.
|
|
458
|
-
* 'is_abstract' => boolean, // TRUE if the abstract keyword was found.
|
|
459
|
-
* 'is_final' => boolean, // TRUE if the final keyword was found.
|
|
460
|
-
* 'is_static' => boolean, // TRUE if the static keyword was found.
|
|
461
|
-
* 'has_body' => boolean, // TRUE if the method has a body
|
|
462
|
-
* );
|
|
463
|
-
* ```
|
|
464
|
-
*
|
|
465
|
-
* PHPCS cross-version compatible version of the `File::getMethodProperties()` method.
|
|
466
|
-
*
|
|
467
|
-
* Changelog for the PHPCS native function:
|
|
468
|
-
* - Introduced in PHPCS 0.0.5.
|
|
469
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
470
|
-
*
|
|
471
|
-
* @see \PHP_CodeSniffer\Files\File::getMethodProperties() Original source.
|
|
472
|
-
* @see \PHPCSUtils\Utils\FunctionDeclarations::getProperties() PHPCSUtils native improved version.
|
|
473
|
-
*
|
|
474
|
-
* @since 1.0.0
|
|
475
|
-
*
|
|
476
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
477
|
-
* @param int $stackPtr The position in the stack of the function token to
|
|
478
|
-
* acquire the properties for.
|
|
479
|
-
*
|
|
480
|
-
* @return array<string, mixed>
|
|
481
|
-
*
|
|
482
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
|
|
483
|
-
* `T_FUNCTION`, `T_CLOSURE`, or `T_FN` token.
|
|
484
|
-
*/
|
|
485
|
-
public static function getMethodProperties(File $phpcsFile, $stackPtr)
|
|
486
|
-
{
|
|
487
|
-
return $phpcsFile->getMethodProperties($stackPtr);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Returns the visibility and implementation properties of a class member var.
|
|
492
|
-
*
|
|
493
|
-
* The format of the return value is:
|
|
494
|
-
* ```php
|
|
495
|
-
* array(
|
|
496
|
-
* 'scope' => string, // Public, private, or protected.
|
|
497
|
-
* 'scope_specified' => boolean, // TRUE if the scope was explicitly specified.
|
|
498
|
-
* 'is_static' => boolean, // TRUE if the static keyword was found.
|
|
499
|
-
* 'is_readonly' => boolean, // TRUE if the readonly keyword was found.
|
|
500
|
-
* 'type' => string, // The type of the var (empty if no type specified).
|
|
501
|
-
* 'type_token' => integer|false, // The stack pointer to the start of the type
|
|
502
|
-
* // or FALSE if there is no type.
|
|
503
|
-
* 'type_end_token' => integer|false, // The stack pointer to the end of the type
|
|
504
|
-
* // or FALSE if there is no type.
|
|
505
|
-
* 'nullable_type' => boolean, // TRUE if the type is preceded by the
|
|
506
|
-
* // nullability operator.
|
|
507
|
-
* );
|
|
508
|
-
* ```
|
|
509
|
-
*
|
|
510
|
-
* PHPCS cross-version compatible version of the `File::getMemberProperties() method.
|
|
511
|
-
*
|
|
512
|
-
* Changelog for the PHPCS native function:
|
|
513
|
-
* - Introduced in PHPCS 0.0.5.
|
|
514
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
515
|
-
*
|
|
516
|
-
* @see \PHP_CodeSniffer\Files\File::getMemberProperties() Original source.
|
|
517
|
-
* @see \PHPCSUtils\Utils\Variables::getMemberProperties() PHPCSUtils native improved version.
|
|
518
|
-
*
|
|
519
|
-
* @since 1.0.0
|
|
520
|
-
*
|
|
521
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
522
|
-
* @param int $stackPtr The position in the stack of the `T_VARIABLE` token to
|
|
523
|
-
* acquire the properties for.
|
|
524
|
-
*
|
|
525
|
-
* @return array<string, mixed>
|
|
526
|
-
*
|
|
527
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
|
|
528
|
-
* `T_VARIABLE` token, or if the position is not
|
|
529
|
-
* a class member variable.
|
|
530
|
-
*/
|
|
531
|
-
public static function getMemberProperties(File $phpcsFile, $stackPtr)
|
|
532
|
-
{
|
|
533
|
-
return $phpcsFile->getMemberProperties($stackPtr);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* Returns the implementation properties of a class.
|
|
538
|
-
*
|
|
539
|
-
* The format of the return value is:
|
|
540
|
-
* ```php
|
|
541
|
-
* array(
|
|
542
|
-
* 'is_abstract' => boolean, // TRUE if the abstract keyword was found.
|
|
543
|
-
* 'is_final' => boolean, // TRUE if the final keyword was found.
|
|
544
|
-
* 'is_readonly' => boolean, // TRUE if the readonly keyword was found.
|
|
545
|
-
* );
|
|
546
|
-
* ```
|
|
547
|
-
*
|
|
548
|
-
* PHPCS cross-version compatible version of the `File::getClassProperties()` method.
|
|
549
|
-
*
|
|
550
|
-
* Changelog for the PHPCS native function:
|
|
551
|
-
* - Introduced in PHPCS 1.3.0.
|
|
552
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
553
|
-
*
|
|
554
|
-
* @see \PHP_CodeSniffer\Files\File::getClassProperties() Original source.
|
|
555
|
-
* @see \PHPCSUtils\Utils\ObjectDeclarations::getClassProperties() PHPCSUtils native improved version.
|
|
556
|
-
*
|
|
557
|
-
* @since 1.0.0
|
|
558
|
-
*
|
|
559
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
560
|
-
* @param int $stackPtr The position in the stack of the `T_CLASS`
|
|
561
|
-
* token to acquire the properties for.
|
|
562
|
-
*
|
|
563
|
-
* @return array<string, bool>
|
|
564
|
-
*
|
|
565
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
|
|
566
|
-
* `T_CLASS` token.
|
|
567
|
-
*/
|
|
568
|
-
public static function getClassProperties(File $phpcsFile, $stackPtr)
|
|
569
|
-
{
|
|
570
|
-
return $phpcsFile->getClassProperties($stackPtr);
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* Determine if the passed token is a reference operator.
|
|
575
|
-
*
|
|
576
|
-
* PHPCS cross-version compatible version of the `File::isReference()` method.
|
|
577
|
-
*
|
|
578
|
-
* Changelog for the PHPCS native function:
|
|
579
|
-
* - Introduced in PHPCS 0.0.5.
|
|
580
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
581
|
-
*
|
|
582
|
-
* @see \PHP_CodeSniffer\Files\File::isReference() Original source.
|
|
583
|
-
* @see \PHPCSUtils\Utils\Operators::isReference() PHPCSUtils native improved version.
|
|
584
|
-
*
|
|
585
|
-
* @since 1.0.0
|
|
586
|
-
*
|
|
587
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
588
|
-
* @param int $stackPtr The position of the `T_BITWISE_AND` token.
|
|
589
|
-
*
|
|
590
|
-
* @return bool `TRUE` if the specified token position represents a reference.
|
|
591
|
-
* `FALSE` if the token represents a bitwise operator.
|
|
592
|
-
*/
|
|
593
|
-
public static function isReference(File $phpcsFile, $stackPtr)
|
|
594
|
-
{
|
|
595
|
-
return $phpcsFile->isReference($stackPtr);
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Returns the content of the tokens from the specified start position in
|
|
600
|
-
* the token stack for the specified length.
|
|
601
|
-
*
|
|
602
|
-
* PHPCS cross-version compatible version of the `File::getTokensAsString()` method.
|
|
603
|
-
*
|
|
604
|
-
* Changelog for the PHPCS native function:
|
|
605
|
-
* - Introduced in PHPCS 0.0.5.
|
|
606
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
607
|
-
*
|
|
608
|
-
* @see \PHP_CodeSniffer\Files\File::getTokensAsString() Original source.
|
|
609
|
-
* @see \PHPCSUtils\Utils\GetTokensAsString Related set of functions.
|
|
610
|
-
*
|
|
611
|
-
* @since 1.0.0
|
|
612
|
-
*
|
|
613
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
614
|
-
* @param int $start The position to start from in the token stack.
|
|
615
|
-
* @param int $length The length of tokens to traverse from the start pos.
|
|
616
|
-
* @param bool $origContent Whether the original content or the tab replaced
|
|
617
|
-
* content should be used.
|
|
618
|
-
*
|
|
619
|
-
* @return string The token contents.
|
|
620
|
-
*
|
|
621
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified start position does not exist.
|
|
622
|
-
*/
|
|
623
|
-
public static function getTokensAsString(File $phpcsFile, $start, $length, $origContent = false)
|
|
624
|
-
{
|
|
625
|
-
return $phpcsFile->getTokensAsString($start, $length, $origContent);
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* Returns the position of the first non-whitespace token in a statement.
|
|
630
|
-
*
|
|
631
|
-
* PHPCS cross-version compatible version of the `File::findStartOfStatement()` method.
|
|
632
|
-
*
|
|
633
|
-
* Changelog for the PHPCS native function:
|
|
634
|
-
* - Introduced in PHPCS 2.1.0.
|
|
635
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
636
|
-
*
|
|
637
|
-
* @see \PHP_CodeSniffer\Files\File::findStartOfStatement() Original source.
|
|
638
|
-
*
|
|
639
|
-
* @since 1.0.0
|
|
640
|
-
*
|
|
641
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
642
|
-
* @param int $start The position to start searching from in the token stack.
|
|
643
|
-
* @param int|string|array<int|string> $ignore Token types that should not be considered stop points.
|
|
644
|
-
*
|
|
645
|
-
* @return int
|
|
646
|
-
*/
|
|
647
|
-
public static function findStartOfStatement(File $phpcsFile, $start, $ignore = null)
|
|
648
|
-
{
|
|
649
|
-
return $phpcsFile->findStartOfStatement($start, $ignore);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
/**
|
|
653
|
-
* Returns the position of the last non-whitespace token in a statement.
|
|
654
|
-
*
|
|
655
|
-
* PHPCS cross-version compatible version of the `File::findEndOfStatement() method.
|
|
656
|
-
*
|
|
657
|
-
* Changelog for the PHPCS native function:
|
|
658
|
-
* - Introduced in PHPCS 2.1.0.
|
|
659
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
660
|
-
*
|
|
661
|
-
* @see \PHP_CodeSniffer\Files\File::findEndOfStatement() Original source.
|
|
662
|
-
*
|
|
663
|
-
* @since 1.0.0
|
|
664
|
-
*
|
|
665
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
666
|
-
* @param int $start The position to start searching from in the token stack.
|
|
667
|
-
* @param int|string|array<int|string> $ignore Token types that should not be considered stop points.
|
|
668
|
-
*
|
|
669
|
-
* @return int
|
|
670
|
-
*/
|
|
671
|
-
public static function findEndOfStatement(File $phpcsFile, $start, $ignore = null)
|
|
672
|
-
{
|
|
673
|
-
return $phpcsFile->findEndOfStatement($start, $ignore);
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* Determine if the passed token has a condition of one of the passed types.
|
|
678
|
-
*
|
|
679
|
-
* PHPCS cross-version compatible version of the `File::hasCondition()` method.
|
|
680
|
-
*
|
|
681
|
-
* Changelog for the PHPCS native function:
|
|
682
|
-
* - Introduced in PHPCS 0.0.5.
|
|
683
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
684
|
-
*
|
|
685
|
-
* @see \PHP_CodeSniffer\Files\File::hasCondition() Original source.
|
|
686
|
-
* @see \PHPCSUtils\Utils\Conditions::hasCondition() PHPCSUtils native alternative.
|
|
687
|
-
*
|
|
688
|
-
* @since 1.0.0
|
|
689
|
-
*
|
|
690
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
691
|
-
* @param int $stackPtr The position of the token we are checking.
|
|
692
|
-
* @param int|string|array<int|string> $types The type(s) of tokens to search for.
|
|
693
|
-
*
|
|
694
|
-
* @return bool
|
|
695
|
-
*/
|
|
696
|
-
public static function hasCondition(File $phpcsFile, $stackPtr, $types)
|
|
697
|
-
{
|
|
698
|
-
return $phpcsFile->hasCondition($stackPtr, $types);
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
/**
|
|
702
|
-
* Return the position of the condition for the passed token.
|
|
703
|
-
*
|
|
704
|
-
* PHPCS cross-version compatible version of the `File::getCondition()` method.
|
|
705
|
-
*
|
|
706
|
-
* Changelog for the PHPCS native function:
|
|
707
|
-
* - Introduced in PHPCS 1.3.0.
|
|
708
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
709
|
-
*
|
|
710
|
-
* @see \PHP_CodeSniffer\Files\File::getCondition() Original source.
|
|
711
|
-
* @see \PHPCSUtils\Utils\Conditions::getCondition() More versatile alternative.
|
|
712
|
-
*
|
|
713
|
-
* @since 1.0.0
|
|
714
|
-
*
|
|
715
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
716
|
-
* @param int $stackPtr The position of the token we are checking.
|
|
717
|
-
* @param int|string $type The type of token to search for.
|
|
718
|
-
* @param bool $first If `true`, will return the matched condition
|
|
719
|
-
* furthest away from the passed token.
|
|
720
|
-
* If `false`, will return the matched condition
|
|
721
|
-
* closest to the passed token.
|
|
722
|
-
*
|
|
723
|
-
* @return int|false Integer stack pointer to the condition or `FALSE` if the token
|
|
724
|
-
* does not have the condition.
|
|
725
|
-
*/
|
|
726
|
-
public static function getCondition(File $phpcsFile, $stackPtr, $type, $first = true)
|
|
727
|
-
{
|
|
728
|
-
return $phpcsFile->getCondition($stackPtr, $type, $first);
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
/**
|
|
732
|
-
* Returns the name of the class that the specified class extends.
|
|
733
|
-
* (works for classes, anonymous classes and interfaces)
|
|
734
|
-
*
|
|
735
|
-
* PHPCS cross-version compatible version of the `File::findExtendedClassName()` method.
|
|
736
|
-
*
|
|
737
|
-
* Changelog for the PHPCS native function:
|
|
738
|
-
* - Introduced in PHPCS 1.2.0.
|
|
739
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
740
|
-
*
|
|
741
|
-
* @see \PHP_CodeSniffer\Files\File::findExtendedClassName() Original source.
|
|
742
|
-
* @see \PHPCSUtils\Utils\ObjectDeclarations::findExtendedClassName() PHPCSUtils native improved version.
|
|
743
|
-
*
|
|
744
|
-
* @since 1.0.0
|
|
745
|
-
*
|
|
746
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
747
|
-
* @param int $stackPtr The stack position of the class or interface.
|
|
748
|
-
*
|
|
749
|
-
* @return string|false The extended class name or `FALSE` on error or if there
|
|
750
|
-
* is no extended class name.
|
|
751
|
-
*/
|
|
752
|
-
public static function findExtendedClassName(File $phpcsFile, $stackPtr)
|
|
753
|
-
{
|
|
754
|
-
return $phpcsFile->findExtendedClassName($stackPtr);
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
/**
|
|
758
|
-
* Returns the names of the interfaces that the specified class or enum implements.
|
|
759
|
-
*
|
|
760
|
-
* PHPCS cross-version compatible version of the `File::findImplementedInterfaceNames()` method.
|
|
761
|
-
*
|
|
762
|
-
* Changelog for the PHPCS native function:
|
|
763
|
-
* - Introduced in PHPCS 2.7.0.
|
|
764
|
-
* - The upstream method has received no significant updates since PHPCS 3.10.0.
|
|
765
|
-
*
|
|
766
|
-
* @see \PHP_CodeSniffer\Files\File::findImplementedInterfaceNames() Original source.
|
|
767
|
-
* @see \PHPCSUtils\Utils\ObjectDeclarations::findImplementedInterfaceNames() PHPCSUtils native improved version.
|
|
768
|
-
*
|
|
769
|
-
* @since 1.0.0
|
|
770
|
-
*
|
|
771
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
772
|
-
* @param int $stackPtr The stack position of the class or enum token.
|
|
773
|
-
*
|
|
774
|
-
* @return array<string>|false Array with names of the implemented interfaces or `FALSE` on
|
|
775
|
-
* error or if there are no implemented interface names.
|
|
776
|
-
*/
|
|
777
|
-
public static function findImplementedInterfaceNames(File $phpcsFile, $stackPtr)
|
|
778
|
-
{
|
|
779
|
-
return $phpcsFile->findImplementedInterfaceNames($stackPtr);
|
|
780
|
-
}
|
|
781
|
-
}
|