Page MenuHomeSealhub

ArcanistConcatenationOperatorXHPASTLinterRule.php
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

ArcanistConcatenationOperatorXHPASTLinterRule.php

<?php
final class ArcanistConcatenationOperatorXHPASTLinterRule
extends ArcanistXHPASTLinterRule {
const ID = 44;
public function getLintName() {
return pht('Concatenation Spacing');
}
public function getLintSeverity() {
return ArcanistLintSeverity::SEVERITY_WARNING;
}
public function process(XHPASTNode $root) {
$tokens = $root->selectTokensOfType('.');
foreach ($tokens as $token) {
$prev = $token->getPrevToken();
$next = $token->getNextToken();
foreach (array('prev' => $prev, 'next' => $next) as $wtoken) {
if ($wtoken->getTypeName() !== 'T_WHITESPACE') {
continue;
}
$value = $wtoken->getValue();
if (strpos($value, "\n") !== false) {
// If the whitespace has a newline, it's conventional.
continue;
}
$next = $wtoken->getNextToken();
if ($next && $next->getTypeName() === 'T_COMMENT') {
continue;
}
$this->raiseLintAtToken(
$wtoken,
pht('Convention: no spaces around string concatenation operator.'),
'');
}
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Nov 28, 03:11 (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1206302
Default Alt Text
ArcanistConcatenationOperatorXHPASTLinterRule.php (1 KB)

Event Timeline