REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.01 KB
Close
/opt/cpanel/ea-wappspector/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Arrays/MultiLineArrayEndBracketPlacementSniff.php
Text
Base64
<?php declare(strict_types = 1); namespace SlevomatCodingStandard\Sniffs\Arrays; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; use SlevomatCodingStandard\Helpers\ArrayHelper; use SlevomatCodingStandard\Helpers\FixerHelper; use SlevomatCodingStandard\Helpers\TokenHelper; use function in_array; class MultiLineArrayEndBracketPlacementSniff implements Sniff { public const CODE_ARRAY_END_WRONG_PLACEMENT = 'ArrayEndWrongPlacement'; /** * @return array<int, (int|string)> */ public function register(): array { return TokenHelper::ARRAY_TOKEN_CODES; } /** * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint * @param int $stackPointer */ public function process(File $phpcsFile, $stackPointer): void { $tokens = $phpcsFile->getTokens(); if (ArrayHelper::isMultiLine($phpcsFile, $stackPointer) === false) { return; } [$arrayOpenerPointer, $arrayCloserPointer] = ArrayHelper::openClosePointers($tokens[$stackPointer]); $nextEffective = TokenHelper::findNextEffective($phpcsFile, $arrayOpenerPointer + 1, $arrayCloserPointer); if ($nextEffective === null || in_array($tokens[$nextEffective]['code'], TokenHelper::ARRAY_TOKEN_CODES, true) === false) { return; } [$nextPointerOpener, $nextPointerCloser] = ArrayHelper::openClosePointers($tokens[$nextEffective]); $arraysStartAtSameLine = $tokens[$arrayOpenerPointer]['line'] === $tokens[$nextPointerOpener]['line']; $arraysEndAtSameLine = $tokens[$arrayCloserPointer]['line'] === $tokens[$nextPointerCloser]['line']; if (!$arraysStartAtSameLine || $arraysEndAtSameLine) { return; } $error = "Expected nested array to end at the same line as it's parent. Either put the nested array's end at the same line as the parent's end, or put the nested array start on it's own line."; $fix = $phpcsFile->addFixableError($error, $arrayOpenerPointer, self::CODE_ARRAY_END_WRONG_PLACEMENT); if (!$fix) { return; } FixerHelper::add($phpcsFile, $arrayOpenerPointer, $phpcsFile->eolChar); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 7
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
AlphabeticallySortedByKeysSniff.php
2.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
ArrayAccessSniff.php
1.85 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
DisallowImplicitArrayCreationSniff.php
8.10 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
DisallowPartiallyKeyedSniff.php
1008 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
MultiLineArrayEndBracketPlacementSniff.php
2.01 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
SingleLineArrayWhitespaceSniff.php
6.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
TrailingArrayCommaSniff.php
2.14 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).