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,687 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* PHPCSUtils, utility functions and classes for PHP_CodeSniffer sniff developers.
|
|
4
|
-
*
|
|
5
|
-
* @package PHPCSUtils
|
|
6
|
-
* @copyright 2019-2020 PHPCSUtils Contributors
|
|
7
|
-
* @license https://opensource.org/licenses/LGPL-3.0 LGPL3
|
|
8
|
-
* @link https://github.com/PHPCSStandards/PHPCSUtils
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
namespace PHPCSUtils\Internal;
|
|
12
|
-
|
|
13
|
-
use PHP_CodeSniffer\Exceptions\RuntimeException;
|
|
14
|
-
use PHP_CodeSniffer\Files\File;
|
|
15
|
-
use PHP_CodeSniffer\Util\Tokens;
|
|
16
|
-
use PHPCSUtils\BackCompat\Helper;
|
|
17
|
-
use PHPCSUtils\Internal\Cache;
|
|
18
|
-
use PHPCSUtils\Internal\IsShortArrayOrListWithCache;
|
|
19
|
-
use PHPCSUtils\Internal\StableCollections;
|
|
20
|
-
use PHPCSUtils\Tokens\Collections;
|
|
21
|
-
use PHPCSUtils\Utils\Arrays;
|
|
22
|
-
use PHPCSUtils\Utils\Context;
|
|
23
|
-
use PHPCSUtils\Utils\Parentheses;
|
|
24
|
-
use PHPCSUtils\Utils\PassedParameters;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Determination of short array vs short list vs square brackets.
|
|
28
|
-
*
|
|
29
|
-
* Short list versus short array determination is done based on the following:
|
|
30
|
-
* - For "outer" arrays/lists the determination is straight forward, the surrounding
|
|
31
|
-
* tokens give enough clues. This includes "outer" arrays/lists in `foreach()` conditions
|
|
32
|
-
* or in attributes.
|
|
33
|
-
* - For nested short arrays/lists, it's a whole different matter.
|
|
34
|
-
* - Both arrays as well as lists can be used when setting _keys_ in arrays and lists
|
|
35
|
-
* (with array access or as a parameter in a function call etc).
|
|
36
|
-
* For arrays, a nested array used as a key will always need array access.
|
|
37
|
-
* For lists, a plain array can be used as the key. (seriously ^@!%&#?)
|
|
38
|
-
* When used as a key though, the nesting is irrelevant and if there is nesting, the "outer"
|
|
39
|
-
* set of brackets will also be part of the key.
|
|
40
|
-
* - Both arrays as well as lists can be used as _values_ in arrays.
|
|
41
|
-
* - Only nested lists (or variables) can be used as _values_ in lists.
|
|
42
|
-
*
|
|
43
|
-
* ---------------------------------------------------------------------------------------------
|
|
44
|
-
* This class is only intended for internal use by PHPCSUtils and is not part of the public API.
|
|
45
|
-
* This also means that it has no promise of backward compatibility.
|
|
46
|
-
*
|
|
47
|
-
* End-users should use the {@see \PHPCSUtils\Utils\Arrays::isShortArray()}
|
|
48
|
-
* or the {@see \PHPCSUtils\Utils\Lists::isShortList()} method instead.
|
|
49
|
-
* ---------------------------------------------------------------------------------------------
|
|
50
|
-
*
|
|
51
|
-
* @internal
|
|
52
|
-
*
|
|
53
|
-
* @since 1.0.0
|
|
54
|
-
*/
|
|
55
|
-
final class IsShortArrayOrList
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Type annotation for short arrays.
|
|
60
|
-
*
|
|
61
|
-
* @since 1.0.0
|
|
62
|
-
*
|
|
63
|
-
* @var string
|
|
64
|
-
*/
|
|
65
|
-
const SHORT_ARRAY = 'short array';
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Type annotation for short lists.
|
|
69
|
-
*
|
|
70
|
-
* @since 1.0.0
|
|
71
|
-
*
|
|
72
|
-
* @var string
|
|
73
|
-
*/
|
|
74
|
-
const SHORT_LIST = 'short list';
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Type annotation for square brackets.
|
|
78
|
-
*
|
|
79
|
-
* @since 1.0.0
|
|
80
|
-
*
|
|
81
|
-
* @var string
|
|
82
|
-
*/
|
|
83
|
-
const SQUARE_BRACKETS = 'square brackets';
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Limit for the amount of items to retrieve from inside a nested array/list.
|
|
87
|
-
*
|
|
88
|
-
* @since 1.0.0
|
|
89
|
-
*
|
|
90
|
-
* @var int
|
|
91
|
-
*/
|
|
92
|
-
const ITEM_LIMIT = 5;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Limit for recursing over inner nested arrays/lists.
|
|
96
|
-
*
|
|
97
|
-
* @since 1.0.0
|
|
98
|
-
*
|
|
99
|
-
* @var int
|
|
100
|
-
*/
|
|
101
|
-
const RECURSION_LIMIT = 3;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* The PHPCS file in which the current stackPtr was found.
|
|
105
|
-
*
|
|
106
|
-
* @since 1.0.0
|
|
107
|
-
*
|
|
108
|
-
* @var \PHP_CodeSniffer\Files\File
|
|
109
|
-
*/
|
|
110
|
-
private $phpcsFile;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* The token stack from the current file.
|
|
114
|
-
*
|
|
115
|
-
* @since 1.0.0
|
|
116
|
-
*
|
|
117
|
-
* @var array<int, array<string, mixed>>
|
|
118
|
-
*/
|
|
119
|
-
private $tokens;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Stack pointer to the open bracket.
|
|
123
|
-
*
|
|
124
|
-
* @since 1.0.0
|
|
125
|
-
*
|
|
126
|
-
* @var int
|
|
127
|
-
*/
|
|
128
|
-
private $opener;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Stack pointer to the close bracket.
|
|
132
|
-
*
|
|
133
|
-
* @since 1.0.0
|
|
134
|
-
*
|
|
135
|
-
* @var int
|
|
136
|
-
*/
|
|
137
|
-
private $closer;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Stack pointer to the first non-empty token before the open bracket.
|
|
141
|
-
*
|
|
142
|
-
* @since 1.0.0
|
|
143
|
-
*
|
|
144
|
-
* @var int
|
|
145
|
-
*/
|
|
146
|
-
private $beforeOpener;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Stack pointer to the first non-empty token after the close bracket.
|
|
150
|
-
*
|
|
151
|
-
* @since 1.0.0
|
|
152
|
-
*
|
|
153
|
-
* @var int|false Will be `false` if the close bracket is the last token in the file.
|
|
154
|
-
*/
|
|
155
|
-
private $afterCloser;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Current PHPCS version being used.
|
|
159
|
-
*
|
|
160
|
-
* @since 1.0.0
|
|
161
|
-
*
|
|
162
|
-
* @var string
|
|
163
|
-
*/
|
|
164
|
-
private $phpcsVersion; // @phpstan-ignore-line
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Tokens which can open a short array or short list (PHPCS cross-version compatible).
|
|
168
|
-
*
|
|
169
|
-
* @since 1.0.0
|
|
170
|
-
*
|
|
171
|
-
* @var array<int|string, int|string>
|
|
172
|
-
*/
|
|
173
|
-
private $openBrackets;
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Constructor.
|
|
177
|
-
*
|
|
178
|
-
* @since 1.0.0
|
|
179
|
-
*
|
|
180
|
-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
|
|
181
|
-
* @param int $stackPtr The position of the short array opener token.
|
|
182
|
-
*
|
|
183
|
-
* @return void
|
|
184
|
-
*
|
|
185
|
-
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the token passed is not one of the
|
|
186
|
-
* accepted types or doesn't exist.
|
|
187
|
-
*/
|
|
188
|
-
public function __construct(File $phpcsFile, $stackPtr)
|
|
189
|
-
{
|
|
190
|
-
$tokens = $phpcsFile->getTokens();
|
|
191
|
-
$openBrackets = StableCollections::$shortArrayListOpenTokensBC;
|
|
192
|
-
|
|
193
|
-
if (isset($tokens[$stackPtr]) === false
|
|
194
|
-
|| isset($openBrackets[$tokens[$stackPtr]['code']]) === false
|
|
195
|
-
) {
|
|
196
|
-
throw new RuntimeException(
|
|
197
|
-
'The IsShortArrayOrList class expects to be passed a T_OPEN_SHORT_ARRAY or T_OPEN_SQUARE_BRACKET token.'
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
$this->phpcsFile = $phpcsFile;
|
|
202
|
-
$this->tokens = $tokens;
|
|
203
|
-
$this->opener = $stackPtr;
|
|
204
|
-
|
|
205
|
-
$this->closer = $stackPtr;
|
|
206
|
-
if (isset($this->tokens[$stackPtr]['bracket_closer'])) {
|
|
207
|
-
$this->closer = $this->tokens[$stackPtr]['bracket_closer'];
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
$this->beforeOpener = $this->phpcsFile->findPrevious(Tokens::$emptyTokens, ($this->opener - 1), null, true);
|
|
211
|
-
$this->afterCloser = $this->phpcsFile->findNext(Tokens::$emptyTokens, ($this->closer + 1), null, true);
|
|
212
|
-
|
|
213
|
-
$this->phpcsVersion = Helper::getVersion();
|
|
214
|
-
$this->openBrackets = $openBrackets;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Determine whether the bracket is a short array, short list or real square bracket.
|
|
219
|
-
*
|
|
220
|
-
* @since 1.0.0
|
|
221
|
-
*
|
|
222
|
-
* @return string Either 'short array', 'short list' or 'square brackets'.
|
|
223
|
-
*/
|
|
224
|
-
public function solve()
|
|
225
|
-
{
|
|
226
|
-
if ($this->isSquareBracket() === true) {
|
|
227
|
-
return self::SQUARE_BRACKETS;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if ($this->afterCloser === false) {
|
|
231
|
-
// Live coding. Short array until told differently.
|
|
232
|
-
return self::SHORT_ARRAY;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// If the bracket closer is followed by an equals sign, it's always a short list.
|
|
236
|
-
if ($this->tokens[$this->afterCloser]['code'] === \T_EQUAL) {
|
|
237
|
-
return self::SHORT_LIST;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// Attributes can only contain constant expressions, i.e. lists not allowed.
|
|
241
|
-
if (Context::inAttribute($this->phpcsFile, $this->opener) === true) {
|
|
242
|
-
return self::SHORT_ARRAY;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
$type = $this->isInForeach();
|
|
246
|
-
if ($type !== false) {
|
|
247
|
-
return $type;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/*
|
|
251
|
-
* Check if this can be a nested set of brackets used as a value.
|
|
252
|
-
* That's the only "confusing" syntax left. In all other cases, it will be a short array.
|
|
253
|
-
*/
|
|
254
|
-
$hasRiskyTokenBeforeOpener = false;
|
|
255
|
-
if (isset($this->openBrackets[$this->tokens[$this->beforeOpener]['code']]) === true
|
|
256
|
-
|| $this->tokens[$this->beforeOpener]['code'] === \T_COMMA
|
|
257
|
-
|| $this->tokens[$this->beforeOpener]['code'] === \T_DOUBLE_ARROW
|
|
258
|
-
) {
|
|
259
|
-
$hasRiskyTokenBeforeOpener = true;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
$hasRiskyTokenAfterCloser = false;
|
|
263
|
-
if ($this->tokens[$this->afterCloser]['code'] === \T_COMMA
|
|
264
|
-
|| $this->tokens[$this->afterCloser]['code'] === \T_CLOSE_SHORT_ARRAY
|
|
265
|
-
|| $this->tokens[$this->afterCloser]['code'] === \T_CLOSE_SQUARE_BRACKET
|
|
266
|
-
) {
|
|
267
|
-
$hasRiskyTokenAfterCloser = true;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if ($hasRiskyTokenBeforeOpener === false || $hasRiskyTokenAfterCloser === false) {
|
|
271
|
-
return self::SHORT_ARRAY;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/*
|
|
275
|
-
* Check if this is the first/last item in a "parent" set of brackets.
|
|
276
|
-
* If so, skip straight to the parent and determine the type of that, the type
|
|
277
|
-
* of the inner set of brackets will be the same (as all other options have
|
|
278
|
-
* already been eliminated).
|
|
279
|
-
*/
|
|
280
|
-
if (isset($this->openBrackets[$this->tokens[$this->beforeOpener]['code']]) === true) {
|
|
281
|
-
return IsShortArrayOrListWithCache::getType($this->phpcsFile, $this->beforeOpener);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
$nextEffectiveAfterCloser = $this->afterCloser;
|
|
285
|
-
if ($this->tokens[$this->afterCloser]['code'] === \T_COMMA) {
|
|
286
|
-
// Skip over potential trailing commas.
|
|
287
|
-
$nextEffectiveAfterCloser = $this->phpcsFile->findNext(
|
|
288
|
-
Tokens::$emptyTokens,
|
|
289
|
-
($this->afterCloser + 1),
|
|
290
|
-
null,
|
|
291
|
-
true
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
if ($this->tokens[$nextEffectiveAfterCloser]['code'] === \T_CLOSE_SHORT_ARRAY
|
|
296
|
-
|| $this->tokens[$nextEffectiveAfterCloser]['code'] === \T_CLOSE_SQUARE_BRACKET
|
|
297
|
-
) {
|
|
298
|
-
return IsShortArrayOrListWithCache::getType($this->phpcsFile, $nextEffectiveAfterCloser);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/*
|
|
302
|
-
* Okay, so as of here, we know this set of brackets is preceded by a comma or double arrow
|
|
303
|
-
* and followed by a comma. This is the only ambiguous syntax left.
|
|
304
|
-
*/
|
|
305
|
-
|
|
306
|
-
/*
|
|
307
|
-
* Check if this could be a (nested) short list at all.
|
|
308
|
-
* A list must have at least one variable inside and can not be empty.
|
|
309
|
-
* An array, however, cannot contain empty items.
|
|
310
|
-
*/
|
|
311
|
-
$type = $this->walkInside($this->opener);
|
|
312
|
-
if ($type !== false) {
|
|
313
|
-
return $type;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// Last resort: walk up in the file to see if we can find a set of parent brackets...
|
|
317
|
-
$type = $this->walkOutside();
|
|
318
|
-
if ($type !== false) {
|
|
319
|
-
return $type;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// If everything failed, this will be a short array (shouldn't be possible).
|
|
323
|
-
return self::SHORT_ARRAY; // @codeCoverageIgnore
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Check if the brackets are in actual fact real square brackets.
|
|
328
|
-
*
|
|
329
|
-
* @since 1.0.0
|
|
330
|
-
*
|
|
331
|
-
* @return bool TRUE if these are real square brackets; FALSE otherwise.
|
|
332
|
-
*/
|
|
333
|
-
private function isSquareBracket()
|
|
334
|
-
{
|
|
335
|
-
if ($this->opener === $this->closer) {
|
|
336
|
-
// Parse error (unclosed bracket) or live coding. Bow out.
|
|
337
|
-
return true;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
// Check if this is a bracket we need to examine or a mistokenization.
|
|
341
|
-
return ($this->isShortArrayBracket() === false);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Verify that the current set of brackets is not affected by known PHPCS cross-version tokenizer issues.
|
|
346
|
-
*
|
|
347
|
-
* List of current tokenizer issues which affect the short array/short list tokenization:
|
|
348
|
-
* - {@link https://github.com/squizlabs/PHP_CodeSniffer/pull/3632 PHPCS#3632} (PHPCS < 3.7.2)
|
|
349
|
-
*
|
|
350
|
-
* List of previous tokenizer issues which affected the short array/short list tokenization for reference:
|
|
351
|
-
* - {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1284 PHPCS#1284} (PHPCS < 2.8.1)
|
|
352
|
-
* - {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1381 PHPCS#1381} (PHPCS < 2.9.0)
|
|
353
|
-
* - {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1971 PHPCS#1971} (PHPCS 2.8.0 - 3.2.3)
|
|
354
|
-
* - {@link https://github.com/squizlabs/PHP_CodeSniffer/pull/3013 PHPCS#3013} (PHPCS < 3.5.6)
|
|
355
|
-
* - {@link https://github.com/squizlabs/PHP_CodeSniffer/pull/3172 PHPCS#3172} (PHPCS < 3.6.0)
|
|
356
|
-
*
|
|
357
|
-
* @since 1.0.0
|
|
358
|
-
*
|
|
359
|
-
* @return bool TRUE if this is actually a short array bracket which needs to be examined,
|
|
360
|
-
* FALSE if it is an (incorrectly tokenized) square bracket.
|
|
361
|
-
*/
|
|
362
|
-
private function isShortArrayBracket()
|
|
363
|
-
{
|
|
364
|
-
if ($this->tokens[$this->opener]['code'] === \T_OPEN_SQUARE_BRACKET) {
|
|
365
|
-
// Currently there are no known issues with the tokenization in PHPCS 3.9.0 and higher.
|
|
366
|
-
return false;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
return true;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Check is this set of brackets is used within a foreach expression.
|
|
374
|
-
*
|
|
375
|
-
* @since 1.0.0
|
|
376
|
-
*
|
|
377
|
-
* @return string|false The determined type or FALSE if undetermined.
|
|
378
|
-
*/
|
|
379
|
-
private function isInForeach()
|
|
380
|
-
{
|
|
381
|
-
$inForeach = Context::inForeachCondition($this->phpcsFile, $this->opener);
|
|
382
|
-
if ($inForeach === false) {
|
|
383
|
-
return false;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
switch ($inForeach) {
|
|
387
|
-
case 'beforeAs':
|
|
388
|
-
if ($this->tokens[$this->afterCloser]['code'] === \T_AS) {
|
|
389
|
-
return self::SHORT_ARRAY;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
break;
|
|
393
|
-
|
|
394
|
-
case 'afterAs':
|
|
395
|
-
if ($this->tokens[$this->afterCloser]['code'] === \T_CLOSE_PARENTHESIS) {
|
|
396
|
-
$owner = Parentheses::getOwner($this->phpcsFile, $this->afterCloser);
|
|
397
|
-
if ($owner !== false && $this->tokens[$owner]['code'] === \T_FOREACH) {
|
|
398
|
-
return self::SHORT_LIST;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
break;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
/*
|
|
406
|
-
* Everything else will be a nested set of brackets (provided we're talking valid PHP),
|
|
407
|
-
* so disregard as it can not be determined yet.
|
|
408
|
-
*/
|
|
409
|
-
return false;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* Walk the first part of the contents between the brackets to see if we can determine if this
|
|
414
|
-
* is a short array or short list based on its contents.
|
|
415
|
-
*
|
|
416
|
-
* Short lists can only have another (nested) list or variable assignments, including property assignments
|
|
417
|
-
* and array index assignment, as the value inside the brackets.
|
|
418
|
-
*
|
|
419
|
-
* This won't walk the complete contents as that could be a huge performance drain. Just the first x items.
|
|
420
|
-
*
|
|
421
|
-
* @since 1.0.0
|
|
422
|
-
*
|
|
423
|
-
* @param int $opener The position of the short array open bracket token.
|
|
424
|
-
* @param int $recursions Optional. Keep track of how often we've recursed into this methd.
|
|
425
|
-
* Prevent infinite loops for extremely deeply nested arrays.
|
|
426
|
-
* Defaults to 0.
|
|
427
|
-
*
|
|
428
|
-
* @return string|false The determined type or FALSE if undetermined.
|
|
429
|
-
*/
|
|
430
|
-
private function walkInside($opener, $recursions = 0)
|
|
431
|
-
{
|
|
432
|
-
// Get the first 5 "parameters" and ignore the "is short array" check.
|
|
433
|
-
$items = PassedParameters::getParameters($this->phpcsFile, $opener, self::ITEM_LIMIT, true);
|
|
434
|
-
|
|
435
|
-
if ($items === []) {
|
|
436
|
-
/*
|
|
437
|
-
* A list can not be empty, so this must be an array, however as this is a nested
|
|
438
|
-
* set of brackets, let the outside brackets be the decider as it may be
|
|
439
|
-
* a coding error which a sniff needs to flag.
|
|
440
|
-
*/
|
|
441
|
-
return false;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
// Make sure vars assigned by reference are handled correctly.
|
|
445
|
-
$skip = Tokens::$emptyTokens;
|
|
446
|
-
$skip[] = \T_BITWISE_AND;
|
|
447
|
-
|
|
448
|
-
$skipNames = Collections::namespacedNameTokens() + Collections::ooHierarchyKeywords();
|
|
449
|
-
|
|
450
|
-
foreach ($items as $item) {
|
|
451
|
-
/*
|
|
452
|
-
* If we encounter a completely empty item, this must be a short list as arrays cannot contain
|
|
453
|
-
* empty items.
|
|
454
|
-
*/
|
|
455
|
-
if ($item['clean'] === '') {
|
|
456
|
-
return self::SHORT_LIST;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
/*
|
|
460
|
-
* If the "value" part of the entry doesn't start with a variable, a (nested) short list/array,
|
|
461
|
-
* or a static property assignment, we know for sure that the outside brackets will be an array.
|
|
462
|
-
*/
|
|
463
|
-
$arrow = Arrays::getDoubleArrowPtr($this->phpcsFile, $item['start'], $item['end']);
|
|
464
|
-
if ($arrow === false) {
|
|
465
|
-
$firstNonEmptyInValue = $this->phpcsFile->findNext($skip, $item['start'], ($item['end'] + 1), true);
|
|
466
|
-
} else {
|
|
467
|
-
$firstNonEmptyInValue = $this->phpcsFile->findNext($skip, ($arrow + 1), ($item['end'] + 1), true);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
if ($this->tokens[$firstNonEmptyInValue]['code'] !== \T_VARIABLE
|
|
471
|
-
&& isset(Collections::namespacedNameTokens()[$this->tokens[$firstNonEmptyInValue]['code']]) === false
|
|
472
|
-
&& isset(Collections::ooHierarchyKeywords()[$this->tokens[$firstNonEmptyInValue]['code']]) === false
|
|
473
|
-
&& isset($this->openBrackets[$this->tokens[$firstNonEmptyInValue]['code']]) === false
|
|
474
|
-
) {
|
|
475
|
-
return self::SHORT_ARRAY;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/*
|
|
479
|
-
* Check if this is a potential list assignment to a static variable.
|
|
480
|
-
* If not, again, we can be sure it will be a short array.
|
|
481
|
-
*/
|
|
482
|
-
if (isset(Collections::namespacedNameTokens()[$this->tokens[$firstNonEmptyInValue]['code']]) === true
|
|
483
|
-
|| isset(Collections::ooHierarchyKeywords()[$this->tokens[$firstNonEmptyInValue]['code']]) === true
|
|
484
|
-
) {
|
|
485
|
-
$nextAfter = $this->phpcsFile->findNext($skipNames, ($firstNonEmptyInValue + 1), null, true);
|
|
486
|
-
|
|
487
|
-
if ($this->tokens[$nextAfter]['code'] !== \T_DOUBLE_COLON) {
|
|
488
|
-
return self::SHORT_ARRAY;
|
|
489
|
-
} else {
|
|
490
|
-
/*
|
|
491
|
-
* Double colon, so make sure there is a variable after it.
|
|
492
|
-
* If not, it's constant or function call, i.e. a short array.
|
|
493
|
-
*/
|
|
494
|
-
$nextNextAfter = $this->phpcsFile->findNext(Tokens::$emptyTokens, ($nextAfter + 1), null, true);
|
|
495
|
-
if ($this->tokens[$nextNextAfter]['code'] !== \T_VARIABLE) {
|
|
496
|
-
return self::SHORT_ARRAY;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
continue;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
if (isset($this->openBrackets[$this->tokens[$firstNonEmptyInValue]['code']]) === true) {
|
|
504
|
-
/*
|
|
505
|
-
* If the "value" part starts with an open bracket, but has other tokens after it, the current,
|
|
506
|
-
* outside set of brackets will always be an array (the brackets in the value can still be both,
|
|
507
|
-
* but that's not the concern of the current determination).
|
|
508
|
-
*/
|
|
509
|
-
$lastNonEmptyInValue = $this->phpcsFile->findPrevious(
|
|
510
|
-
Tokens::$emptyTokens,
|
|
511
|
-
$item['end'],
|
|
512
|
-
$item['start'],
|
|
513
|
-
true
|
|
514
|
-
);
|
|
515
|
-
if (isset($this->tokens[$firstNonEmptyInValue]['bracket_closer']) === true
|
|
516
|
-
&& $this->tokens[$firstNonEmptyInValue]['bracket_closer'] !== $lastNonEmptyInValue
|
|
517
|
-
) {
|
|
518
|
-
return self::SHORT_ARRAY;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
/*
|
|
522
|
-
* Recursively check the inner set of brackets for contents indicating this is not a short list.
|
|
523
|
-
*/
|
|
524
|
-
if ($recursions < self::RECURSION_LIMIT) {
|
|
525
|
-
$innerType = $this->walkInside($firstNonEmptyInValue, ($recursions + 1));
|
|
526
|
-
if ($innerType !== false) {
|
|
527
|
-
return $innerType;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
// Undetermined.
|
|
534
|
-
return false;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
/**
|
|
538
|
-
* Walk up in the file to try and find an "outer" set of brackets for an ambiguous, potentially
|
|
539
|
-
* nested set of brackets.
|
|
540
|
-
*
|
|
541
|
-
* This should really be the last resort, if all else fails to determine the type of the brackets.
|
|
542
|
-
*
|
|
543
|
-
* @since 1.0.0
|
|
544
|
-
*
|
|
545
|
-
* @return string|false The determined type or FALSE if undetermined.
|
|
546
|
-
*/
|
|
547
|
-
private function walkOutside()
|
|
548
|
-
{
|
|
549
|
-
$stopPoints = Collections::phpOpenTags();
|
|
550
|
-
$stopPoints[\T_SEMICOLON] = \T_SEMICOLON;
|
|
551
|
-
|
|
552
|
-
for ($i = ($this->opener - 1); $i >= 0; $i--) {
|
|
553
|
-
// Skip over block comments (just in case).
|
|
554
|
-
if ($this->tokens[$i]['code'] === \T_DOC_COMMENT_CLOSE_TAG) {
|
|
555
|
-
$i = $this->tokens[$i]['comment_opener'];
|
|
556
|
-
continue;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
if (isset(Tokens::$emptyTokens[$this->tokens[$i]['code']]) === true) {
|
|
560
|
-
continue;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
// Stop on an end of statement.
|
|
564
|
-
if (isset($stopPoints[$this->tokens[$i]['code']]) === true) {
|
|
565
|
-
// End of previous statement or start of document.
|
|
566
|
-
return self::SHORT_ARRAY;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
if (isset($this->tokens[$i]['scope_opener'], $this->tokens[$i]['scope_closer']) === true) {
|
|
570
|
-
if ($i === $this->tokens[$i]['scope_opener']
|
|
571
|
-
&& $this->tokens[$i]['scope_closer'] > $this->closer
|
|
572
|
-
) {
|
|
573
|
-
// Found a scope wrapping this set of brackets before finding a outer set of brackets.
|
|
574
|
-
// This will be a short array.
|
|
575
|
-
return self::SHORT_ARRAY;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
if ($i === $this->tokens[$i]['scope_closer']
|
|
579
|
-
&& isset($this->tokens[$i]['scope_condition']) === true
|
|
580
|
-
) {
|
|
581
|
-
$i = $this->tokens[$i]['scope_condition'];
|
|
582
|
-
continue;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
// Scope opener without scope condition shouldn't be possible, but just in case.
|
|
586
|
-
// @codeCoverageIgnoreStart
|
|
587
|
-
$i = $this->tokens[$i]['scope_opener'];
|
|
588
|
-
continue;
|
|
589
|
-
// @codeCoverageIgnoreEnd
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
if (isset($this->tokens[$i]['parenthesis_opener'], $this->tokens[$i]['parenthesis_closer']) === true) {
|
|
593
|
-
if ($i === $this->tokens[$i]['parenthesis_opener']
|
|
594
|
-
&& $this->tokens[$i]['parenthesis_closer'] > $this->closer
|
|
595
|
-
) {
|
|
596
|
-
$beforeParensOpen = $this->phpcsFile->findPrevious(Tokens::$emptyTokens, ($i - 1), null, true);
|
|
597
|
-
if ($this->tokens[$beforeParensOpen]['code'] === \T_LIST) {
|
|
598
|
-
// Parse error, mixing long and short list, but that's not our concern.
|
|
599
|
-
return self::SHORT_LIST;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
// Found parentheses wrapping this set of brackets before finding a outer set of brackets.
|
|
603
|
-
// This will be a short array.
|
|
604
|
-
return self::SHORT_ARRAY;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
if ($i === $this->tokens[$i]['parenthesis_closer']) {
|
|
608
|
-
if (isset($this->tokens[$i]['parenthesis_owner']) === true) {
|
|
609
|
-
$i = $this->tokens[$i]['parenthesis_owner'];
|
|
610
|
-
continue;
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
// Parenthesis closer without owner (function call and such).
|
|
615
|
-
$i = $this->tokens[$i]['parenthesis_opener'];
|
|
616
|
-
continue;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
/*
|
|
620
|
-
* Skip over attributes.
|
|
621
|
-
* No special handling needed, brackets within attributes won't reach this
|
|
622
|
-
* method as they are already handled within the solve() method.
|
|
623
|
-
*/
|
|
624
|
-
if (isset($this->tokens[$i]['attribute_opener'], $this->tokens[$i]['attribute_closer']) === true
|
|
625
|
-
&& $i === $this->tokens[$i]['attribute_closer']
|
|
626
|
-
) {
|
|
627
|
-
$i = $this->tokens[$i]['attribute_opener'];
|
|
628
|
-
continue;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
/*
|
|
632
|
-
* This is a close bracket, but it's not the outer wrapper.
|
|
633
|
-
* As we skip over parentheses and curlies above, we *know* this will be a
|
|
634
|
-
* set of brackets at the same bracket "nesting level" as the set we are examining.
|
|
635
|
-
*/
|
|
636
|
-
if (isset($this->tokens[$i]['bracket_opener'], $this->tokens[$i]['bracket_closer']) === true
|
|
637
|
-
&& $i === $this->tokens[$i]['bracket_closer']
|
|
638
|
-
) {
|
|
639
|
-
/*
|
|
640
|
-
* Now, if the set of brackets follows the same code pattern (comma or double arrow before,
|
|
641
|
-
* comma after), this will be an adjacent set of potentially nested brackets.
|
|
642
|
-
* If so, check if the type of the previous set of brackets has already been determined
|
|
643
|
-
* as adjacent sets of brackets will have the same type.
|
|
644
|
-
*/
|
|
645
|
-
$adjOpener = $this->tokens[$i]['bracket_opener'];
|
|
646
|
-
$prevNonEmpty = $this->phpcsFile->findPrevious(Tokens::$emptyTokens, ($adjOpener - 1), null, true);
|
|
647
|
-
$nextNonEmpty = $this->phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true);
|
|
648
|
-
|
|
649
|
-
if ($this->tokens[$prevNonEmpty]['code'] === $this->tokens[$this->beforeOpener]['code']
|
|
650
|
-
&& $this->tokens[$nextNonEmpty]['code'] === $this->tokens[$this->afterCloser]['code']
|
|
651
|
-
&& Cache::isCached($this->phpcsFile, IsShortArrayOrListWithCache::CACHE_KEY, $adjOpener) === true
|
|
652
|
-
) {
|
|
653
|
-
return Cache::get($this->phpcsFile, IsShortArrayOrListWithCache::CACHE_KEY, $adjOpener);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
// If not, skip over it.
|
|
657
|
-
$i = $this->tokens[$i]['bracket_opener'];
|
|
658
|
-
continue;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
// Open bracket.
|
|
662
|
-
if (isset($this->openBrackets[$this->tokens[$i]['code']]) === true) {
|
|
663
|
-
if (isset($this->tokens[$i]['bracket_closer']) === false
|
|
664
|
-
|| $this->tokens[$i]['code'] === \T_OPEN_SQUARE_BRACKET
|
|
665
|
-
) {
|
|
666
|
-
/*
|
|
667
|
-
* If the type of the unclosed "outer" brackets cannot be determined or
|
|
668
|
-
* they are identified as plain square brackets, the inner brackets
|
|
669
|
-
* we are examining should be regarded as a short array.
|
|
670
|
-
*/
|
|
671
|
-
return self::SHORT_ARRAY;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
if ($this->tokens[$i]['bracket_closer'] > $this->closer) {
|
|
675
|
-
// This is one we have to examine further as an outer set of brackets.
|
|
676
|
-
// As all the other checks have already failed to get a result, we know that
|
|
677
|
-
// whatever the outer set is, the inner set will be the same.
|
|
678
|
-
return IsShortArrayOrListWithCache::getType($this->phpcsFile, $i);
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
// Reached the start of the file without finding an outer set of brackets.
|
|
684
|
-
// Shouldn't be possible, but just in case.
|
|
685
|
-
return false; // @codeCoverageIgnore
|
|
686
|
-
}
|
|
687
|
-
}
|