PATH:
opt
/
cpanel
/
ea-wappspector
/
vendor
/
slevomat
/
coding-standard
/
SlevomatCodingStandard
/
Sniffs
/
Classes
<?php declare(strict_types = 1); namespace SlevomatCodingStandard\Sniffs\Classes; use PHP_CodeSniffer\Files\File; use SlevomatCodingStandard\Helpers\TokenHelper; use function sprintf; use const T_CONST; use const T_ENUM_CASE; use const T_FUNCTION; use const T_USE; use const T_VARIABLE; class EnumCaseSpacingSniff extends AbstractPropertyConstantAndEnumCaseSpacing { public const CODE_INCORRECT_COUNT_OF_BLANK_LINES_AFTER_ENUM_CASE = 'IncorrectCountOfBlankLinesAfterEnumCase'; /** * @return array<int, (int|string)> */ public function register(): array { return [T_ENUM_CASE]; } protected function isNextMemberValid(File $phpcsFile, int $pointer): bool { $tokens = $phpcsFile->getTokens(); if ($tokens[$pointer]['code'] === T_ENUM_CASE) { return true; } $nextPointer = TokenHelper::findNext($phpcsFile, [T_FUNCTION, T_CONST, T_VARIABLE, T_USE, T_ENUM_CASE], $pointer + 1); return $nextPointer !== null && $tokens[$nextPointer]['code'] === T_ENUM_CASE; } protected function addError(File $phpcsFile, int $pointer, int $minExpectedLines, int $maxExpectedLines, int $found): bool { if ($minExpectedLines === $maxExpectedLines) { $errorMessage = $minExpectedLines === 1 ? 'Expected 1 blank line after enum case, found %3$d.' : 'Expected %2$d blank lines after enum case, found %3$d.'; } else { $errorMessage = 'Expected %1$d to %2$d blank lines after enum case, found %3$d.'; } $error = sprintf($errorMessage, $minExpectedLines, $maxExpectedLines, $found); return $phpcsFile->addFixableError($error, $pointer, self::CODE_INCORRECT_COUNT_OF_BLANK_LINES_AFTER_ENUM_CASE); } }
[-] MethodSpacingSniff.php
[edit]
[-] PropertySpacingSniff.php
[edit]
[-] EmptyLinesAroundClassBracesSniff.php
[edit]
[-] ClassLengthSniff.php
[edit]
[-] DisallowConstructorPropertyPromotionSniff.php
[edit]
[+]
..
[-] AbstractPropertyConstantAndEnumCaseSpacing.php
[edit]
[-] ParentCallSpacingSniff.php
[edit]
[-] RequireAbstractOrFinalSniff.php
[edit]
[-] RequireSelfReferenceSniff.php
[edit]
[-] RequireConstructorPropertyPromotionSniff.php
[edit]
[-] TraitUseDeclarationSniff.php
[edit]
[-] ConstantSpacingSniff.php
[edit]
[-] ForbiddenPublicPropertySniff.php
[edit]
[-] ClassStructureSniff.php
[edit]
[-] BackedEnumTypeSpacingSniff.php
[edit]
[-] UnsupportedClassGroupException.php
[edit]
[-] SuperfluousAbstractClassNamingSniff.php
[edit]
[-] ClassConstantVisibilitySniff.php
[edit]
[-] SuperfluousTraitNamingSniff.php
[edit]
[-] SuperfluousExceptionNamingSniff.php
[edit]
[-] UselessLateStaticBindingSniff.php
[edit]
[-] AbstractMethodSignature.php
[edit]
[-] TraitUseSpacingSniff.php
[edit]
[-] DisallowMultiPropertyDefinitionSniff.php
[edit]
[-] SuperfluousErrorNamingSniff.php
[edit]
[-] DisallowStringExpressionPropertyFetchSniff.php
[edit]
[-] SuperfluousInterfaceNamingSniff.php
[edit]
[-] RequireSingleLineMethodSignatureSniff.php
[edit]
[-] DisallowLateStaticBindingForConstantsSniff.php
[edit]
[-] RequireMultiLineMethodSignatureSniff.php
[edit]
[-] PropertyDeclarationSniff.php
[edit]
[-] ClassMemberSpacingSniff.php
[edit]
[-] MissingClassGroupsException.php
[edit]
[-] DisallowMultiConstantDefinitionSniff.php
[edit]
[-] EnumCaseSpacingSniff.php
[edit]
[-] ModernClassNameReferenceSniff.php
[edit]