REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.09 KB
Close
/opt/cpanel/ea-wappspector/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/HereNowdocIdentifierSpacingSniff.php
Text
Base64
<?php /** * Ensures heredoc/nowdoc identifiers do not have any whitespace before them. * * @author Juliette Reinders Folmer <phpcs_nospam@adviesenzo.nl> * @copyright 2024 PHPCSStandards and contributors * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/licence.txt BSD Licence */ namespace PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; class HereNowdocIdentifierSpacingSniff implements Sniff { /** * Returns an array of tokens this test wants to listen for. * * @return array<int|string> */ public function register() { return [ T_START_HEREDOC, T_START_NOWDOC, ]; }//end register() /** * Processes this test, when one of its tokens is encountered. * * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. * @param int $stackPtr The position of the current token in * the stack passed in $tokens. * * @return void */ public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (strpos($tokens[$stackPtr]['content'], ' ') === false && strpos($tokens[$stackPtr]['content'], "\t") === false ) { // Nothing to do. $phpcsFile->recordMetric($stackPtr, 'Heredoc/nowdoc identifier', 'no space between <<< and ID'); return; } $phpcsFile->recordMetric($stackPtr, 'Heredoc/nowdoc identifier', 'space between <<< and ID'); $error = 'There should be no space between the <<< and the heredoc/nowdoc identifier string. Found: %s'; $data = [$tokens[$stackPtr]['content']]; $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpaceFound', $data); if ($fix === true) { $replacement = str_replace([' ', "\t"], '', $tokens[$stackPtr]['content']); $phpcsFile->fixer->replaceToken($stackPtr, $replacement); } }//end process() }//end class
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 8
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
ArbitraryParenthesesSpacingSniff.php
8.56 KB
lrw-r--r--
2025-11-04 16:30:35
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DisallowSpaceIndentSniff.php
8.39 KB
lrw-r--r--
2025-11-04 16:30:35
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DisallowTabIndentSniff.php
7.47 KB
lrw-r--r--
2025-11-04 16:30:35
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
HereNowdocIdentifierSpacingSniff.php
2.09 KB
lrw-r--r--
2025-11-04 16:30:35
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
IncrementDecrementSpacingSniff.php
5.94 KB
lrw-r--r--
2025-11-04 16:30:35
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LanguageConstructSpacingSniff.php
5.81 KB
lrw-r--r--
2025-11-04 16:30:35
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ScopeIndentSniff.php
69.49 KB
lrw-r--r--
2025-11-04 16:30:35
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
SpreadOperatorSpacingAfterSniff.php
4.79 KB
lrw-r--r--
2025-11-04 16:30:35
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).