REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.65 KB
Close
/opt/cpanel/ea-wappspector/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/DisallowOneLinePropertyDocCommentSniff.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\PropertyHelper; use SlevomatCodingStandard\Helpers\TokenHelper; use function rtrim; use function sprintf; use const T_VARIABLE; use const T_WHITESPACE; class DisallowOneLinePropertyDocCommentSniff implements Sniff { public const CODE_ONE_LINE_PROPERTY_COMMENT = 'OneLinePropertyComment'; /** * @return list<int> */ public function register(): array { return [T_VARIABLE]; } /** * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint * @param int $propertyPointer */ public function process(File $phpcsFile, $propertyPointer): void { $tokens = $phpcsFile->getTokens(); // Not a property if (!PropertyHelper::isProperty($phpcsFile, $propertyPointer)) { return; } // Only validate properties with comment if (!DocCommentHelper::hasDocComment($phpcsFile, $propertyPointer)) { return; } /** @var int $docCommentStartPointer */ $docCommentStartPointer = DocCommentHelper::findDocCommentOpenPointer($phpcsFile, $propertyPointer); $docCommentEndPointer = $tokens[$docCommentStartPointer]['comment_closer']; $lineDifference = $tokens[$docCommentEndPointer]['line'] - $tokens[$docCommentStartPointer]['line']; // Already multi-line if ($lineDifference !== 0) { return; } $fix = $phpcsFile->addFixableError( sprintf( 'Found one-line comment for property %s, use multi-line comment instead.', PropertyHelper::getFullyQualifiedName($phpcsFile, $propertyPointer), ), $docCommentStartPointer, self::CODE_ONE_LINE_PROPERTY_COMMENT, ); if (!$fix) { return; } $commentWhitespacePointer = TokenHelper::findPrevious($phpcsFile, [T_WHITESPACE], $docCommentStartPointer); $indent = ($commentWhitespacePointer !== null ? $tokens[$commentWhitespacePointer]['content'] : '') . ' '; $phpcsFile->fixer->beginChangeset(); $phpcsFile->fixer->addNewline($docCommentStartPointer); FixerHelper::add($phpcsFile, $docCommentStartPointer, $indent); FixerHelper::add($phpcsFile, $docCommentStartPointer, '*'); if ($docCommentEndPointer - 1 !== $docCommentStartPointer) { FixerHelper::replace( $phpcsFile, $docCommentEndPointer - 1, rtrim($phpcsFile->fixer->getTokenContent($docCommentEndPointer - 1), ' '), ); } FixerHelper::addBefore($phpcsFile, $docCommentEndPointer, $indent); $phpcsFile->fixer->addNewlineBefore($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).