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,102 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* WordPress Coding Standard.
|
|
4
|
-
*
|
|
5
|
-
* @package WPCS\WordPressCodingStandards
|
|
6
|
-
* @link https://github.com/WordPress/WordPress-Coding-Standards
|
|
7
|
-
* @license https://opensource.org/licenses/MIT MIT
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
namespace WordPressCS\WordPress\Sniffs\WP;
|
|
11
|
-
|
|
12
|
-
use PHPCSUtils\Utils\Numbers;
|
|
13
|
-
use PHPCSUtils\Utils\TextStrings;
|
|
14
|
-
use WordPressCS\WordPress\AbstractArrayAssignmentRestrictionsSniff;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Flag returning high or infinite posts_per_page.
|
|
18
|
-
*
|
|
19
|
-
* @link https://vip.wordpress.com/documentation/vip-go/code-review-blockers-warnings-notices/#no-limit-queries
|
|
20
|
-
*
|
|
21
|
-
* @since 0.3.0
|
|
22
|
-
* @since 0.13.0 Class name changed: this class is now namespaced.
|
|
23
|
-
* @since 0.14.0 Added the posts_per_page property.
|
|
24
|
-
* @since 1.0.0 This sniff has been split into two, with the check for high pagination
|
|
25
|
-
* limit being part of the WP category, and the check for pagination
|
|
26
|
-
* disabling being part of the VIP category.
|
|
27
|
-
*/
|
|
28
|
-
final class PostsPerPageSniff extends AbstractArrayAssignmentRestrictionsSniff {
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Posts per page limit to check against.
|
|
32
|
-
*
|
|
33
|
-
* @since 0.14.0
|
|
34
|
-
*
|
|
35
|
-
* @var int
|
|
36
|
-
*/
|
|
37
|
-
public $posts_per_page = 100;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Groups of variables to restrict.
|
|
41
|
-
*
|
|
42
|
-
* @return array
|
|
43
|
-
*/
|
|
44
|
-
public function getGroups() {
|
|
45
|
-
return array(
|
|
46
|
-
'posts_per_page' => array(
|
|
47
|
-
'type' => 'warning',
|
|
48
|
-
'message' => 'Detected high pagination limit, `%s` is set to `%s`',
|
|
49
|
-
'keys' => array(
|
|
50
|
-
'posts_per_page',
|
|
51
|
-
'numberposts',
|
|
52
|
-
),
|
|
53
|
-
),
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Callback to process each confirmed key, to check value.
|
|
59
|
-
*
|
|
60
|
-
* @param string $key Array index / key.
|
|
61
|
-
* @param mixed $val Assigned value.
|
|
62
|
-
* @param int $line Token line.
|
|
63
|
-
* @param array $group Group definition.
|
|
64
|
-
*
|
|
65
|
-
* @return bool FALSE if no match, TRUE if matches.
|
|
66
|
-
*/
|
|
67
|
-
public function callback( $key, $val, $line, $group ) {
|
|
68
|
-
$stripped_val = TextStrings::stripQuotes( $val );
|
|
69
|
-
|
|
70
|
-
if ( '' === $stripped_val ) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if ( $val !== $stripped_val ) {
|
|
75
|
-
// The value was a text string. For text strings, we only accept purely numeric values.
|
|
76
|
-
if ( preg_match( '`^[0-9]+$`', $stripped_val ) !== 1 ) {
|
|
77
|
-
// Not a purely numeric value, so any comparison would be a false comparison.
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Purely numeric string, treat it as an integer from here on out.
|
|
82
|
-
$val = $stripped_val;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
$first_char = $val[0];
|
|
86
|
-
if ( '-' === $first_char || '+' === $first_char ) {
|
|
87
|
-
$val = ltrim( $val, '-+' );
|
|
88
|
-
} else {
|
|
89
|
-
$first_char = '';
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
$real_value = Numbers::getDecimalValue( $val );
|
|
93
|
-
if ( false === $real_value ) {
|
|
94
|
-
// This wasn't a purely numeric value, so any comparison would be a false comparison.
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
$val = $first_char . $real_value;
|
|
99
|
-
|
|
100
|
-
return ( (int) $val > (int) $this->posts_per_page );
|
|
101
|
-
}
|
|
102
|
-
}
|
package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/CastStructureSpacingSniff.php
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* WordPress Coding Standard.
|
|
4
|
-
*
|
|
5
|
-
* @package WPCS\WordPressCodingStandards
|
|
6
|
-
* @link https://github.com/WordPress/WordPress-Coding-Standards
|
|
7
|
-
* @license https://opensource.org/licenses/MIT MIT
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
namespace WordPressCS\WordPress\Sniffs\WhiteSpace;
|
|
11
|
-
|
|
12
|
-
use PHP_CodeSniffer\Util\Tokens;
|
|
13
|
-
use WordPressCS\WordPress\Sniff;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Ensure cast statements are preceded by whitespace.
|
|
17
|
-
*
|
|
18
|
-
* @link https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#space-usage
|
|
19
|
-
*
|
|
20
|
-
* @since 0.3.0
|
|
21
|
-
* @since 0.11.0 This sniff now has the ability to fix the issues it flags.
|
|
22
|
-
* @since 0.11.0 The error level for all errors thrown by this sniff has been raised from warning to error.
|
|
23
|
-
* @since 0.12.0 This class now extends the WordPressCS native `Sniff` class.
|
|
24
|
-
* @since 0.13.0 Class name changed: this class is now namespaced.
|
|
25
|
-
* @since 1.2.0 Removed the `NoSpaceAfterCloseParenthesis` error code in favour of the
|
|
26
|
-
* upstream `Generic.Formatting.SpaceAfterCast.NoSpace` error.
|
|
27
|
-
* @since 2.2.0 Added exception for whitespace between spread operator and cast.
|
|
28
|
-
*/
|
|
29
|
-
final class CastStructureSpacingSniff extends Sniff {
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Returns an array of tokens this test wants to listen for.
|
|
33
|
-
*
|
|
34
|
-
* @return array
|
|
35
|
-
*/
|
|
36
|
-
public function register() {
|
|
37
|
-
return Tokens::$castTokens;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Processes this test, when one of its tokens is encountered.
|
|
42
|
-
*
|
|
43
|
-
* @param int $stackPtr The position of the current token in the stack.
|
|
44
|
-
*
|
|
45
|
-
* @return void
|
|
46
|
-
*/
|
|
47
|
-
public function process_token( $stackPtr ) {
|
|
48
|
-
|
|
49
|
-
if ( \T_WHITESPACE !== $this->tokens[ ( $stackPtr - 1 ) ]['code']
|
|
50
|
-
&& \T_ELLIPSIS !== $this->tokens[ ( $stackPtr - 1 ) ]['code']
|
|
51
|
-
) {
|
|
52
|
-
$error = 'Expected a space before the type cast open parenthesis; none found';
|
|
53
|
-
$fix = $this->phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceBeforeOpenParenthesis' );
|
|
54
|
-
if ( true === $fix ) {
|
|
55
|
-
$this->phpcsFile->fixer->addContentBefore( $stackPtr, ' ' );
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
package/vendor/wp-coding-standards/wpcs/WordPress/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php
DELETED
|
@@ -1,486 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* WordPress Coding Standard.
|
|
4
|
-
*
|
|
5
|
-
* @package WPCS\WordPressCodingStandards
|
|
6
|
-
* @link https://github.com/WordPress/WordPress-Coding-Standards
|
|
7
|
-
* @license https://opensource.org/licenses/MIT MIT
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
namespace WordPressCS\WordPress\Sniffs\WhiteSpace;
|
|
11
|
-
|
|
12
|
-
use PHP_CodeSniffer\Util\Tokens;
|
|
13
|
-
use PHPCSUtils\Tokens\Collections;
|
|
14
|
-
use WordPressCS\WordPress\Sniff;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Checks that control structures have the correct spacing around brackets, based upon Squiz code.
|
|
18
|
-
*
|
|
19
|
-
* @since 0.1.0
|
|
20
|
-
* @since 2013-06-11 This sniff no longer supports JS.
|
|
21
|
-
* @since 0.3.0 This sniff now has the ability to fix most errors it flags.
|
|
22
|
-
* @since 0.7.0 This class now extends the WordPressCS native `Sniff` class.
|
|
23
|
-
* @since 0.13.0 Class name changed: this class is now namespaced.
|
|
24
|
-
* @since 3.0.0 Checks related to function declarations have been removed from this sniff.
|
|
25
|
-
*
|
|
26
|
-
* Last synced with base class 2021-11-20 at commit 7f11ffc8222b123c06345afd3261221561c3bb29.
|
|
27
|
-
* Note: This class has diverged quite far from the original. All the same, checking occasionally
|
|
28
|
-
* to see if there are upstream fixes made from which this sniff can benefit, is warranted.
|
|
29
|
-
* @link https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/src/Standards/Squiz/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php
|
|
30
|
-
*/
|
|
31
|
-
final class ControlStructureSpacingSniff extends Sniff {
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Check for blank lines on start/end of control structures.
|
|
35
|
-
*
|
|
36
|
-
* @var boolean
|
|
37
|
-
*/
|
|
38
|
-
public $blank_line_check = false;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Check for blank lines after control structures.
|
|
42
|
-
*
|
|
43
|
-
* @var boolean
|
|
44
|
-
*/
|
|
45
|
-
public $blank_line_after_check = true;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Require for space before T_COLON when using the alternative syntax for control structures.
|
|
49
|
-
*
|
|
50
|
-
* @var string one of 'required', 'forbidden', 'optional'
|
|
51
|
-
*/
|
|
52
|
-
public $space_before_colon = 'required';
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Tokens for which to ignore extra space on the inside of parenthesis.
|
|
56
|
-
*
|
|
57
|
-
* For do / else / try / finally, there are no parenthesis, so skip it.
|
|
58
|
-
*
|
|
59
|
-
* @since 0.11.0
|
|
60
|
-
*
|
|
61
|
-
* @var array
|
|
62
|
-
*/
|
|
63
|
-
private $ignore_extra_space_after_open_paren = array(
|
|
64
|
-
\T_DO => true,
|
|
65
|
-
\T_ELSE => true,
|
|
66
|
-
\T_TRY => true,
|
|
67
|
-
\T_FINALLY => true,
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Returns an array of tokens this test wants to listen for.
|
|
72
|
-
*
|
|
73
|
-
* @return array
|
|
74
|
-
*/
|
|
75
|
-
public function register() {
|
|
76
|
-
return array(
|
|
77
|
-
\T_IF,
|
|
78
|
-
\T_WHILE,
|
|
79
|
-
\T_FOREACH,
|
|
80
|
-
\T_FOR,
|
|
81
|
-
\T_SWITCH,
|
|
82
|
-
\T_DO,
|
|
83
|
-
\T_ELSE,
|
|
84
|
-
\T_ELSEIF,
|
|
85
|
-
\T_TRY,
|
|
86
|
-
\T_CATCH,
|
|
87
|
-
\T_FINALLY,
|
|
88
|
-
\T_MATCH,
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Processes this test, when one of its tokens is encountered.
|
|
94
|
-
*
|
|
95
|
-
* @param int $stackPtr The position of the current token in the stack.
|
|
96
|
-
*
|
|
97
|
-
* @return void
|
|
98
|
-
*/
|
|
99
|
-
public function process_token( $stackPtr ) {
|
|
100
|
-
if ( isset( $this->tokens[ ( $stackPtr + 1 ) ] ) && \T_WHITESPACE !== $this->tokens[ ( $stackPtr + 1 ) ]['code']
|
|
101
|
-
&& ! ( \T_ELSE === $this->tokens[ $stackPtr ]['code'] && \T_COLON === $this->tokens[ ( $stackPtr + 1 ) ]['code'] )
|
|
102
|
-
) {
|
|
103
|
-
$error = 'Space after opening control structure is required';
|
|
104
|
-
$fix = $this->phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceAfterStructureOpen' );
|
|
105
|
-
|
|
106
|
-
if ( true === $fix ) {
|
|
107
|
-
$this->phpcsFile->fixer->addContent( $stackPtr, ' ' );
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if ( ! isset( $this->tokens[ $stackPtr ]['scope_opener'], $this->tokens[ $stackPtr ]['scope_closer'] ) ) {
|
|
112
|
-
if ( \T_WHILE !== $this->tokens[ $stackPtr ]['code'] ) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
$scopeOpener = $this->tokens[ $stackPtr ]['scope_opener'];
|
|
117
|
-
$scopeCloser = $this->tokens[ $stackPtr ]['scope_closer'];
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Alternative syntax.
|
|
121
|
-
if ( isset( $scopeOpener ) && \T_COLON === $this->tokens[ $scopeOpener ]['code'] ) {
|
|
122
|
-
|
|
123
|
-
if ( 'required' === $this->space_before_colon ) {
|
|
124
|
-
|
|
125
|
-
if ( \T_WHITESPACE !== $this->tokens[ ( $scopeOpener - 1 ) ]['code'] ) {
|
|
126
|
-
$error = 'Space between opening control structure and T_COLON is required';
|
|
127
|
-
$fix = $this->phpcsFile->addFixableError( $error, $scopeOpener, 'NoSpaceBetweenStructureColon' );
|
|
128
|
-
|
|
129
|
-
if ( true === $fix ) {
|
|
130
|
-
$this->phpcsFile->fixer->addContentBefore( $scopeOpener, ' ' );
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
} elseif ( 'forbidden' === $this->space_before_colon ) {
|
|
134
|
-
|
|
135
|
-
if ( \T_WHITESPACE === $this->tokens[ ( $scopeOpener - 1 ) ]['code'] ) {
|
|
136
|
-
$error = 'Extra space between opening control structure and T_COLON found';
|
|
137
|
-
$fix = $this->phpcsFile->addFixableError( $error, ( $scopeOpener - 1 ), 'SpaceBetweenStructureColon' );
|
|
138
|
-
|
|
139
|
-
if ( true === $fix ) {
|
|
140
|
-
$this->phpcsFile->fixer->replaceToken( ( $scopeOpener - 1 ), '' );
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
$parenthesisOpener = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
|
|
147
|
-
|
|
148
|
-
if ( \T_COLON !== $this->tokens[ $parenthesisOpener ]['code']
|
|
149
|
-
&& ( $stackPtr + 1 ) === $parenthesisOpener
|
|
150
|
-
) {
|
|
151
|
-
// Checking space between keyword and open parenthesis, i.e. `if[*](...) {}`.
|
|
152
|
-
$error = 'No space before opening parenthesis is prohibited';
|
|
153
|
-
$fix = $this->phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceBeforeOpenParenthesis' );
|
|
154
|
-
|
|
155
|
-
if ( true === $fix ) {
|
|
156
|
-
$this->phpcsFile->fixer->addContent( $stackPtr, ' ' );
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if ( \T_WHITESPACE === $this->tokens[ ( $stackPtr + 1 ) ]['code']
|
|
161
|
-
&& ' ' !== $this->tokens[ ( $stackPtr + 1 ) ]['content']
|
|
162
|
-
) {
|
|
163
|
-
// Checking (too much) space between keyword and open parenthesis, i.e. `if [*](...) {}`.
|
|
164
|
-
$error = 'Expected exactly one space before opening parenthesis; "%s" found.';
|
|
165
|
-
$fix = $this->phpcsFile->addFixableError(
|
|
166
|
-
$error,
|
|
167
|
-
$stackPtr,
|
|
168
|
-
'ExtraSpaceBeforeOpenParenthesis',
|
|
169
|
-
array( $this->tokens[ ( $stackPtr + 1 ) ]['content'] )
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
if ( true === $fix ) {
|
|
173
|
-
$this->phpcsFile->fixer->replaceToken( ( $stackPtr + 1 ), ' ' );
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if ( \T_CLOSE_PARENTHESIS !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['code'] ) {
|
|
178
|
-
if ( \T_WHITESPACE !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['code'] ) {
|
|
179
|
-
// Checking space directly after the open parenthesis, i.e. `if ([*]...) {}`.
|
|
180
|
-
$error = 'No space after opening parenthesis is prohibited';
|
|
181
|
-
$fix = $this->phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceAfterOpenParenthesis' );
|
|
182
|
-
|
|
183
|
-
if ( true === $fix ) {
|
|
184
|
-
$this->phpcsFile->fixer->addContent( $parenthesisOpener, ' ' );
|
|
185
|
-
}
|
|
186
|
-
} elseif ( ( ' ' !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['content']
|
|
187
|
-
&& "\n" !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['content']
|
|
188
|
-
&& "\r\n" !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['content'] )
|
|
189
|
-
&& ! isset( $this->ignore_extra_space_after_open_paren[ $this->tokens[ $stackPtr ]['code'] ] )
|
|
190
|
-
) {
|
|
191
|
-
// Checking (too much) space directly after the open parenthesis, i.e. `if ([*]...) {}`.
|
|
192
|
-
$error = 'Expected exactly one space after opening parenthesis; "%s" found.';
|
|
193
|
-
$fix = $this->phpcsFile->addFixableError(
|
|
194
|
-
$error,
|
|
195
|
-
$stackPtr,
|
|
196
|
-
'ExtraSpaceAfterOpenParenthesis',
|
|
197
|
-
array( $this->tokens[ ( $parenthesisOpener + 1 ) ]['content'] )
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
if ( true === $fix ) {
|
|
201
|
-
$this->phpcsFile->fixer->replaceToken( ( $parenthesisOpener + 1 ), ' ' );
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if ( isset( $this->tokens[ $parenthesisOpener ]['parenthesis_closer'] ) ) {
|
|
207
|
-
|
|
208
|
-
$parenthesisCloser = $this->tokens[ $parenthesisOpener ]['parenthesis_closer'];
|
|
209
|
-
|
|
210
|
-
if ( \T_CLOSE_PARENTHESIS !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['code'] ) {
|
|
211
|
-
|
|
212
|
-
// Checking space directly before the close parenthesis, i.e. `if (...[*]) {}`.
|
|
213
|
-
if ( \T_WHITESPACE !== $this->tokens[ ( $parenthesisCloser - 1 ) ]['code'] ) {
|
|
214
|
-
$error = 'No space before closing parenthesis is prohibited';
|
|
215
|
-
$fix = $this->phpcsFile->addFixableError( $error, $parenthesisCloser, 'NoSpaceBeforeCloseParenthesis' );
|
|
216
|
-
|
|
217
|
-
if ( true === $fix ) {
|
|
218
|
-
$this->phpcsFile->fixer->addContentBefore( $parenthesisCloser, ' ' );
|
|
219
|
-
}
|
|
220
|
-
} elseif ( ' ' !== $this->tokens[ ( $parenthesisCloser - 1 ) ]['content'] ) {
|
|
221
|
-
$prevNonEmpty = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, ( $parenthesisCloser - 1 ), null, true );
|
|
222
|
-
if ( $this->tokens[ ( $parenthesisCloser ) ]['line'] === $this->tokens[ ( $prevNonEmpty + 1 ) ]['line'] ) {
|
|
223
|
-
$error = 'Expected exactly one space before closing parenthesis; "%s" found.';
|
|
224
|
-
$fix = $this->phpcsFile->addFixableError(
|
|
225
|
-
$error,
|
|
226
|
-
$stackPtr,
|
|
227
|
-
'ExtraSpaceBeforeCloseParenthesis',
|
|
228
|
-
array( $this->tokens[ ( $parenthesisCloser - 1 ) ]['content'] )
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
if ( true === $fix ) {
|
|
232
|
-
$this->phpcsFile->fixer->replaceToken( ( $parenthesisCloser - 1 ), ' ' );
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
if ( \T_WHITESPACE !== $this->tokens[ ( $parenthesisCloser + 1 ) ]['code']
|
|
238
|
-
&& ( isset( $scopeOpener ) && \T_COLON !== $this->tokens[ $scopeOpener ]['code'] )
|
|
239
|
-
) {
|
|
240
|
-
$error = 'Space between opening control structure and closing parenthesis is required';
|
|
241
|
-
$fix = $this->phpcsFile->addFixableError( $error, $scopeOpener, 'NoSpaceAfterCloseParenthesis' );
|
|
242
|
-
|
|
243
|
-
if ( true === $fix ) {
|
|
244
|
-
$this->phpcsFile->fixer->addContentBefore( $scopeOpener, ' ' );
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if ( isset( $this->tokens[ $parenthesisOpener ]['parenthesis_owner'] )
|
|
250
|
-
&& ( isset( $scopeOpener )
|
|
251
|
-
&& $this->tokens[ $parenthesisCloser ]['line'] !== $this->tokens[ $scopeOpener ]['line'] )
|
|
252
|
-
) {
|
|
253
|
-
$error = 'Opening brace should be on the same line as the declaration';
|
|
254
|
-
$fix = $this->phpcsFile->addFixableError( $error, $parenthesisOpener, 'OpenBraceNotSameLine' );
|
|
255
|
-
|
|
256
|
-
if ( true === $fix ) {
|
|
257
|
-
$this->phpcsFile->fixer->beginChangeset();
|
|
258
|
-
|
|
259
|
-
for ( $i = ( $parenthesisCloser + 1 ); $i < $scopeOpener; $i++ ) {
|
|
260
|
-
$this->phpcsFile->fixer->replaceToken( $i, '' );
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
$this->phpcsFile->fixer->addContent( $parenthesisCloser, ' ' );
|
|
264
|
-
$this->phpcsFile->fixer->endChangeset();
|
|
265
|
-
}
|
|
266
|
-
return;
|
|
267
|
-
|
|
268
|
-
} elseif ( \T_WHITESPACE === $this->tokens[ ( $parenthesisCloser + 1 ) ]['code']
|
|
269
|
-
&& ' ' !== $this->tokens[ ( $parenthesisCloser + 1 ) ]['content']
|
|
270
|
-
) {
|
|
271
|
-
// Checking space between the close parenthesis and the open brace, i.e. `if (...) [*]{}`.
|
|
272
|
-
$error = 'Expected exactly one space between closing parenthesis and opening control structure; "%s" found.';
|
|
273
|
-
$fix = $this->phpcsFile->addFixableError(
|
|
274
|
-
$error,
|
|
275
|
-
$stackPtr,
|
|
276
|
-
'ExtraSpaceAfterCloseParenthesis',
|
|
277
|
-
array( $this->tokens[ ( $parenthesisCloser + 1 ) ]['content'] )
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
if ( true === $fix ) {
|
|
281
|
-
$this->phpcsFile->fixer->replaceToken( ( $parenthesisCloser + 1 ), ' ' );
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if ( false !== $this->blank_line_check && isset( $scopeOpener ) ) {
|
|
287
|
-
$firstContent = $this->phpcsFile->findNext( \T_WHITESPACE, ( $scopeOpener + 1 ), null, true );
|
|
288
|
-
|
|
289
|
-
// We ignore spacing for some structures that tend to have their own rules.
|
|
290
|
-
$ignore = array(
|
|
291
|
-
\T_DOC_COMMENT_OPEN_TAG => true,
|
|
292
|
-
\T_CLOSE_TAG => true,
|
|
293
|
-
\T_COMMENT => true,
|
|
294
|
-
);
|
|
295
|
-
$ignore += Collections::closedScopes();
|
|
296
|
-
|
|
297
|
-
if ( ! isset( $ignore[ $this->tokens[ $firstContent ]['code'] ] )
|
|
298
|
-
&& $this->tokens[ $firstContent ]['line'] > ( $this->tokens[ $scopeOpener ]['line'] + 1 )
|
|
299
|
-
) {
|
|
300
|
-
$gap = ( $this->tokens[ $firstContent ]['line'] - $this->tokens[ $scopeOpener ]['line'] - 1 );
|
|
301
|
-
$this->phpcsFile->recordMetric( $stackPtr, 'Blank lines at start of control structure', $gap );
|
|
302
|
-
|
|
303
|
-
$error = 'Blank line found at start of control structure';
|
|
304
|
-
$fix = $this->phpcsFile->addFixableError( $error, $scopeOpener, 'BlankLineAfterStart' );
|
|
305
|
-
|
|
306
|
-
if ( true === $fix ) {
|
|
307
|
-
$this->phpcsFile->fixer->beginChangeset();
|
|
308
|
-
|
|
309
|
-
for ( $i = ( $scopeOpener + 1 ); $i < $firstContent; $i++ ) {
|
|
310
|
-
if ( $this->tokens[ $i ]['line'] === $this->tokens[ $firstContent ]['line'] ) {
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
$this->phpcsFile->fixer->replaceToken( $i, '' );
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
$this->phpcsFile->fixer->addNewline( $scopeOpener );
|
|
317
|
-
$this->phpcsFile->fixer->endChangeset();
|
|
318
|
-
}
|
|
319
|
-
} else {
|
|
320
|
-
$this->phpcsFile->recordMetric( $stackPtr, 'Blank lines at start of control structure', 0 );
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if ( isset( $scopeCloser ) && $firstContent !== $scopeCloser ) {
|
|
324
|
-
$lastContent = $this->phpcsFile->findPrevious( \T_WHITESPACE, ( $scopeCloser - 1 ), null, true );
|
|
325
|
-
|
|
326
|
-
$lastNonEmptyContent = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, ( $scopeCloser - 1 ), null, true );
|
|
327
|
-
|
|
328
|
-
$checkToken = $lastContent;
|
|
329
|
-
if ( isset( $this->tokens[ $lastNonEmptyContent ]['scope_condition'] ) ) {
|
|
330
|
-
$checkToken = $this->tokens[ $lastNonEmptyContent ]['scope_condition'];
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
if ( ! isset( $ignore[ $this->tokens[ $checkToken ]['code'] ] )
|
|
334
|
-
&& $this->tokens[ $lastContent ]['line'] <= ( $this->tokens[ $scopeCloser ]['line'] - 2 )
|
|
335
|
-
) {
|
|
336
|
-
$gap = ( $this->tokens[ $scopeCloser ]['line'] - $this->tokens[ $lastContent ]['line'] - 1 );
|
|
337
|
-
$this->phpcsFile->recordMetric( $stackPtr, 'Blank lines at end of control structure', $gap );
|
|
338
|
-
|
|
339
|
-
for ( $i = ( $scopeCloser - 1 ); $i > $lastContent; $i-- ) {
|
|
340
|
-
if ( $this->tokens[ $i ]['line'] < $this->tokens[ $scopeCloser ]['line']
|
|
341
|
-
&& \T_OPEN_TAG !== $this->tokens[ $firstContent ]['code']
|
|
342
|
-
) {
|
|
343
|
-
// TODO: Reporting error at empty line won't highlight it in IDE.
|
|
344
|
-
$error = 'Blank line found at end of control structure';
|
|
345
|
-
$fix = $this->phpcsFile->addFixableError( $error, $i, 'BlankLineBeforeEnd' );
|
|
346
|
-
|
|
347
|
-
if ( true === $fix ) {
|
|
348
|
-
$this->phpcsFile->fixer->beginChangeset();
|
|
349
|
-
|
|
350
|
-
for ( $j = ( $lastContent + 1 ); $j < $scopeCloser; $j++ ) {
|
|
351
|
-
if ( $this->tokens[ $j ]['line'] === $this->tokens[ $scopeCloser ]['line'] ) {
|
|
352
|
-
break;
|
|
353
|
-
}
|
|
354
|
-
$this->phpcsFile->fixer->replaceToken( $j, '' );
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/*
|
|
358
|
-
* PHPCS annotations, like normal inline comments, are tokenized including
|
|
359
|
-
* the new line at the end, so don't add any extra as it would cause a fixer
|
|
360
|
-
* conflict.
|
|
361
|
-
*/
|
|
362
|
-
if ( \T_COMMENT !== $this->tokens[ $lastContent ]['code']
|
|
363
|
-
&& ! isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $lastContent ]['code'] ] ) ) {
|
|
364
|
-
$this->phpcsFile->fixer->addNewlineBefore( $j );
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
$this->phpcsFile->fixer->endChangeset();
|
|
368
|
-
}
|
|
369
|
-
break;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
} else {
|
|
373
|
-
$this->phpcsFile->recordMetric( $stackPtr, 'Blank lines at end of control structure', 0 );
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
unset( $ignore );
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
if ( ! isset( $scopeCloser ) || true !== $this->blank_line_after_check ) {
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
if ( \T_MATCH === $this->tokens[ $stackPtr ]['code'] ) {
|
|
384
|
-
// Move the scope closer to the semicolon/comma.
|
|
385
|
-
$next = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $scopeCloser + 1 ), null, true );
|
|
386
|
-
if ( false !== $next
|
|
387
|
-
&& ( \T_SEMICOLON === $this->tokens[ $next ]['code'] || \T_COMMA === $this->tokens[ $next ]['code'] )
|
|
388
|
-
) {
|
|
389
|
-
$scopeCloser = $next;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
// {@internal This is just for the blank line check. Only whitespace should be considered,
|
|
394
|
-
// not "other" empty tokens.}}
|
|
395
|
-
$trailingContent = $this->phpcsFile->findNext( \T_WHITESPACE, ( $scopeCloser + 1 ), null, true );
|
|
396
|
-
if ( false === $trailingContent ) {
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
if ( \T_COMMENT === $this->tokens[ $trailingContent ]['code']
|
|
401
|
-
|| isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $trailingContent ]['code'] ] )
|
|
402
|
-
) {
|
|
403
|
-
// Special exception for code where the comment about
|
|
404
|
-
// an ELSE or ELSEIF is written between the control structures.
|
|
405
|
-
$nextCode = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $scopeCloser + 1 ), null, true );
|
|
406
|
-
|
|
407
|
-
if ( \T_ELSE === $this->tokens[ $nextCode ]['code'] || \T_ELSEIF === $this->tokens[ $nextCode ]['code'] ) {
|
|
408
|
-
$trailingContent = $nextCode;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// Move past end comments.
|
|
412
|
-
if ( $this->tokens[ $trailingContent ]['line'] === $this->tokens[ $scopeCloser ]['line'] ) {
|
|
413
|
-
if ( preg_match( '`^//[ ]?end`i', $this->tokens[ $trailingContent ]['content'], $matches ) > 0 ) {
|
|
414
|
-
$scopeCloser = $trailingContent;
|
|
415
|
-
$trailingContent = $this->phpcsFile->findNext( \T_WHITESPACE, ( $trailingContent + 1 ), null, true );
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
if ( \T_ELSE === $this->tokens[ $trailingContent ]['code'] && \T_IF === $this->tokens[ $stackPtr ]['code'] ) {
|
|
421
|
-
// IF with ELSE.
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
if ( \T_WHILE === $this->tokens[ $trailingContent ]['code'] && \T_DO === $this->tokens[ $stackPtr ]['code'] ) {
|
|
426
|
-
// DO with WHILE.
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
if ( \T_CATCH === $this->tokens[ $trailingContent ]['code'] && \T_TRY === $this->tokens[ $stackPtr ]['code'] ) {
|
|
431
|
-
// TRY with CATCH.
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
if ( \T_FINALLY === $this->tokens[ $trailingContent ]['code'] && \T_CATCH === $this->tokens[ $stackPtr ]['code'] ) {
|
|
436
|
-
// CATCH with FINALLY.
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
if ( \T_FINALLY === $this->tokens[ $trailingContent ]['code'] && \T_TRY === $this->tokens[ $stackPtr ]['code'] ) {
|
|
441
|
-
// TRY with FINALLY.
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
if ( \T_CLOSE_TAG === $this->tokens[ $trailingContent ]['code'] ) {
|
|
446
|
-
// At the end of the script or embedded code.
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
if ( isset( $this->tokens[ $trailingContent ]['scope_condition'] )
|
|
451
|
-
&& \T_CLOSE_CURLY_BRACKET === $this->tokens[ $trailingContent ]['code']
|
|
452
|
-
) {
|
|
453
|
-
// Another control structure's closing brace.
|
|
454
|
-
$owner = $this->tokens[ $trailingContent ]['scope_condition'];
|
|
455
|
-
if ( isset( Collections::closedScopes()[ $this->tokens[ $owner ]['code'] ] ) === true ) {
|
|
456
|
-
// The next content is the closing brace of a function, class, interface or trait
|
|
457
|
-
// so normal function/class rules apply and we can ignore it.
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
if ( ( $this->tokens[ $scopeCloser ]['line'] + 1 ) !== $this->tokens[ $trailingContent ]['line'] ) {
|
|
462
|
-
// TODO: Won't cover following case: "} echo 'OK';".
|
|
463
|
-
$error = 'Blank line found after control structure';
|
|
464
|
-
$fix = $this->phpcsFile->addFixableError( $error, $scopeCloser, 'BlankLineAfterEnd' );
|
|
465
|
-
|
|
466
|
-
if ( true === $fix ) {
|
|
467
|
-
$this->phpcsFile->fixer->beginChangeset();
|
|
468
|
-
|
|
469
|
-
$i = ( $scopeCloser + 1 );
|
|
470
|
-
while ( $this->tokens[ $i ]['line'] !== $this->tokens[ $trailingContent ]['line'] ) {
|
|
471
|
-
$this->phpcsFile->fixer->replaceToken( $i, '' );
|
|
472
|
-
++$i;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
// TODO: Instead a separate error should be triggered when content comes right after closing brace.
|
|
476
|
-
if ( \T_COMMENT !== $this->tokens[ $scopeCloser ]['code']
|
|
477
|
-
&& isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $scopeCloser ]['code'] ] ) === false
|
|
478
|
-
) {
|
|
479
|
-
$this->phpcsFile->fixer->addNewlineBefore( $trailingContent );
|
|
480
|
-
}
|
|
481
|
-
$this->phpcsFile->fixer->endChangeset();
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|