function Fixer::substrToken
Replace the content of a token with a part of its current content.
Parameters
int $stackPtr The position of the token in the token stack.:
int $start The first character to keep.:
int $length The number of characters to keep. If NULL, the content of: the token from $start to the end of the content is kept.
Return value
bool If the change was accepted.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Fixer.php, line 707
Class
Namespace
PHP_CodeSnifferCode
public function substrToken($stackPtr, $start, $length = null) {
$current = $this->getTokenContent($stackPtr);
if ($length === null) {
$newContent = substr($current, $start);
}
else {
$newContent = substr($current, $start, $length);
}
return $this->replaceToken($stackPtr, $newContent);
}