Differential D25030 Diff 82 src/lint/linter/xhpast/rules/ArcanistClassNameLiteralXHPASTLinterRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/rules/ArcanistClassNameLiteralXHPASTLinterRule.php
Context not available. | |||||
$strings = $class_declaration->selectDescendantsOfType('n_STRING_SCALAR'); | $strings = $class_declaration->selectDescendantsOfType('n_STRING_SCALAR'); | ||||
foreach ($strings as $string) { | foreach ($strings as $string) { | ||||
$contents = substr($string->getSemanticString(), 1, -1); | $contents = @substr($string->getSemanticString(), 1, -1); | ||||
$replacement = null; | $replacement = null; | ||||
if ($contents == $class_name) { | if ($contents == $class_name) { | ||||
Context not available. | |||||
// clunky. | // clunky. | ||||
$regex = '(^'.preg_quote($class_name).'$)'; | $regex = '(^'.preg_quote($class_name).'$)'; | ||||
if (!preg_match($regex, $contents)) { | if (!@preg_match($regex, $contents)) { | ||||
continue; | continue; | ||||
} | } | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0