REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 3.55 KB
Close
/opt/cpanel/ea-wappspector/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/AbstractRequireOneLineDocComment.php
Text
Base64
<?php declare(strict_types = 1); namespace SlevomatCodingStandard\Sniffs\Commenting; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; use SlevomatCodingStandard\Helpers\DocCommentHelper; use SlevomatCodingStandard\Helpers\FixerHelper; use SlevomatCodingStandard\Helpers\TokenHelper; use function rtrim; use const T_DOC_COMMENT_CLOSE_TAG; use const T_DOC_COMMENT_OPEN_TAG; use const T_DOC_COMMENT_STAR; use const T_DOC_COMMENT_WHITESPACE; /** * @internal */ abstract class AbstractRequireOneLineDocComment implements Sniff { abstract protected function addError(File $phpcsFile, int $docCommentStartPointer): bool; /** * @return array<int, (int|string)> */ public function register(): array { return [T_DOC_COMMENT_OPEN_TAG]; } /** * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint * @param int $docCommentStartPointer */ public function process(File $phpcsFile, $docCommentStartPointer): void { $tokens = $phpcsFile->getTokens(); // Only validate properties without description if (DocCommentHelper::hasDocCommentDescription($phpcsFile, $docCommentStartPointer)) { return; } $docCommentEndPointer = $tokens[$docCommentStartPointer]['comment_closer']; $lineDifference = $tokens[$docCommentEndPointer]['line'] - $tokens[$docCommentStartPointer]['line']; // Already one-line if ($lineDifference === 0) { return; } // Ignore empty lines $currentLinePointer = $docCommentStartPointer; do { $currentLinePointer = TokenHelper::findFirstTokenOnNextLine($phpcsFile, $currentLinePointer); if ($currentLinePointer === null || $currentLinePointer >= $docCommentEndPointer) { break; } $types = [T_DOC_COMMENT_STAR, T_DOC_COMMENT_CLOSE_TAG]; $startingPointer = TokenHelper::findNext($phpcsFile, $types, $currentLinePointer, $docCommentEndPointer); if ($startingPointer === null || $tokens[$startingPointer]['code'] === T_DOC_COMMENT_CLOSE_TAG) { break; } $nextEffectivePointer = TokenHelper::findNextExcluding( $phpcsFile, [T_DOC_COMMENT_WHITESPACE], $startingPointer + 1, $docCommentEndPointer + 1, ); if ($tokens[$currentLinePointer]['line'] === $tokens[$nextEffectivePointer]['line']) { continue; } $lineDifference--; } while (true); // Looks like a compound doc-comment if ($lineDifference > 2) { return; } $fix = $this->addError($phpcsFile, $docCommentStartPointer); if (!$fix) { return; } $contentStartPointer = TokenHelper::findNextExcluding( $phpcsFile, [ T_DOC_COMMENT_WHITESPACE, T_DOC_COMMENT_STAR, ], $docCommentStartPointer + 1, $docCommentEndPointer, ); $contentEndPointer = TokenHelper::findPreviousExcluding( $phpcsFile, [ T_DOC_COMMENT_WHITESPACE, T_DOC_COMMENT_STAR, ], $docCommentEndPointer - 1, $docCommentStartPointer, ); if ($contentStartPointer === null) { FixerHelper::removeBetween($phpcsFile, $docCommentStartPointer, $docCommentEndPointer); return; } $phpcsFile->fixer->beginChangeset(); for ($i = $docCommentStartPointer + 1; $i < $docCommentEndPointer; $i++) { if ($i >= $contentStartPointer && $i <= $contentEndPointer) { if ($i === $contentEndPointer) { FixerHelper::replace( $phpcsFile, $i, rtrim($phpcsFile->fixer->getTokenContent($i), ' '), ); } continue; } FixerHelper::replace($phpcsFile, $i, ''); } FixerHelper::addBefore($phpcsFile, $contentStartPointer, ' '); FixerHelper::addBefore($phpcsFile, $docCommentEndPointer, ' '); $phpcsFile->fixer->endChangeset(); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 14
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
AbstractRequireOneLineDocComment.php
3.55 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
AnnotationNameSniff.php
6.93 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DeprecatedAnnotationDeclarationSniff.php
1.29 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DisallowCommentAfterCodeSniff.php
4.77 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DisallowOneLinePropertyDocCommentSniff.php
2.65 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DocCommentSpacingSniff.php
25.19 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
EmptyCommentSniff.php
6.25 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ForbiddenAnnotationsSniff.php
3.83 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ForbiddenCommentsSniff.php
3.63 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
InlineDocCommentDeclarationSniff.php
13.98 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RequireOneLineDocCommentSniff.php
568 B
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RequireOneLinePropertyDocCommentSniff.php
1.89 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
UselessFunctionDocCommentSniff.php
3.95 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
UselessInheritDocCommentSniff.php
3.13 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).