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,510 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* PHPCSUtils, utility functions and classes for PHP_CodeSniffer sniff developers.
|
|
4
|
-
*
|
|
5
|
-
* @package PHPCSUtils
|
|
6
|
-
* @copyright 2019-2020 PHPCSUtils Contributors
|
|
7
|
-
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
|
8
|
-
* @link https://github.com/PHPCSStandards/PHPCSUtils
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
namespace PHPCSUtils\Utils;
|
|
12
|
-
|
|
13
|
-
use PHP_CodeSniffer\Exceptions\RuntimeException;
|
|
14
|
-
use PHP_CodeSniffer\Files\File;
|
|
15
|
-
use PHP_CodeSniffer\Util\Tokens;
|
|
16
|
-
use PHPCSUtils\Internal\Cache;
|
|
17
|
-
use PHPCSUtils\Tokens\Collections;
|
|
18
|
-
use PHPCSUtils\Utils\Arrays;
|
|
19
|
-
use PHPCSUtils\Utils\GetTokensAsString;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Utility functions to retrieve information about parameters passed to function calls,
|
|
23
|
-
* class instantiations, array declarations, isset and unset constructs.
|
|
24
|
-
*
|
|
25
|
-
* @since 1.0.0
|
|
26
|
-
*/
|
|
27
|
-
final class PassedParameters
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Tokens which are considered stop point, either because they are the end
|
|
32
|
-
* of the parameter (comma) or because we need to skip over them.
|
|
33
|
-
*
|
|
34
|
-
* @since 1.0.0
|
|
35
|
-
*
|
|
36
|
-
* @var array<int|string, int|string>
|
|
37
|
-
*/
|
|
38
|
-
private static $callParsingStopPoints = [
|
|
39
|
-
\T_COMMA => \T_COMMA,
|
|
40
|
-
\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY,
|
|
41
|
-
\T_OPEN_SQUARE_BRACKET => \T_OPEN_SQUARE_BRACKET,
|
|
42
|
-
\T_OPEN_PARENTHESIS => \T_OPEN_PARENTHESIS,
|
|
43
|
-
\T_DOC_COMMENT_OPEN_TAG => \T_DOC_COMMENT_OPEN_TAG,
|
|
44
|
-
\T_ATTRIBUTE => \T_ATTRIBUTE,
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Checks if any parameters have been passed.
|
|
49
|
-
*
|
|
50
|
-
* - If passed a `T_STRING`, `T_NAME_FULLY_QUALIFIED`, `T_NAME_RELATIVE`, `T_NAME_QUALIFIED`,
|
|
51
|
-
* or `T_VARIABLE` stack pointer, it will treat it as a function call.
|
|
52
|
-
* If a token which is *not* a function call is passed, the behaviour is undetermined.
|
|
53
|
-
* - If passed a `T_ANON_CLASS` stack pointer, it will accept it as a class instantiation.
|
|
54
|
-
* - If passed a `T_SELF`, `T_STATIC` or `T_PARENT` stack pointer, it will accept it as a
|
|
55
|
-
* class instantiation function call when used like `new self()` (with or without parentheses).
|
|
56
|
-
* When these hierarchiecal keywords are not preceded by the `new` keyword, parentheses
|
|
57
|
-
* will be required for the token to be accepted.
|
|
58
|
-
* - If passed a `T_ARRAY` or `T_OPEN_SHORT_ARRAY` stack pointer, it will detect
|
|
59
|
-
* whether the array has values or is empty.
|
|
60
|
-
* For purposes of backward-compatibility with older PHPCS versions, `T_OPEN_SQUARE_BRACKET`
|
|
61
|
-
* tokens will also be accepted and will be checked whether they are in reality
|
|
62
|
-
* a short array opener.
|
|
63
|
-
* - If passed a `T_ISSET` or `T_UNSET` stack pointer, it will detect whether those
|
|
64
|
-
* language constructs have "parameters".
|
|
65
|
-
*
|
|
66
|
-
* @since 1.0.0
|
|
67
|
-
*
|
|
68
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
|
|
69
|
-
* @param int $stackPtr The position of function call name,
|
|
70
|
-
* language construct or array open token.
|
|
71
|
-
* @param true|null $isShortArray Optional. Short-circuit the short array check for
|
|
72
|
-
* `T_OPEN_SHORT_ARRAY` tokens if it isn't necessary.
|
|
73
|
-
* Efficiency tweak for when this has already been established,
|
|
74
|
-
* Use with EXTREME care.
|
|
75
|
-
*
|
|
76
|
-
* @return bool
|
|
77
|
-
*
|
|
78
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the token passed is not one of the
|
|
79
|
-
* accepted types or doesn't exist.
|
|
80
|
-
*/
|
|
81
|
-
public static function hasParameters(File $phpcsFile, $stackPtr, $isShortArray = null)
|
|
82
|
-
{
|
|
83
|
-
$tokens = $phpcsFile->getTokens();
|
|
84
|
-
|
|
85
|
-
if (isset($tokens[$stackPtr]) === false
|
|
86
|
-
|| isset(Collections::parameterPassingTokens()[$tokens[$stackPtr]['code']]) === false
|
|
87
|
-
) {
|
|
88
|
-
throw new RuntimeException(
|
|
89
|
-
'The hasParameters() method expects a function call, array, isset or unset token to be passed.'
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Only accept self/static/parent if preceded by `new` or followed by an open parenthesis.
|
|
94
|
-
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
|
95
|
-
if (isset(Collections::ooHierarchyKeywords()[$tokens[$stackPtr]['code']]) === true) {
|
|
96
|
-
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
|
97
|
-
if ($tokens[$prev]['code'] !== \T_NEW
|
|
98
|
-
&& ($next !== false && $tokens[$next]['code'] !== \T_OPEN_PARENTHESIS)
|
|
99
|
-
) {
|
|
100
|
-
throw new RuntimeException(
|
|
101
|
-
'The hasParameters() method expects a function call, array, isset or unset token to be passed.'
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (isset(Collections::shortArrayListOpenTokensBC()[$tokens[$stackPtr]['code']]) === true
|
|
107
|
-
&& $isShortArray !== true
|
|
108
|
-
&& Arrays::isShortArray($phpcsFile, $stackPtr) === false
|
|
109
|
-
) {
|
|
110
|
-
throw new RuntimeException(
|
|
111
|
-
'The hasParameters() method expects a function call, array, isset or unset token to be passed.'
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if ($next === false) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Deal with short array syntax.
|
|
120
|
-
if (isset(Collections::shortArrayListOpenTokensBC()[$tokens[$stackPtr]['code']]) === true) {
|
|
121
|
-
if ($next === $tokens[$stackPtr]['bracket_closer']) {
|
|
122
|
-
// No parameters.
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return true;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Deal with function calls, long arrays, isset and unset.
|
|
130
|
-
// Next non-empty token should be the open parenthesis.
|
|
131
|
-
if ($tokens[$next]['code'] !== \T_OPEN_PARENTHESIS) {
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (isset($tokens[$next]['parenthesis_closer']) === false) {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
$ignore = Tokens::$emptyTokens;
|
|
140
|
-
$ignore[\T_ELLIPSIS] = \T_ELLIPSIS; // Prevent PHP 8.1 first class callables from being seen as function calls.
|
|
141
|
-
|
|
142
|
-
$closeParenthesis = $tokens[$next]['parenthesis_closer'];
|
|
143
|
-
$nextNextNonEmpty = $phpcsFile->findNext($ignore, ($next + 1), ($closeParenthesis + 1), true);
|
|
144
|
-
|
|
145
|
-
if ($nextNextNonEmpty === $closeParenthesis) {
|
|
146
|
-
// No parameters.
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Get information on all parameters passed.
|
|
155
|
-
*
|
|
156
|
-
* See {@see PassedParameters::hasParameters()} for information on the supported constructs.
|
|
157
|
-
*
|
|
158
|
-
* @since 1.0.0
|
|
159
|
-
*
|
|
160
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
|
|
161
|
-
* @param int $stackPtr The position of function call name,
|
|
162
|
-
* language construct or array open token.
|
|
163
|
-
* @param int $limit Optional. Limit the parameter retrieval to the first #
|
|
164
|
-
* parameters/array entries.
|
|
165
|
-
* Use with care on function calls, as this can break
|
|
166
|
-
* support for named parameters!
|
|
167
|
-
* @param true|null $isShortArray Optional. Short-circuit the short array check for
|
|
168
|
-
* `T_OPEN_SHORT_ARRAY` tokens if it isn't necessary.
|
|
169
|
-
* Efficiency tweak for when this has already been established,
|
|
170
|
-
* Use with EXTREME care.
|
|
171
|
-
*
|
|
172
|
-
* @return array<int|string, array<string, int|string>>
|
|
173
|
-
* A multi-dimentional array with information on each parameter/array item.
|
|
174
|
-
* The information gathered about each parameter/array item is in the following format:
|
|
175
|
-
* ```php
|
|
176
|
-
* 1 => array(
|
|
177
|
-
* 'start' => int, // The stack pointer to the first token in the parameter/array item.
|
|
178
|
-
* 'end' => int, // The stack pointer to the last token in the parameter/array item.
|
|
179
|
-
* 'raw' => string, // A string with the contents of all tokens between `start` and `end`.
|
|
180
|
-
* 'clean' => string, // Same as `raw`, but all comment tokens have been stripped out.
|
|
181
|
-
* )
|
|
182
|
-
* ```
|
|
183
|
-
* If a named parameter is encountered in a function call, the top-level index will not be
|
|
184
|
-
* the parameter _position_, but the _parameter name_ and the array will include two extra keys:
|
|
185
|
-
* ```php
|
|
186
|
-
* 'parameter_name' => array(
|
|
187
|
-
* 'name' => string, // The parameter name (without the colon).
|
|
188
|
-
* 'name_token' => int, // The stack pointer to the parameter name token.
|
|
189
|
-
* ...
|
|
190
|
-
* )
|
|
191
|
-
* ```
|
|
192
|
-
* The `'start'`, `'end'`, `'raw'` and `'clean'` indexes will always contain just and only
|
|
193
|
-
* information on the parameter value.
|
|
194
|
-
* _Note: The array starts at index 1 for positional parameters._
|
|
195
|
-
* _The key for named parameters will be the parameter name._
|
|
196
|
-
* If no parameters/array items are found, an empty array will be returned.
|
|
197
|
-
*
|
|
198
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the token passed is not one of the
|
|
199
|
-
* accepted types or doesn't exist.
|
|
200
|
-
*/
|
|
201
|
-
public static function getParameters(File $phpcsFile, $stackPtr, $limit = 0, $isShortArray = null)
|
|
202
|
-
{
|
|
203
|
-
if (self::hasParameters($phpcsFile, $stackPtr, $isShortArray) === false) {
|
|
204
|
-
return [];
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
$effectiveLimit = (\is_int($limit) && $limit > 0) ? $limit : 0;
|
|
208
|
-
|
|
209
|
-
if (Cache::isCached($phpcsFile, __METHOD__, "$stackPtr-$effectiveLimit") === true) {
|
|
210
|
-
return Cache::get($phpcsFile, __METHOD__, "$stackPtr-$effectiveLimit");
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if ($effectiveLimit !== 0 && Cache::isCached($phpcsFile, __METHOD__, "$stackPtr-0") === true) {
|
|
214
|
-
return \array_slice(Cache::get($phpcsFile, __METHOD__, "$stackPtr-0"), 0, $effectiveLimit, true);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Ok, we know we have a valid token with parameters and valid open & close brackets/parenthesis.
|
|
218
|
-
$tokens = $phpcsFile->getTokens();
|
|
219
|
-
|
|
220
|
-
// Mark the beginning and end tokens.
|
|
221
|
-
if (isset(Collections::shortArrayListOpenTokensBC()[$tokens[$stackPtr]['code']]) === true) {
|
|
222
|
-
$opener = $stackPtr;
|
|
223
|
-
$closer = $tokens[$stackPtr]['bracket_closer'];
|
|
224
|
-
} else {
|
|
225
|
-
$opener = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
|
226
|
-
$closer = $tokens[$opener]['parenthesis_closer'];
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
$mayHaveNames = (isset(Collections::functionCallTokens()[$tokens[$stackPtr]['code']]) === true);
|
|
230
|
-
|
|
231
|
-
$parameters = [];
|
|
232
|
-
$nextComma = $opener;
|
|
233
|
-
$paramStart = ($opener + 1);
|
|
234
|
-
$cnt = 1;
|
|
235
|
-
$stopPoints = self::$callParsingStopPoints + Tokens::$scopeOpeners;
|
|
236
|
-
$stopPoints[] = $tokens[$closer]['code'];
|
|
237
|
-
|
|
238
|
-
while (($nextComma = $phpcsFile->findNext($stopPoints, ($nextComma + 1), ($closer + 1))) !== false) {
|
|
239
|
-
// Ignore anything within square brackets.
|
|
240
|
-
if (isset($tokens[$nextComma]['bracket_opener'], $tokens[$nextComma]['bracket_closer'])
|
|
241
|
-
&& $nextComma === $tokens[$nextComma]['bracket_opener']
|
|
242
|
-
) {
|
|
243
|
-
$nextComma = $tokens[$nextComma]['bracket_closer'];
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// Skip past nested arrays, function calls and arbitrary groupings.
|
|
248
|
-
if ($tokens[$nextComma]['code'] === \T_OPEN_PARENTHESIS
|
|
249
|
-
&& isset($tokens[$nextComma]['parenthesis_closer'])
|
|
250
|
-
) {
|
|
251
|
-
$nextComma = $tokens[$nextComma]['parenthesis_closer'];
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// Skip past closures, anonymous classes and anything else scope related.
|
|
256
|
-
if (isset($tokens[$nextComma]['scope_condition'], $tokens[$nextComma]['scope_closer'])
|
|
257
|
-
&& $tokens[$nextComma]['scope_condition'] === $nextComma
|
|
258
|
-
) {
|
|
259
|
-
$nextComma = $tokens[$nextComma]['scope_closer'];
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// Skip over potentially large docblocks.
|
|
264
|
-
if ($tokens[$nextComma]['code'] === \T_DOC_COMMENT_OPEN_TAG
|
|
265
|
-
&& isset($tokens[$nextComma]['comment_closer'])
|
|
266
|
-
) {
|
|
267
|
-
$nextComma = $tokens[$nextComma]['comment_closer'];
|
|
268
|
-
continue;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// Skip over attributes.
|
|
272
|
-
if ($tokens[$nextComma]['code'] === \T_ATTRIBUTE
|
|
273
|
-
&& isset($tokens[$nextComma]['attribute_closer'])
|
|
274
|
-
) {
|
|
275
|
-
$nextComma = $tokens[$nextComma]['attribute_closer'];
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if ($tokens[$nextComma]['code'] !== \T_COMMA
|
|
280
|
-
&& $tokens[$nextComma]['code'] !== $tokens[$closer]['code']
|
|
281
|
-
) {
|
|
282
|
-
// Just in case.
|
|
283
|
-
continue; // @codeCoverageIgnore
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Ok, we've reached the end of the parameter.
|
|
287
|
-
$paramEnd = ($nextComma - 1);
|
|
288
|
-
$key = $cnt;
|
|
289
|
-
|
|
290
|
-
if ($mayHaveNames === true) {
|
|
291
|
-
$firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $paramStart, ($paramEnd + 1), true);
|
|
292
|
-
if ($firstNonEmpty !== $paramEnd) {
|
|
293
|
-
$secondNonEmpty = $phpcsFile->findNext(
|
|
294
|
-
Tokens::$emptyTokens,
|
|
295
|
-
($firstNonEmpty + 1),
|
|
296
|
-
($paramEnd + 1),
|
|
297
|
-
true
|
|
298
|
-
);
|
|
299
|
-
|
|
300
|
-
if ($tokens[$secondNonEmpty]['code'] === \T_COLON
|
|
301
|
-
&& $tokens[$firstNonEmpty]['code'] === \T_PARAM_NAME
|
|
302
|
-
) {
|
|
303
|
-
if (isset($parameters[$tokens[$firstNonEmpty]['content']]) === false) {
|
|
304
|
-
// Set the key to be the name, but only if we've not seen this name before.
|
|
305
|
-
$key = $tokens[$firstNonEmpty]['content'];
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
$parameters[$key]['name'] = $tokens[$firstNonEmpty]['content'];
|
|
309
|
-
$parameters[$key]['name_token'] = $firstNonEmpty;
|
|
310
|
-
$paramStart = ($secondNonEmpty + 1);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
$parameters[$key]['start'] = $paramStart;
|
|
316
|
-
$parameters[$key]['end'] = $paramEnd;
|
|
317
|
-
$parameters[$key]['raw'] = \trim(GetTokensAsString::normal($phpcsFile, $paramStart, $paramEnd));
|
|
318
|
-
$parameters[$key]['clean'] = \trim(GetTokensAsString::noComments($phpcsFile, $paramStart, $paramEnd));
|
|
319
|
-
|
|
320
|
-
// Check if there are more tokens before the closing parenthesis.
|
|
321
|
-
// Prevents function calls with trailing comma's from setting an extra parameter:
|
|
322
|
-
// `functionCall( $param1, $param2, );`.
|
|
323
|
-
$hasNextParam = $phpcsFile->findNext(
|
|
324
|
-
Tokens::$emptyTokens,
|
|
325
|
-
($nextComma + 1),
|
|
326
|
-
$closer,
|
|
327
|
-
true
|
|
328
|
-
);
|
|
329
|
-
if ($hasNextParam === false) {
|
|
330
|
-
// Reached the end, so for the purpose of caching, this should be saved as if no limit was set.
|
|
331
|
-
$effectiveLimit = 0;
|
|
332
|
-
break;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
// Stop if there is a valid limit and the limit has been reached.
|
|
336
|
-
if ($effectiveLimit !== 0 && $cnt === $effectiveLimit) {
|
|
337
|
-
break;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
// Prepare for the next parameter.
|
|
341
|
-
$paramStart = ($nextComma + 1);
|
|
342
|
-
++$cnt;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
if ($effectiveLimit !== 0 && $cnt === $effectiveLimit) {
|
|
346
|
-
Cache::set($phpcsFile, __METHOD__, "$stackPtr-$effectiveLimit", $parameters);
|
|
347
|
-
} else {
|
|
348
|
-
// Limit is 0 or total items is less than effective limit.
|
|
349
|
-
Cache::set($phpcsFile, __METHOD__, "$stackPtr-0", $parameters);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
return $parameters;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* Get information on a specific parameter passed.
|
|
357
|
-
*
|
|
358
|
-
* See {@see PassedParameters::hasParameters()} for information on the supported constructs.
|
|
359
|
-
*
|
|
360
|
-
* @see PassedParameters::getParameterFromStack() For when the parameter stack of a function call is
|
|
361
|
-
* already retrieved.
|
|
362
|
-
*
|
|
363
|
-
* @since 1.0.0
|
|
364
|
-
*
|
|
365
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
|
|
366
|
-
* @param int $stackPtr The position of function call name,
|
|
367
|
-
* language construct or array open token.
|
|
368
|
-
* @param int $paramOffset The 1-based index position of the parameter to retrieve.
|
|
369
|
-
* @param string|array<string> $paramNames Optional. Either the name of the target parameter
|
|
370
|
-
* to retrieve as a string or an array of names for the
|
|
371
|
-
* same target parameter.
|
|
372
|
-
* Only relevant for function calls.
|
|
373
|
-
* An arrays of names is supported to allow for functions
|
|
374
|
-
* for which the parameter names have undergone name
|
|
375
|
-
* changes over time.
|
|
376
|
-
* When specified, the name will take precedence over the
|
|
377
|
-
* offset.
|
|
378
|
-
* For PHP 8 support, it is STRONGLY recommended to
|
|
379
|
-
* always pass both the offset as well as the parameter
|
|
380
|
-
* name when examining function calls.
|
|
381
|
-
*
|
|
382
|
-
* @return array<string, int|string>|false Array with information on the parameter/array item at the specified
|
|
383
|
-
* offset, or with the specified name.
|
|
384
|
-
* Or `FALSE` if the specified parameter/array item is not found.
|
|
385
|
-
* See {@see PassedParameters::getParameters()} for the format of the
|
|
386
|
-
* returned (single-dimensional) array.
|
|
387
|
-
*
|
|
388
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the token passed is not one of the
|
|
389
|
-
* accepted types or doesn't exist.
|
|
390
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If a function call parameter is requested and
|
|
391
|
-
* the `$paramName` parameter is not passed.
|
|
392
|
-
*/
|
|
393
|
-
public static function getParameter(File $phpcsFile, $stackPtr, $paramOffset, $paramNames = [])
|
|
394
|
-
{
|
|
395
|
-
$tokens = $phpcsFile->getTokens();
|
|
396
|
-
|
|
397
|
-
if (empty($paramNames) === true) {
|
|
398
|
-
$parameters = self::getParameters($phpcsFile, $stackPtr, $paramOffset);
|
|
399
|
-
} else {
|
|
400
|
-
$parameters = self::getParameters($phpcsFile, $stackPtr);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/*
|
|
404
|
-
* Non-function calls.
|
|
405
|
-
*/
|
|
406
|
-
if (isset(Collections::functionCallTokens()[$tokens[$stackPtr]['code']]) === false) {
|
|
407
|
-
if (isset($parameters[$paramOffset]) === true) {
|
|
408
|
-
return $parameters[$paramOffset];
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
return false;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
/*
|
|
415
|
-
* Function calls.
|
|
416
|
-
*/
|
|
417
|
-
return self::getParameterFromStack($parameters, $paramOffset, $paramNames);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Count the number of parameters which have been passed.
|
|
422
|
-
*
|
|
423
|
-
* See {@see PassedParameters::hasParameters()} for information on the supported constructs.
|
|
424
|
-
*
|
|
425
|
-
* @since 1.0.0
|
|
426
|
-
*
|
|
427
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
|
|
428
|
-
* @param int $stackPtr The position of function call name,
|
|
429
|
-
* language construct or array open token.
|
|
430
|
-
*
|
|
431
|
-
* @return int
|
|
432
|
-
*
|
|
433
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the token passed is not one of the
|
|
434
|
-
* accepted types or doesn't exist.
|
|
435
|
-
*/
|
|
436
|
-
public static function getParameterCount(File $phpcsFile, $stackPtr)
|
|
437
|
-
{
|
|
438
|
-
if (self::hasParameters($phpcsFile, $stackPtr) === false) {
|
|
439
|
-
return 0;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return \count(self::getParameters($phpcsFile, $stackPtr));
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* Get information on a specific function call parameter passed.
|
|
447
|
-
*
|
|
448
|
-
* This is an efficiency method to correctly handle positional versus named parameters
|
|
449
|
-
* for function calls when multiple parameters need to be examined.
|
|
450
|
-
*
|
|
451
|
-
* See {@see PassedParameters::hasParameters()} for information on the supported constructs.
|
|
452
|
-
*
|
|
453
|
-
* @since 1.0.0
|
|
454
|
-
*
|
|
455
|
-
* @param array<int|string, array<string, int|string>> $parameters The output of a previous call to
|
|
456
|
-
* {@see PassedParameters::getParameters()}.
|
|
457
|
-
* @param int $paramOffset The 1-based index position of the parameter
|
|
458
|
-
* to retrieve.
|
|
459
|
-
* @param string|array<string> $paramNames Either the name of the target parameter to retrieve
|
|
460
|
-
* as a string or an array of names for the same target
|
|
461
|
-
* parameter.
|
|
462
|
-
* An array of names is supported to allow for functions
|
|
463
|
-
* for which the parameter names have undergone name
|
|
464
|
-
* changes over time.
|
|
465
|
-
* The name will take precedence over the offset.
|
|
466
|
-
*
|
|
467
|
-
* @return array<string, int|string>|false Array with information on the parameter at the specified offset,
|
|
468
|
-
* or with the specified name.
|
|
469
|
-
* Or `FALSE` if the specified parameter is not found.
|
|
470
|
-
* See {@see PassedParameters::getParameters()} for the format of the
|
|
471
|
-
* returned (single-dimensional) array.
|
|
472
|
-
*
|
|
473
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the `$paramNames` parameter is not passed
|
|
474
|
-
* and the requested parameter was not passed
|
|
475
|
-
* as a positional parameter in the function call
|
|
476
|
-
* being examined.
|
|
477
|
-
*/
|
|
478
|
-
public static function getParameterFromStack(array $parameters, $paramOffset, $paramNames)
|
|
479
|
-
{
|
|
480
|
-
if (empty($parameters) === true) {
|
|
481
|
-
return false;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
// First check for a named parameter.
|
|
485
|
-
if (empty($paramNames) === false) {
|
|
486
|
-
$paramNames = (array) $paramNames;
|
|
487
|
-
foreach ($paramNames as $name) {
|
|
488
|
-
// Note: parameter names are case-sensitive!.
|
|
489
|
-
if (isset($parameters[$name]) === true) {
|
|
490
|
-
return $parameters[$name];
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
// Next check for positional parameters.
|
|
496
|
-
if (isset($parameters[$paramOffset]) === true
|
|
497
|
-
&& isset($parameters[$paramOffset]['name']) === false
|
|
498
|
-
) {
|
|
499
|
-
return $parameters[$paramOffset];
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
if (empty($paramNames) === true) {
|
|
503
|
-
throw new RuntimeException(
|
|
504
|
-
'To allow for support for PHP 8 named parameters, the $paramNames parameter must be passed.'
|
|
505
|
-
);
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
return false;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* PHPCSUtils, utility functions and classes for PHP_CodeSniffer sniff developers.
|
|
4
|
-
*
|
|
5
|
-
* @package PHPCSUtils
|
|
6
|
-
* @copyright 2019-2020 PHPCSUtils Contributors
|
|
7
|
-
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
|
8
|
-
* @link https://github.com/PHPCSStandards/PHPCSUtils
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
namespace PHPCSUtils\Utils;
|
|
12
|
-
|
|
13
|
-
use PHP_CodeSniffer\Files\File;
|
|
14
|
-
use PHP_CodeSniffer\Util\Tokens;
|
|
15
|
-
use PHPCSUtils\Tokens\Collections;
|
|
16
|
-
use PHPCSUtils\Utils\Conditions;
|
|
17
|
-
use PHPCSUtils\Utils\Parentheses;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Utility functions for use when examining token scopes.
|
|
21
|
-
*
|
|
22
|
-
* @since 1.0.0
|
|
23
|
-
*/
|
|
24
|
-
final class Scopes
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Check whether the direct wrapping scope of a token is within a limited set of
|
|
29
|
-
* acceptable tokens.
|
|
30
|
-
*
|
|
31
|
-
* @since 1.0.0
|
|
32
|
-
*
|
|
33
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
|
|
34
|
-
* @param int $stackPtr The position in the stack of the
|
|
35
|
-
* token to verify.
|
|
36
|
-
* @param int|string|array<int|string> $validScopes Array of token constants representing
|
|
37
|
-
* the scopes considered valid.
|
|
38
|
-
*
|
|
39
|
-
* @return int|false Integer stack pointer to the valid direct scope; or `FALSE` if
|
|
40
|
-
* no valid direct scope was found.
|
|
41
|
-
*/
|
|
42
|
-
public static function validDirectScope(File $phpcsFile, $stackPtr, $validScopes)
|
|
43
|
-
{
|
|
44
|
-
$ptr = Conditions::getLastCondition($phpcsFile, $stackPtr);
|
|
45
|
-
|
|
46
|
-
if ($ptr !== false) {
|
|
47
|
-
$tokens = $phpcsFile->getTokens();
|
|
48
|
-
$validScopes = (array) $validScopes;
|
|
49
|
-
|
|
50
|
-
if (\in_array($tokens[$ptr]['code'], $validScopes, true) === true) {
|
|
51
|
-
return $ptr;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Check whether a T_CONST token is a class/interface/trait/enum constant declaration.
|
|
60
|
-
*
|
|
61
|
-
* @since 1.0.0
|
|
62
|
-
*
|
|
63
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
|
|
64
|
-
* @param int $stackPtr The position in the stack of the
|
|
65
|
-
* `T_CONST` token to verify.
|
|
66
|
-
*
|
|
67
|
-
* @return bool
|
|
68
|
-
*/
|
|
69
|
-
public static function isOOConstant(File $phpcsFile, $stackPtr)
|
|
70
|
-
{
|
|
71
|
-
$tokens = $phpcsFile->getTokens();
|
|
72
|
-
|
|
73
|
-
if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_CONST) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (self::validDirectScope($phpcsFile, $stackPtr, Collections::ooConstantScopes()) !== false) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Check whether a T_VARIABLE token is a class/trait property declaration.
|
|
86
|
-
*
|
|
87
|
-
* @since 1.0.0
|
|
88
|
-
*
|
|
89
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
|
|
90
|
-
* @param int $stackPtr The position in the stack of the
|
|
91
|
-
* `T_VARIABLE` token to verify.
|
|
92
|
-
*
|
|
93
|
-
* @return bool
|
|
94
|
-
*/
|
|
95
|
-
public static function isOOProperty(File $phpcsFile, $stackPtr)
|
|
96
|
-
{
|
|
97
|
-
$tokens = $phpcsFile->getTokens();
|
|
98
|
-
|
|
99
|
-
if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_VARIABLE) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
$scopePtr = self::validDirectScope($phpcsFile, $stackPtr, Collections::ooPropertyScopes());
|
|
104
|
-
if ($scopePtr !== false) {
|
|
105
|
-
// Make sure it's not a method parameter.
|
|
106
|
-
$deepestOpen = Parentheses::getLastOpener($phpcsFile, $stackPtr);
|
|
107
|
-
if ($deepestOpen === false
|
|
108
|
-
|| $deepestOpen < $scopePtr
|
|
109
|
-
|| Parentheses::isOwnerIn($phpcsFile, $deepestOpen, \T_FUNCTION) === false
|
|
110
|
-
) {
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Check whether a T_FUNCTION token is a class/interface/trait/enum method declaration.
|
|
120
|
-
*
|
|
121
|
-
* @since 1.0.0
|
|
122
|
-
*
|
|
123
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
|
|
124
|
-
* @param int $stackPtr The position in the stack of the
|
|
125
|
-
* `T_FUNCTION` token to verify.
|
|
126
|
-
*
|
|
127
|
-
* @return bool
|
|
128
|
-
*/
|
|
129
|
-
public static function isOOMethod(File $phpcsFile, $stackPtr)
|
|
130
|
-
{
|
|
131
|
-
$tokens = $phpcsFile->getTokens();
|
|
132
|
-
|
|
133
|
-
if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_FUNCTION) {
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (self::validDirectScope($phpcsFile, $stackPtr, Tokens::$ooScopeTokens) !== false) {
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
}
|